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

* fix(dev): make dotenvx available through pnpm

* fix(dev): load local env from root scripts

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Amruth Pillai <im.amruth@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Lihan YANG
2026-09-28 08:57:14 +02:00
committed by GitHub
co-authored by Amruth Pillai autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
parent 685fcab605
commit 73e7a3cb6d
4 changed files with 26 additions and 22 deletions
+5 -5
View File
@@ -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
```
+12 -12
View File
@@ -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
+6 -5
View File
@@ -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",
+3
View File
@@ -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