HACKER Q&A
📣 JaFu0815

Hunting for a Framework


Hello HN!

My primary background is in desktop development and my knowledge of web development is a little rusty by now. I know about Node.JS, Angular, React, Express and the like and have done a few small projects with these technologies. So far, I have implemented the below requirements for each project myself or copied them from previous projects. Now I am looking for a reasonable fullstack framework with the following requirements:

- A central definition of data schemas. I don't want to define my schema or validation twice, once in the frontend and once in the backend.

- Automatic generation of REST endpoints. I hate boilerplate code and don't want to reimplement Get/GetOne/Add/Update/Delete and Websocket for each data model. Even better would be a GraphQL interface.

- Authorization and Authentication

- No manual HTTP calls for standard cases. I want to define my model at the server and have the data available in an array at the client. As soon as a client inserts a record in his list I want that automatically a POST with the new record is sent to the server, it verifies the model and the authorization and inserts the record into the database. Then the server notifies the other clients about the change using websockets. The other clients see the new data record in their array without having to write a single manual HTTP call or websocket connection.

- Open Source Only. No Firebase or similar.

I've been searching for a while, but haven't found anything that seems reasonable. If I don't find anything I will write a small framework myself. I apologize if I seem lazy and don't want to search myself, but I'm really getting desperate. I want to spend as little time as possible on writing boilerplate and instead write business logic. There are thousands of javascript frameworks out there but none of them seem to handle these simple standard cases very well. They all require manual implementation of CRUD for each model or manual data fetching and subscription. Please make suggestions for frameworks and help me to see through the framework jungle!


  👤 compumike Accepted Answer ✓
Ruby on Rails https://rubyonrails.org/ seems to meet all of these requirements:

- ActiveRecord is wonderful for data schemas: https://guides.rubyonrails.org/active_record_migrations.html

- ActiveRecord form validations is excellent and defined only on the model

- Scaffolds automatically generate create/read/update/delete endpoints: https://guides.rubyonrails.org/v3.2/getting_started.html#get...

- Websocket-driven updates provided by Hotwire / Turbo Streams: https://turbo.hotwired.dev/handbook/introduction

- Authorization and Authentication by Devise: https://github.com/heartcombo/devise

HAML is wonderful as a templating language as well.


👤 eagsalazar2
Remix, zod, tRPC(if/when API endpoints are needed), Typescript, Prisma. This stack is gorgeous. Same language and type definitions front to back is a game changer.

