What Is a .env File?
Every guide on this site will tell you to "add this to your .env file." If you don't know what that means, start here. This is a 2-minute explainer, not a full tutorial.
This guide was written as of April 2026. If anything looks different, let us know.
What you'll have at the end
Understanding of where your app's secret settings live
What are environment variables?
Environment variables are your app's secret settings. Think of them as passwords for the services your app connects to — your database, your email provider, your Google API, your payment processor.
Your app needs these to work, but you never want them visible to anyone else. That's why they live in a separate file, not in your actual code.
What is a .env file?
A .env file is a simple text file that holds all your environment variables. It lives in the root folder of your project — right next to your other project files.
It looks like this:
TURSO_DATABASE_URL=libsql://my-db-yourname.turso.io
Your database connection
TURSO_AUTH_TOKEN=eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9...
Your database password
RESEND_API_KEY=re_abc123...
Your email service key
YEPAPI_KEY=yep_live_...
Your YepAPI key
How to create one
Open your project folder in your code editor. Create a new file in the root of the project. Name it exactly .env — no file extension, just .env.
That's it. Now you can paste credentials into this file as you set up each service.
The golden rule
Never share your .env file. Never upload it to GitHub. Never paste it in a chat.
Your .env file contains real passwords and API keys. If someone gets them, they can use your accounts and run up charges.
Most AI coding tools automatically add .env to your .gitignore file (which tells GitHub to ignore it). If yours didn't, add a line that says .env to your .gitignore file.
How .env connects to Vercel
When you deploy your app to Vercel, it can't read your local .env file — that file only exists on your computer. You'll need to copy each value into Vercel's dashboard.
We cover this step-by-step in the Vercel deployment guide. For now, just know: every value in your .env file will need to be added to Vercel too.
Tell Your AI Tool
Copy this prompt and paste it into your AI coding tool. It tells your AI exactly what credentials you just set up.
I have a .env file in my project root with my credentials. The variables are: - [list your variable names] Make sure the app reads from environment variables, not hardcoded values.
Paste the prompt into the chat panel (Cmd+L or Ctrl+L). Cursor can also read your .env file directly — if your credentials are there, it already knows.
Was this guide helpful?
What Is a .env File? — FAQ
A .env file is a simple text file that stores your app's secret settings — API keys, database passwords, and service credentials. It lives in the root of your project folder and keeps sensitive information separate from your code.
Environment variables are settings that your app needs to connect to external services like databases, email providers, and APIs. They're called "environment" variables because they can change depending on where your app runs (your computer vs. the internet).
Yes, as long as you never upload it to GitHub or share it publicly. Your .env file should be listed in your .gitignore file so it's automatically excluded from version control. Most AI coding tools handle this for you.
Vercel can't read your local .env file. When you deploy, you'll copy each value from your .env into Vercel's Environment Variables dashboard. The variable names stay the same — only the location changes.
Start vibe coding with one API key.
One API key. 100+ endpoints. Yep, that's it.