← Back to the A-Z glossary
AI glossary · P1

.env file

A .env file keeps a project's sensitive keys and settings out of the visible code.

Tools 4 min read Updated 2026-05-22
— Definition

.env file, in plain words

A .env file keeps a project's sensitive keys and settings out of the visible code.

Tie the topic to AI keys and deployment without turning it into a programming lesson.

A concrete example

Instead of writing your Anthropic key straight into a script, you write ANTHROPIC_API_KEY=... in .env, and the script reads it on startup.

Why it matters

Agents and automations start handling secrets fast. The .env file keeps them out of shared files.

You run into it at the root of a local project, or as environment variables in Vercel, Railway, or Supabase.

Don't mix it up with

API key: An API key is a technical password that lets a tool call an AI service on your behalf.

Vercel environment variables: Vercel environment variables store sensitive keys and settings on the deployment side.

Common mistakes

  • Forgetting to add .env to .gitignore.
  • Sharing a screenshot with the real values.
  • Changing a variable without restarting the tool.

Quick checklist

  • First I check whether the word names a concept, a tool, a risk, or a metric.
  • I tie it to a concrete case: Instead of writing your Anthropic key straight into a script, you write ANTHROPIC_API_KEY=... in .env, and the script reads it on startup.
  • I keep the main trap in mind: Forgetting to add .env to .gitignore.

Quick questions

What is .env file in AI?

A .env file keeps a project's sensitive keys and settings out of the visible code.

Where will I run into .env file?

You run into it at the root of a local project, or as environment variables in Vercel, Railway, or Supabase.

Which word should I read next?

Start with API key, Vercel environment variables, Git.

Want to keep going in order?

Head back to the full glossary, search a word, then open only the pages that deserve more than a short definition.

Open the AI glossary