The realtime aspect of what you are looking for is the hard part. The only options I know of are the remix stack above (you still have to do some extra plumbing), elixir/Phoenix (or other turbo links like options but most aren't fast enough). To do realtime updates natively you need to move to evented data front to back and that is a very big move away from models the way we normally think of them. Check out eventide or resolv.js.


👤 matus_congrady
I recently created ~25 full-stack example projects using the most recent technologies and frameworks. I believe the following stack is the most productive, yet very scalable (doesn't use "leaky" abstractions).

Frontend:

  - Good, old, Single Page App. I believe that all these SSR/isomorphic rendering frameworks are a lot of times just unnecessary complexity.
  - Vite.js + your preferred framework (Vite supports React/Vue/Svelte, etc).
Backend:

  - Node.js + Typescript.
  - Trpc.io - while it's not "automatic generation of REST endpoints", it's very close. It's very easy to write your endpoints, and the added flexiblity/control is definitely worth the time spent writing them.
  - Trpc also has a built-in support for subscriptions: https://trpc.io/docs/subscriptions
  - Prisma + Postgres. Good, old, proven, flexible SQL database is always a safe bet. And Prisma makes interacting with it an order of magnitude easier.
  - The whole "network layer" is completely and very efficiently handled by Trpc. It also uses React-query under the hood: https://github.com/TanStack/query.
Infrastructure + deployments:

  - I would recommend going for AWS.
  - Frontend (statically built) can be hosted in S3 bucket behind a CDN. You should also properly configure caching headers returned by Cloudfront to make it work with SPA.
  - You can run your TRPC API in AWS Fargate container (behind ALB, or behind HTTP API GW). Alternatively, you can also run it in a lambda function.
  - To make the configuration of your Infrastructure/Packaging/Deployments 97% easier, have a look at
https://stacktape.com

(disclaimer: I'm a founder)


👤 aviavi
I think...Rails is what you're looking for.

Reactivity is not an issue anymore with the HOTWIRE stack in rails or there's the even better StimulusReflex gem that you can use for reactivity and realtime features.


👤 quechimba
I'm working on a framework in Ruby that uses Haml for templating. It is inspired by React and has a VDOM, but it's 100% server side and DOM-patches are streamed to the browser as state updates on the server. Callback handlers are just POST-requests and they are set up like this:

   ruby:
     def self.get_initial_state(initial_count: 0, **) = {
       count: initial_count
     }

     def handle_click
       update do |state|
         { count: state[:count] }
       end
     end

   %div
     %p Current count: #{state[:count]}
     %button(onclick=handle_click) Increment
I don't know if anyone would be interested in using anything like this.

👤 peteforde
Honestly, it sounds like you're describing Rails without saying Rails.

Is there a specific reason that you need to have an SPA framework?


👤 josefrichter
Phoenix LiveView. Some learning curve, but once it clicks, you’ll understand there’s very little reason to use anything else for web apps.

👤 freddref
I would recommend Django, but it's really only the backend half of what you're looking for.

What you're describing sounds very nice though.

I've often wanted a VB6 equivalent for the web, but open source.


👤 jcpst
After looking for enough time, it may be worth it to make some compromises, pick one and try building your application with it.

You may never find “the” framework.

Lately my default has been AspNet Core and C# (or F# if I’m feeling frisky). Not because it’s the ultimate framework for me (although it _is_ very good), but it’s what I learned, thanks to learning on the job.

I remain a microsoft skeptic though. I continue to dabble in other tooling just in case they lock down the framework or tools in the future. I like django, for example.


👤 tln
RedwoodJS seems to tick the boxes although I'm not super clear on the real-time aspect. I don't see it from scanning the docs. I think RedwoodJS has to be tried given your requirements.

Personally, I'd say go with Supabase, and then try SvelteKit or use React/next.js. Supabase handles the data access, mails the real-time, and bakes in auth in the right way. Decoupling the front end lets you choose and adapt the right front-end framework.

This stack does not come with schema migrations, so that is a compromise. Your data access can be typed (generate typescript from Schema). For a side project, you could edit the DB and save the schema. Maybe someone has built a good two-way Supabase <=> typescript bridge. Supabase comes with a one way typescript generator.


👤 reducesuffering
T3 stack: https://create.t3.gg/ https://github.com/t3-oss/create-t3-app

It's Next.js, Typescript, TailwindCSS, Prisma, NextAuth, tRPC.

> I know about Node.JS, Angular, React, Express

You already know just JS. Stick with JS framework, not these Rails suggestions. Next.js is by far the biggest JS framework (ChatGPT page? half the recent YC co's? Next.js), the rest are the niceties around it to get to a full solution.

> A central definition of data schemas. I don't want to define my schema or validation twice, once in the frontend and once in the backend.

T3 stack uses Prisma, a JS/TS "ORM". Your data schema will live in a .prisma file.

> Automatic generation of REST endpoints. I hate boilerplate code and don't want to reimplement Get/GetOne/Add/Update/Delete and Websocket for each data model. Even better would be a GraphQL interface.

Includes tRPC setup. Give the automated tRPC endpoints a whirl. It's not auto-gen get/delete/etc. (like Django/Rails models) on the server, but the endpoint you create on server very quickly will auto-gen the func call available on the frontend.

> Authorization and Authentication

Includes NextAuth.js setup


👤 bitexploder
Check out Elixir/Phoenix LiveView tech. It is the only easy system that will push updates to clients easily I can think of. Their twitter clone demo is cool anyhow.

👤 FBISurveillance
Look into T3 stack [0] and maybe Remix - if you know Node.js it will make things easier for you IMO.

[0] https://github.com/t3-oss/create-t3-app


👤 simonbarker87
Would RedwoodJS cover what you need?

You put Firebase in with open source only - would you consider an open source Firebase like Supabase? You can host it yourself and it’s open source.


👤 OJFord
Consider OpenAPI for the first two points - you can define a schema (YAML or JSON) and use it to generate both server & client stubs.

Depending on the language/framework used it'll validate too - e.g. the python backend framework connexion (a thin wrapper around flask) will 500 if you return a non-conforming response, and 400/405/etc. if the request doesn't fit the declared schema, automatically.


👤 cjblomqvist
I'm not fully sure but maybe Blazor (.NET) could suit your needs?

I have no idea what the status of MeteorJS is, but looks like it could fit your requirements.


👤 alex-olivier
When it comes to Authentication and Authorization, these are both core components of a system but undifferentiated building blocks so wouldn’t recommend building them yourself.

Typically using something like Auth0, Cognito, Firebase Auth, FusionAuth, Clerk or many of the other authentication services will get you a full feature set for user management with little to no work.

On the authorization front consider a similar approach of decoupling the the component out of your codebase where the permissions logic is defined as policy rather than code. I work on Cerbos[1] which is an open-source, decoupled authorization layer for your software which does exactly this.

[1] https://cerbos.dev


👤 necatiozmen
I recommend looking at open source react framework for building CRUD apps.

GitHub repo: https://github.com/refinedev/refine

It is headless by default and supports Material UI, AntDesign, Chakra UI, and Mantine.

It has connectors for 15+ backend services including REST API, GraphQL, NestJs CRUD, Airtable, Strapi, Strapi v4, Strapi GraphQL, Supabase, Hasura, Nhost, Appwrite, Firebase..


👤 shivekkhurana
Not a framework but I'm tinkering with the following stack:

1. Hasura - DB + Basic APIS

2. Ory.sh for Auth/Authz

3. React on the frontend

4. Windmill.dev for Scheduling/Batch processing/ Background tasks

5. Docker for deployment

6. Fastify + Node JS for glue code (can use Windmill for Glue code too)

I have used Hasura extensively at 2 companies. It's well done and saves a ton of time.

You might also want to look at Retool (and its open-source alternatives). Web dev has become simpler now.

----

If you like code-focused solution: Rails, Laravel and Django are good options.


👤 yonixw
Apollo server on Express + Mongo can give you all of the above except "No manual HTTP calls for standard cases.", But I suggest watching a simple guide about those as it need some adjustment (like running yarn task of a watcher to fetch types from server to the client ect.)

👤 sgammon
https://github.com/elide-dev/v3

it's very early but we have the same goals. especially your point about central schema.


👤 Alifatisk
Rails?

👤 Chris_Newton
As wonderful as a fully automated full stack framework would be, you might be hoping for too much magic here. Building distributed systems is fundamentally different to working locally and you can’t escape some of the extra complexity that comes with it.

For example, if you don’t want to make any manual HTTP requests to fetch data then the logical alternative is to fetch it automatically. What should be the trigger for your ideal framework to do that? Without any extra information, the framework can only know you need the data when your other code asks for it. It will have to fetch everything on demand, in real time, and that could be extremely inefficient both in terms of the number of requests you’re making over your HTTP channel and the database queries that will ultimately run on your servers. Even if the framework somehow has perfect caching on the client side and it pushes notifications when cached data needs to be refreshed, there will still be questions around which notifications to push to which clients, because in general the server will have no way to know which data that was requested earlier is still relevant to each client at some later time.

You’d also like updates sent to the back end automatically when you change your front end data structures, and not only that, you’d like them propagated out to other clients automatically as well. How would your ideal framework manage what is now shared mutable state? For example, maybe there are constraints in your data model and you need transactional behaviour that updates multiple data points at once to avoid violating those constraints. In general, the framework can’t know when you’ve finished making a set of related changes that should be batched up and sent back to the server, unless you tell it explicitly. And when you do, how would your ideal framework resolve conflicting updates if multiple clients are sending incompatible changes around the same time? What happens if communication links break down and you have to deal with the CAP Theorem? There are no universal “right answers” to any of these questions, and the behaviour you want will often be highly specific to an individual application and its particular data model.

I fear the reason you haven’t found what you’re hoping for is that no framework exists that can magic away all these practical questions about building a distributed system. Even specifying the required behaviour in a realistic application is a non-trivial problem, never mind implementing that specification once you’ve decided what it should be.

So for whatever it’s worth, my advice would be to lower your expectations a little. It’s very reasonable to want a single source of truth for your data models and to generate the types and the simple cases for REST/GraphQL endpoints, DB queries, HTTP request wrappers on the client, API documentation, etc. It’s also very reasonable to want some standard mechanism for authentication and authorisation checks, possibly using middleware in your own code or other facilities provided by any cloud hosting service you’re using, that can be applied on top of the above. But maybe look for a starting point that can handle a lot of the boilerplate for you and leave you free to concentrate on the more difficult questions, rather than hoping to achieve everything you described out of the box.


👤 lewisinc
Check out the Ash framework that's built on top of Phoenix+Elixir.

👤 ushakov
I'm currently involved in something similar, shoot me an e-mail if you want to learn more

meanwhile, try: Hasura, postgraphile or RedwoodJS

if you want a lower-level framework: tRPC, GraphQL Yoga

recently, there's also grafbase.com


👤 _448
Vapor[0] based on Swift. Advantage of this is that you don't have to evaluate multiple frameworks for Swift and suffer paralysis by analysis. All the Swift community is behind one framework.

The next is Actix[1] based on Rust. There are many frameworks in Rust and most of them have not reached 1.0 And which framework will survive becomes a question.

Other not so well-known is Wt[2] based on C++. This actually is created for programmers who are not web developers. The development experience is similar to desktop app development like Qt.

If that is not acceptable then Django[3], based on Python, is the one that will be good for you.

For the front-end I would recommend Flutter[4]. As much as I dislike getting tied to a single company for whom the framework is not their bread-and-butter, I don't see any other viable options to Flutter that will cover all web, mobile and desktop out of the box.

For databases, I would recommend BedrockDB[5], if you are not averse to SQLite. Or FoundationDB[6], if you want NoSQL. But if you are not concerned about horizontal scalability or okay with self-managing database availability, then PostgreSQL[7] is a very good option.

For push notifications, PushPin[8] is a good option.

[0] https://vapor.codes

[1] https://actix.rs

[2] https://webtoolkit.eu

[3] https://www.djangoproject.com

[4] https://flutter.dev

[5] https://bedrockdb.com

[6] https://www.foundationdb.org

[7] https://postgresql.org

[8] https://pushpin.org


👤 EdwardMSmith
Feathers (https://feathersjs.com/) ticks a lot of your boxes.

👤 akmittal
Sadly there is no single good framework for this.

You can better fo with Remix+prisma. You probably don't need REST endpoints just fetch, post using remix.


👤 tomcam

👤 conradfr
You could consider LiveView but you would need to learn Elixir and the Beam.

👤 dlojudice
Hi, you should check Herbs JS [1]. No frontend, but all the backend requirements (and more) checked.

[1] https://herbsjs.org/

Disclaimer: Herbs JS author here


👤 yhoiseth
Supabase may be what you’re looking for

👤 lakomen
I love reading the comments. There are no simple answers.

I was and still am in a similar situation. Since performance, ease of use and resource consumption are important my backend language of choice is Go.

So I wrote a simple backend generator with RESTful CRUD endpoints. The workflow is, you define the data models in your models package. The generator then analyzes those models, creates all the routes and repositories and handlers, then creates Angular model definitions (interfaces) and finally vuex-orm model definitions.

It's very simple and primitive. If you want to change anything you have to regenerate. So this gives you a skeleton backend app. No auth. But that's the general idea. It uses mongodb as a database target. And most importantly it supports data updates via websocket. I initially worked with Angular on the frontend but have been using Vue for the last 2 years. Angular sadly only has ngrx-data which is incomplete. Relationships are not supported and have to be done manually. So I found vuex-orm, which is far from perfect, but works well and is productive, supports relationships. However vuex has been deprecated in favor of Pinia. Someone did a Pinia version of vuex-orm-next, but I haven't tried it yet.

So that's all I have.

I've been thinking to rewrite it. I wanted a simple tool, that doesn't get in my way. I've been thinking to have a clumsy model definition way like entgo.io . And the more I worked with it, the more I see that their way is a better way. Have elaborate model definitions and relationship definitions. I was thinking about that for a while and ent made it. But ent is far from perfect too. It doesn't generate client models, it's complicated, the documentation is lacking. The developers assume you're smart. I'm not smart when I have to crawl through someone else's code. They're going a certain route, and both their graphql and grpc implementations are lacking. I tried to write an extension but the learning curve was too steep. And now they have migrations with some external library, am I'm just sitting there thinking, why do you assume your libraries are a part of my world. The whole thing is a mix of marketing and hype development. They have their own company now and of course they want to make money. I prefer something less hype driven. Something where when you criticize you don't self censor in order to not hurt their reputation. And I hate that.

So I'm thinking make such library myself but how can I monetize? Who would pay me to create a useful tool to solve this 20+ year old problem? This a serious question.

I could open source my tool so far. But I didn't because it could be used by competitors to provide what I provide. Currently my income is so low that I'm actually seeking either employment or freelance work, which I haven't done in at least 8 years.

An alternative would be Spring Boot 3. Learn Java. But could I handle the Java bs on a regular basis? Sometimes when I hate Go, I experiment doing that same backend with Spring Boot. I do the JPA definitions, do the security setup and then I just say fuck it because deep diving requires more Java knowledge and the community is very unfriendly and walled-off.

I'll continue reading the other comments now.


👤 solardev
This is what ChatGPT says about your question:

> There are a few full-stack JavaScript frameworks that you may want to consider, such as Meteor and Sails.js. These frameworks can help you to avoid writing boilerplate code and automatically generate REST endpoints for your data models.

> Meteor is an open-source framework that includes a number of features to help you build full-stack web applications quickly and easily. It has a central database that allows you to define your data schemas, and it can automatically generate REST endpoints for your data models. Meteor also includes built-in support for real-time data synchronization and automatically updates the client whenever the server data changes.

> Sails.js is another popular full-stack framework for JavaScript. It is built on top of the popular Express web framework and uses a Model-View-Controller (MVC) architecture. Sails.js can automatically generate REST endpoints for your data models and also includes support for real-time data synchronization using WebSockets. It also has built-in support for authentication and authorization, so you can easily add user login and security to your application.

> Both Meteor and Sails.js are open-source and can be easily extended to add additional features or support for custom data schemas. They can help you to avoid writing boilerplate code and focus on building the business logic of your application. I hope this helps! Let me know if you have any other questions.

---- Human again: At a glance, both of these seem worth investigating! Combine them with Next and you can stay within the JS ecosystem.