# Local Development — Dev Server and Mock Payloads > Develop locally with REP using default values, mock DOM payloads, or the CLI dev server that wraps the gateway. Works alongside Vite, webpack, and any dev server. Source: https://rep-protocol.dev/guides/development/ During local development you typically don't have the REP gateway running. The SDK handles this gracefully — `rep.get()` returns `undefined` when no payload is present. ## Option A: Build-tool plugin (recommended) The easiest way to get full REP support in development. The plugin injects the same ` ``` This gives you the full SDK experience (including `rep.verify()` and `rep.meta()`) without the gateway. > **Caution** > > Don't forget to remove this tag from your production HTML. In production, the gateway injects it automatically. ## Option D: CLI dev server (full fidelity) The `rep dev` command runs a local gateway that reads your `.env` file and proxies to your dev server: **With Vite** ```bash # Terminal 1: Start Vite dev server npm run dev # → Vite running at http://localhost:5173 # Terminal 2: Start REP gateway proxy rep dev --env .env.local --proxy http://localhost:5173 # → Gateway at http://localhost:8080 → proxies to Vite ``` Open `http://localhost:8080` (the gateway port), not `:5173`. The gateway injects variables into Vite's HTML responses. **With static files** ```bash # Build first npm run build # Serve from dist/ with REP injection rep dev --env .env.local --static ./dist ``` ### `.env.local` example ```bash REP_PUBLIC_API_URL=http://localhost:3000 REP_PUBLIC_FEATURE_FLAGS=dark-mode,debug REP_SENSITIVE_ANALYTICS_KEY=test-key-123 ``` ### CLI dev server options | Flag | Default | Description | |---|---|---| | `-e, --env ` | `.env.local` | Path to .env file | | `-p, --port ` | `8080` | Gateway port | | `--proxy ` | — | Upstream proxy URL | | `--static ` | — | Serve static files (embedded mode) | | `--hot-reload` | `false` | Enable hot reload | | `--gateway-bin ` | auto-detected | Path to gateway binary | > **Note** > > When using proxy mode with Vite, access the site through the gateway port (8080), not Vite's port (5173). Vite's HMR WebSocket continues to work through the proxy for CSS and module updates. ## Using all CLI commands in development The CLI provides a complete development workflow: ```bash # 1. Validate your manifest rep validate --manifest .rep.yaml # ✓ Manifest is valid — 6 variables, 4 settings # 2. Generate TypeScript types rep typegen --manifest .rep.yaml --output src/rep.d.ts # ✓ Generated types for 3 public + 2 sensitive variables # 3. Start the dev server rep dev --env .env.local --proxy http://localhost:5173 # 4. Before deployment: scan bundles for leaked secrets rep lint --dir ./dist # ✓ No secrets detected in 12 files ```