Live data from Hacker News

Ask HN: Hunting for a Framework

news.ycombinator.com

21–30 of 70 posts

Re: Ask HN: Hunting for a Framework

#21
post #6

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 R…

> 1. Hasura - DB + Basic APIS, 2. Ory.sh for Auth/Authz Great choices! 3. React on the frontend Here I'd go with Elm, and a generated GraphL API client. Here an example to play with (which btw also includes ZomboDB for ElasticSearch integration into Postgres) https://github.com/cies/low-code-backend-dockered > 4. Windmill.dev Look awesome, never heard of it. Tnx > If you like code-focused solution: Rails, Laravel and…

Wohah, did not know about elm-graphql! I'm a big fan of functional programming and have written minor projects in elm, but the "slowness" of development has always discouraged me from actually doing something big with it. This stack might make this a whole lot better. Will look into it. Thanks

Re: Ask HN: Hunting for a Framework

#22

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 simi…

I could not disagree more — allowing a third party to own the most crucial data in your app (the users) is a big mistake. I’ll admit to only having experience with Firebase for third-party auth, but in my experience the drawbacks of splitting auth and user related code between two systems soon outweighs the benefits of getting up and running quickly.

Auth code is undifferentiated, but if you have experience building apps it’s also not particularly difficult. I’d recommend either picking an open source solution that you host yourself or just taking a few days to grind it out.

Re: Ask HN: Hunting for a Framework

#23
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.)

Re: Ask HN: Hunting for a Framework

#25

Honestly, it sounds like you're describing Rails without saying Rails. Is there a specific reason that you need to have an SPA framework?

^ This. Rails or even some mixup of Laravel with liveview. If OP is needing it for a personal project, just buy a starter template kit in one of these languages.

Do NOT make your own framework, that is a doom loop of death. Lots of smart (and not smart) people have created frameworks for you..... focus on productivity only.

Re: Ask HN: Hunting for a Framework

#26

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 realtim…

> elixir/Phoenix (or other turbo links like options but most aren't fast enough

Phoenix specifically doesn't work like turbolinks. LiveVIew in Phoenix uses a websocket to transport data, morphdom to patch the dom, and a light process on the server to manage state. It's as fast as the internet connection for insertions into a list. In fact it is quite capable of parallel data loading just like remix, and the server can work share in parallel across as many cores as you have available on the server.

Re: Ask HN: Hunting for a Framework

#27
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.

Re: Ask HN: Hunting for a Framework

#29
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.
Post reply on HN