Last updated: March 1, 2026
Version: 1.06.0-alpha
This guide walks you through first-run setup and configuration for ED Rare Router.
On first run, the app requires a config file (.config.json) in the project root. Until it exists, visiting any page (except /setup and /api/*) redirects you to the Setup page. You can complete setup either in the browser or via the command line.
- Node.js 18+ — Download
- npm — Included with Node.js
Optional (for EDDN real-time market data):
- ZeroMQ — See EDDN Worker Setup
From the project root:
npm installnpm run devOpen http://localhost:4321 in your browser. You will be redirected to /setup because .config.json does not exist yet.
| Field | Required | What to enter |
|---|---|---|
| EDSM User-Agent | Yes | A string that identifies your app and contact. Example: ED-Rare-Router/1.0 (contact: your@email.com) or ED-Rare-Router/1.0 (contact: https://github.com/yourusername). EDSM uses this for API requests; no account needed. |
| Data directory | No | Leave blank to use the default data/ folder in the project root. Or enter an absolute path (e.g. C:\Users\You\data\ed-rare-router or /home/you/data/ed-rare-router) to store caches and generated files elsewhere. |
| EDSM API key | No | Optional. Get from EDSM (account → API). Improves rate limits; app works without it. |
| EDDN API key | No | Optional. Get from EDDN (developers/API). Used for live market data; app works without it. |
| Replace existing config | — | Leave unchecked for first run. Check only when you already have .config.json and want to overwrite it. |
Click Save config. On success you are redirected to the home page. The file .config.json is created in the project root (gitignored).
After config is saved:
# Export rare goods to JSON (used by EDDN worker)
npm run export:rares
# Optional: fetch initial EDSM market data
npm run fetch:marketIf you prefer the terminal:
npm installnpm run setupAnswer the prompts. The script creates .config.json in the project root.
npm run devOpen http://localhost:4321. You should see the main app (no redirect to setup).
Same as Method 1, Step 4:
npm run export:rares
npm run fetch:market # optional-
Copy the sample config:
cp config.sample.json .config.json
-
Edit
.config.jsonin a text editor:- edsmUserAgent — Set to your contact string (required for EDSM).
- dataDir — Set to
nullor omit for defaultdata/; or set to an absolute path string. - apiKeys — Optional. e.g.
"edsm": "your-key", "eddn": "your-key".
-
Save the file and run
npm run dev.
| Key | Type | Description |
|---|---|---|
edsmUserAgent |
string | Sent as User-Agent to EDSM API. Include a contact (email or URL). |
dataDir |
string | null | Absolute path to data directory. null or omit = ./data. |
apiKeys |
object | Optional. Keys: edsm, eddn, etc. (lowercase). Values: API key strings. |
Environment overrides: You can override without editing .config.json:
EDSM_USER_AGENT— OverridesedsmUserAgent.EDSM_API_KEY,EDDN_API_KEY— OverrideapiKeys.edsmandapiKeys.eddn.
- Data directory — Cache files (system cache, rare systems cache, EDDN market cache, etc.) are stored under the configured data directory (default:
data/in project root). The app creates the directory if it does not exist. - Changing config — Edit
.config.jsonby hand, or run the web setup again and check Replace existing config before saving. - First-run redirect — Middleware in
src/middleware.tschecks for.config.json. Once it exists, the redirect to/setupno longer occurs.
- "Config already exists" — You already have
.config.json. To replace it, use the web form and check Replace existing config, or edit/delete.config.jsonmanually. - Redirect loop — Ensure
.config.jsonis in the project root (same folder aspackage.json) and is valid JSON. - Save fails — Check that the process has write permission to the project root. On Windows, avoid paths that require admin rights.
For more help, see Troubleshooting Notes and Local Deployment Guide.