Environment variables store configuration and secrets outside your code. Create a .env file: DATABASE_URL=postgres://..., API_KEY=sk_live_... In Next.js, prefix with NEXT_PUBLIC_ for client-side access. Never commit .env to Git — add it to .gitignore. Use .env.example with placeholder values for documentation. In production, set env vars in your hosting platform dashboard (Cloudflare, Vercel, Netlify).
guide2 min read
.env Variables Guide
How to use environment variables for configuration and secrets.
Try these tools
More guide articles
Optimize Images for Web
Complete guide to image optimization: format selection, compression, sizing, lazy loading, and CDN delivery.
Build a CSS Design System
Step-by-step guide to creating a CSS design system with custom properties, typography, colors, and spacing scales.
Regex for Beginners
Learn regular expressions from scratch. Covers basic syntax, common patterns, and practical examples.
Choosing a Tech Stack
A practical guide to choosing frontend, backend, database, and hosting for your project.