3 ms·
Rails also has a whole model/database thing going on. Next.js is just front end focused and has always left it up to the user to decide about data persistence.
by cal85 4y ago
Rails also has a whole model/database thing going on.
Next.js is just front end focused and has always left it up to the user to decide about data persistence.
So to answer the original question, an equivalent would be Next+Database, and there is obvious stand-out answer for what Database should be. I often get stuck deciding what that Something should be when trying to go from 0 to 1.
- deleted 4y ago[deleted]
- Vinnl 4y agoOh sorry yes, must have skipped over Rails in the long list of tools. Yeah, you'd commonly pair Next.js with a more "traditional" back-end I think, with the frontend calling out to the Next.js back-end, the Next.js back-end calling out to your regular back-end, and your regular back-end calling out to your database.
- avarun 4y agoSupabase
- renewiltord 4y agoOkay, great, I'll just use Next.js with PostgreSQL.
- reducesuffering 4y agoGetting Next.js up to Rails feature-wise is using something that already wires up the niceties like Auth, ORM, Tailwind styles, and Typescript. Create-t3-app is a huge contender here: https://init.tips/ https://init.tips/ and https://github.com/t3-oss/create-t3-app https://github.com/t3-oss/create-t3-app A DB is as simple as pressing a button on Planetscale or Railway, copying the secret strings to your .env file, and 'npx prisma db push'.
- renewiltord 4y agoAppreciate the advice. Going to try that later this week.
- cal85 4y agoIf you know and like Rails and ActiveRecord especially, then one possibility, which I intend to try on my next thing, is to build an API-only Rails app (JSON only; no HTML views) and a separate Next.js app that uses the Rails app as its backend. Although it’s two apps, it seems like it would be a really nice, clean setup to work with. You can easily deploy the Next app on something cheap and serverless like Vercel, and deploy the Rails app separately on something like EC2 or Fly.io. I have written Next apps that just connect directly to PostgreSQL, but I always end up adding other tools in an attempt to recreate something like ActiveModel and other aspects of Rails in Next.js, and it ends up turning into a mess. I think Rails+Next would avoid this problem. It would be two apps, but each would very clearly focused and would be built following the golden path of their respective frameworks. (One thing I’m not sure about yet is how I would DRYly share endpoint schemas from Rails in order to have strong typings in the Next app based on the API endpoints. But I don’t think it should be too hard to find a nice way to do this.)
- renewiltord 4y agoI see. That's the structure I use but Rails and React. Okay so I'll just replace the React with Next.