Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

fix(dev): make dotenvx available through pnpm (#3537)

Lihan YANG73e7a3cb6d12
diff --git a/AGENTS.md b/AGENTS.md
index 9b2cc51a1..d13b5a8bd 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -87,7 +87,7 @@ Multi-place changes:
- **Resume data shape**: `packages/schema/src/resume/*` first, then API DTOs, importers, PDF rendering, and web forms consuming it.
- **New template**: `packages/schema/src/templates.ts`, `packages/pdf/src/templates/index.ts`, source under `packages/pdf/src/templates/<name>/`, and previews under `apps/web/public/templates/{jpg,pdf}`.
-- **New DB column/table**: `packages/db/src/schema/*`, then `dotenvx run -f .env.local -- pnpm db:generate`.
+- **New DB column/table**: `packages/db/src/schema/*`, then `pnpm db:generate`.
- **New env var**: `packages/env/src/server.ts` **and** the `globalEnv` array in `turbo.json`. Turborepo 2.x strict env mode filters out unlisted vars, so the variable will be `undefined` in child processes at runtime even when correctly set in the OS/container environment.
## Environment and database
@@ -96,18 +96,18 @@ Copy `.env.example` to `.env.local`. Three required vars: `APP_URL` (default `ht
- **S3/SeaweedFS optional.** If `S3_ACCESS_KEY_ID`, `S3_SECRET_ACCESS_KEY`, and `S3_BUCKET` are all set, the app uses S3-compatible storage. `.env.example` ships SeaweedFS defaults, so either start the `seaweedfs` compose service or comment those vars out to use local filesystem storage under `<workspace>/data`. `LOCAL_STORAGE_PATH` must be absolute when set.
- **`REDIS_URL` and `ENCRYPTION_SECRET`** are optional for core resume flows but both required for saved AI providers and the authenticated `/agent` workspace. Host-run dev uses `REDIS_URL=redis://localhost:6379`; the container-run app uses `redis://redis:6379`.
-- **`drizzle-kit` (used by `pnpm db:migrate`) reads `DATABASE_URL` from `process.env` directly** — it does not auto-load `.env`. Run migration commands through `dotenvx`.
+- **`drizzle-kit` (used by `pnpm db:migrate`) reads `DATABASE_URL` from `process.env` directly** — it does not auto-load `.env`. The root migration scripts load `.env.local` through `dotenvx` before invoking Drizzle Kit.
- The production server auto-runs migrations at startup before serving traffic, so manual `pnpm db:migrate` is mainly for first setup, migration debugging, or applying migrations without starting the app.
## Commands
-Prefix dev servers and migration commands with `dotenvx run -f .env.local --`. Tests, typechecks, linters, boundary checks, and `pnpm build` do not need it; if one fails on a missing env var, rerun it with the prefix.
+Dev server and migration scripts load `.env.local` through the project-local `dotenvx`. Tests, typechecks, linters, boundary checks, and `pnpm build` do not load it automatically.
```
sudo docker compose -f compose.dev.yml up -d postgres # DB only
sudo docker compose -f compose.dev.yml up -d postgres redis seaweedfs seaweedfs_create_bucket # full infra
-dotenvx run -f .env.local -- pnpm dev # port 3000 (dev:web for web only)
-dotenvx run -f .env.local -- pnpm db:generate # db:migrate to apply
+pnpm dev # port 3000 (dev:web for web only)
+pnpm db:generate # db:migrate to apply
pnpm check # Biome — WRITE-CAPABLE (--write --unsafe)
pnpm test | pnpm typecheck | pnpm build | pnpm exec turbo boundaries
```
diff --git a/docs/contributing/development.mdx b/docs/contributing/development.mdx
index 1eaf04d96..49f4e7108 100644
--- a/docs/contributing/development.mdx
+++ b/docs/contributing/development.mdx
@@ -102,16 +102,16 @@ These steps set up Reactive Resume for local development, whether you're contrib
<Step title="Run Database Migrations If Needed">
The server startup path runs migrations before serving traffic. To apply migrations manually without starting the app,
- load `.env.local` with `dotenvx` because Drizzle Kit reads directly from `process.env`:
+ run the root migration script, which loads `.env.local` before invoking Drizzle Kit:
```bash
- dotenvx run -f .env.local -- pnpm run db:migrate
+ pnpm run db:migrate
```
</Step>
<Step title="Start the Development Server">
```bash
- dotenvx run -f .env.local -- pnpm run dev
+ pnpm run dev
```
Your local Reactive Resume instance will be available at [http://localhost:3000](http://localhost:3000).
@@ -128,7 +128,7 @@ The scripts you will use most during development:
| Command | Description |
| ------------------------------ | ----------------------------------------------------------- |
-| `dotenvx run -f .env.local -- pnpm dev` | Start the web and server development processes |
+| `pnpm dev` | Start the web and server development processes |
| `pnpm build` | Build the production web bundle and server bundle |
| `pnpm start` | Start the built production server |
| `pnpm typecheck` | Run TypeScript type checking |
@@ -141,9 +141,9 @@ The scripts you will use most during development:
| Command | Description |
| ---------------------- | -------------------------------------------- |
-| `dotenvx run -f .env.local -- pnpm run db:generate` | Generate migration files from schema changes |
-| `dotenvx run -f .env.local -- pnpm run db:migrate` | Apply pending migrations |
-| `dotenvx run -f .env.local -- pnpm run db:studio` | Open Drizzle Studio (database GUI) |
+| `pnpm db:generate` | Generate migration files from schema changes |
+| `pnpm db:migrate` | Apply pending migrations |
+| `pnpm db:studio` | Open Drizzle Studio (database GUI) |
### Internationalization
@@ -184,7 +184,7 @@ reactive-resume/
Use Drizzle Studio to explore and manage your database:
```bash
-dotenvx run -f .env.local -- pnpm run db:studio
+pnpm run db:studio
```
This opens a web-based GUI at [https://local.drizzle.studio](https://local.drizzle.studio).
@@ -194,11 +194,11 @@ This opens a web-based GUI at [https://local.drizzle.studio](https://local.drizz
1. Edit the schema in `packages/db/src/schema/*`
2. Generate a migration:
```bash
- dotenvx run -f .env.local -- pnpm run db:generate
+ pnpm run db:generate
```
3. Apply the migration:
```bash
- dotenvx run -f .env.local -- pnpm run db:migrate
+ pnpm run db:migrate
```
<Warning>Always review generated migrations before applying them, especially when working with existing data.</Warning>
@@ -272,7 +272,7 @@ pnpm run typecheck
The Vite web server uses `PORT` (default `3000`), and the Hono server uses `SERVER_PORT` (default `3001`).
Either stop the conflicting process or choose alternate ports:
```bash
- PORT=3002 SERVER_PORT=3003 dotenvx run -f .env.local -- pnpm dev
+ PORT=3002 SERVER_PORT=3003 pnpm dev
```
</Accordion>
@@ -300,7 +300,7 @@ pnpm run typecheck
<Accordion title="Type errors after pulling changes">
The route tree may need regeneration. Run the dev server which auto-generates routes:
```bash
- dotenvx run -f .env.local -- pnpm run dev
+ pnpm run dev
```
Or run type checking to see specific errors:
```bash
diff --git a/package.json b/package.json
index 819735f3a..0f807132b 100644
--- a/package.json
+++ b/package.json
@@ -26,12 +26,12 @@
"build": "pnpm pdf:translations && turbo run build",
"check": "pnpm pdf:translations && biome check --write --unsafe . && markdownlint-cli2 --fix && github-actionlint -shellcheck= -pyflakes=",
"docs:gen": "pnpm --filter server docs:gen && pnpm --filter @reactive-resume/tooling docs:gen",
- "db:generate": "turbo run db:generate --filter=@reactive-resume/db",
- "db:migrate": "turbo run db:migrate --filter=@reactive-resume/db",
- "db:studio": "turbo run db:studio --filter=@reactive-resume/db",
+ "db:generate": "dotenvx run --ignore=MISSING_ENV_FILE -f .env.local -- turbo run db:generate --filter=@reactive-resume/db",
+ "db:migrate": "dotenvx run --ignore=MISSING_ENV_FILE -f .env.local -- turbo run db:migrate --filter=@reactive-resume/db",
+ "db:studio": "dotenvx run --ignore=MISSING_ENV_FILE -f .env.local -- turbo run db:studio --filter=@reactive-resume/db",
"lingui:extract": "turbo run lingui:extract --filter=web && pnpm pdf:translations",
- "dev": "turbo run dev",
- "dev:web": "turbo run dev --filter=web",
+ "dev": "dotenvx run --ignore=MISSING_ENV_FILE -f .env.local -- turbo run dev",
+ "dev:web": "dotenvx run --ignore=MISSING_ENV_FILE -f .env.local -- turbo run dev --filter=web",
"knip": "knip",
"start": "node apps/server/dist/index.mjs",
"typecheck": "turbo run typecheck",
@@ -47,6 +47,7 @@
"@biomejs/biome": "^2.5.14",
"@commitlint/cli": "^21.2.3",
"@commitlint/config-conventional": "^21.2.3",
+ "@dotenvx/dotenvx": "^1.75.1",
"@playwright/test": "^1.63.0",
"@reactive-resume/config": "workspace:*",
"@testing-library/jest-dom": "^7.0.1",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 3f5c80df7..c40eedc1a 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -188,6 +188,9 @@ importers:
'@commitlint/config-conventional':
specifier: ^21.2.3
version: 21.2.3
+ '@dotenvx/dotenvx':
+ specifier: ^1.75.1
+ version: 1.75.1
'@playwright/test':
specifier: ^1.63.0
version: 1.63.0