Next.js Discord

Discord Forum

Missing .env.example file in project

Answered
Basense posted this in #help-forum
Open in Discord
Avatar
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

Avatar
did you clone the right repo? .env.example exists in the template repo
Image
or perhaps you need to turn on "show hidden files", since files starting with a . is hidden by default in unix/-like systems
Avatar
I made my own repo using npx create-next-app@latest
Avatar
oh well then you wouldn't have that file
Avatar
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)
Avatar
well the .env.example file only serves as an example to how an .env would look like
Avatar
oooh
Avatar
you could just create an empty .env file and work from there
Answer
Avatar
where in the folder structure would it go though? in the src folder or in the project folder itself?
Avatar
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
in the root folder
good luck!
Avatar
thank you
I'll just try to gitignore it
have a great day