# Commit .env.example, not .env

> .env.example lists the keys with empty secrets. .env stays off the git remote. Vite only sees VITE_ keys.

- URL: https://laravel-vuejs.space/laravel-env-example-vue
- Author: Anass Ez-zouaine (https://laravel-vuejs.space/author/anass-ez-zouaine)
- Published: 2026-10-11
- Topics: Laravel, VueJs, Setup

People searching “Laravel .env.example Vue” commit `.env` so the next laptop works. That file has the app key and the database password. Commit the example. The [Vite guide](https://laravel-vuejs.space/laravel-vite-vue) is which of those values the browser is allowed to see.

> **TL;DR**
>
> -   .env.example lists the keys with empty secrets.
> -   .env stays off the git remote.
> -   Vite only sees VITE\_ keys.
> -   Do not prefix a secret with `VITE_` so the example “also works in Vue”.
>
> **Who it's for:** Laravel + Vue developers
>
> **Applies to:** Laravel 13 · Vue 3

## The fix

`.env.example` looks like this:

```ini
APP_NAME=Laravel
APP_KEY=
APP_URL=http://localhost

VITE_APP_NAME="${APP_NAME}"
```

Empty secret, real key name. A teammate copies it to `.env` and fills it in. `APP_KEY` is generated with `php artisan key:generate`. You do not invent one and you do not reuse production’s.

## What to avoid

> **Gotcha**
>
> Do not prefix a secret with `VITE_` so the example “also works in Vue”. That ships the secret. Do not add `.env` to the repo and gitignore it later. It is already in history. Rotate the key that leaked.

## FAQ

**Q: Should I commit .env or .env.example?**

.env.example lists the keys with empty secrets. .env stays off the git remote. Vite only sees VITE\_ keys.

**Q: What goes wrong with Laravel .env.example Vue?**

Many developers commit `. Do not prefix a secret with` VITE\_\` so the example "also works in Vue".
