Next.js Discord

Discord Forum

Question about build + run start | plus sequelize + sqlite3 with Next.js

Answered
Pacific sandlance posted this in #help-forum
Open in Discord
Pacific sandlanceOP
I'll use sequelize and sqlite3 for the website I'm making. The thing is, if I use ./db/something.sqlite as db route, I'll use the same db for dev and prod or it'll use ./db/something.sqlite for dev and .build/db/something.sqlite fr production? Idk how next.js manages the finished page. Once you build your site it'll create the build directory with all the website compiled but when you use npm run start idk if it'll use the build directory as root or * as root.
Answered by averydelusionalperson
oh yeah, you need to change .env while running a server for prod ig
View full answer

34 Replies

Pacific sandlanceOP
So the main question is if in production it'll use /* as root or /build/* as root
And if someone tried with sqlite2 + sequelize better XD
hmm, if I'm not wrong, you just do npm run build in the code dir, and run npm run start.
it doesn't matter where the db is
it should be same
Pacific sandlanceOP
I was to have a dev and a prod db, different ones
the have two db files
Pacific sandlanceOP
That's why I'm asking, if next will use the same i'll use different router for dev and prod, if next changes to /build/* I don't need to
Ok, another way to do it
I don't really think, next uses /build or something, just have a different sqlite file where you have the dev file. like dev.db, and prod.db
Pacific sandlanceOP
Do we have to manually load .env.production and .env.develepment or next will do it automatocatically depending on the command you run?
I founf that
Pacific sandlanceOP
But idk if it's automatic
It's an option but I'll run the code on the same server as I'll code so... I'll have to change the .env manually all the time XD
you don't develop on a server right?
you develop on local, and deploy to the server.
Pacific sandlanceOP
Not exactly. I've a server on my house, with remote desktop... so I develop there. In this case I'll just change npm run dev for npm run build/start XD
I know it not the best, but is just a test webpage, something for me to learn next.js, sequelize and auth.js
So... yes, technically I develope on a server XD
oh yeah, you need to change .env while running a server for prod ig
Answer
Pacific sandlanceOP
sad
I thought we could change the env used. Well I'll change it then ^^
thx a lot for your help
your welcome, I think you can keep seperate files for prod & dev enviroments.
but IDK, never tried it
^ this should help
Pacific sandlanceOP
hmmmm
I'll try it if I can