Next.js Discord

Discord Forum

Missing .env.example file in project

Answered
Basense posted this in #help-forum
Open in Discord
I'm trying to integrate an sql database using the following tutorial:
https://nextjs.org/learn/dashboard-app/setting-up-your-database
about half way scrolled down on the page it says I should rename my .env.example file to .env, but I can't find any file remotely related to that.

I set up the project recently and I can't figure out how to solve this :meow_stare:
Answered by iyxan23
you could just create an empty .env file and work from there
View full answer

15 Replies

did you clone the right repo? .env.example exists in the template repo
or perhaps you need to turn on "show hidden files", since files starting with a . is hidden by default in unix/-like systems
I made my own repo using npx create-next-app@latest
oh well then you wouldn't have that file
how do I add my db to the project then? (I initially made a mariadb which works and would love to integrate that instead of postgre if that is possible)
well the .env.example file only serves as an example to how an .env would look like
oooh
you could just create an empty .env file and work from there
Answer
where in the folder structure would it go though? in the src folder or in the project folder itself?
since .env could contain sensitive info like tokens or secrets, oss projects can only provide an example on how it would look like through the .env.example
thank you
I'll just try to gitignore it
have a great day