All Questions

Coding

Is it scalable to use Next.js with JSON files as Database?

I’m working on small project and I don’t really need real database like PostgreSQL or some kind of backend. I would like to just statically generate pages during build time with data from JSON files

author Dobroslav Radosavljevič

Reply
5 Answers

I don’t know if Vercel or Netlify are expected to keep their files between builds. If you save your JSONs there, and trigger a build without cache (example: after a NextJS update), you might lose your JSONs.

You can always save your JSON files to S3, DynamoDB or Firebase Firestore. The only issue is that you won’t have transactions at least for S3.

writen by Bartolomeu Rodrigues

You can definitely do that (if you’re sure that data will be saved). This should even be scalable for just building pages from the JSON files.

writen by Benedikt

Yes, files in /public folder are kept after build.

writen by Dobroslav Radosavljevič

Wolfgang Gassler has some interesting opinions about using text as a DB

writen by Tiago Ferreira

yup, you don’t always need a db and this reduces complexity, I like it

writen by Wolfgang Gassler

Do you want to ask a question?


Related Questions