Greenfield base for the 2.0 beast. README frames the shift from atlas downloads to self-serve intelligence; docs/vision.md sets goals, non-goals and phased delivery; INGREDIENTS.md proposes the starter stack and what stays out. Live v1.0 untouched.
3.6 KiB
3.6 KiB
Ingredients — Mercator 2.0 starter stack
The pantry for the first cook. Every ingredient below is either already proven on this VPS or is a deliberate, small upgrade. Nothing here is installed yet; this is the proposal to argue with before we build.
The stack at a glance
| Layer | Choice | Why |
|---|---|---|
| Pages | Hand-written HTML + CSS + vanilla JS, no build step | Proven on v1.0: fast, zero toolchain, easy to review and cache-bust |
| App shell (only if needed) | Vite + TypeScript, static output | Adopt when search state or components outgrow plain pages, not before |
| API | Node.js 22, first pass zero-dependency node:http; graduate to Fastify |
v1.0's order backend is a single zero-dep server.js; keep that until routes and validation justify a framework |
| Data store | SQLite (WAL) for orders and saved slices | One VPS, one file, trivial backup and rollback; Postgres only if concurrency demands it |
| Atlas data | Immutable snapshot files (Parquet/CSV) + manifest with SHA-256 | Every number reproducible; no live mutation of source data |
| Search | SQLite FTS5 over a loaded snapshot, or in-memory index for the first slice | Sub-300 ms queries without a search cluster |
| Email / delivery | Resend, as used by the v1.0 order form | Already proven, one env var, no new vendor |
| Reverse proxy | nginx + Let's Encrypt (certbot) | Existing pattern on this VPS; per-site config in sites-available |
| Runtime | systemd unit per service, dedicated low-privilege user | Matches helm, meridian and mercator-order conventions |
| Deploy | Forgejo repo + deploy key + main auto-deploy timer + health check |
Same shape as Helm, but gated: staging first, prod only on release tag |
| Backups | Nightly SQLite .backup + snapshot archive, verified with quick_check |
A backup that is not verified is a rumour |
| Observability | /health JSON, systemd journal, nightly disk check |
Enough to answer "is it up and is it full" in one command |
| Secrets | root-owned env file (640, group = service user) | Never in git, never in chat |
Reused from v1.0 (same patterns, new paths)
- Static site served straight from a directory, assets fingerprinted or cache-busted by query string.
- Small Node order API behind
location /api/in nginx, bound to127.0.0.1only. - Resend for transactional mail, recipient and sender in env.
- systemd
Restart=on-failure,NoNewPrivileges=true, separate working directory. - Forgejo on this VPS as the source of truth, SSH on port 2222 for deploys.
Deliberately not in the pantry
- No SPA framework, no client-side router, no state library at the start.
- No Kubernetes, no second VPS, no managed database.
- No direct writes to the live v1.0 tree, database, order service, nginx site or DNS.
- No payment provider wired until the Phase 2 gate passes.
- No analytics that ship customer data off-box.
- No secrets in the repo, ever.
First cook — Phase 1 definition of done
- A staging host or path exists that is not
mercator.analystpaneru.site. - Atlas snapshot pinned, hashed and readable by the search service only.
- Search page returns filtered results in under 300 ms for 100 sample queries.
/healthreports service version, snapshot hash and record count.- One-command deploy and one-command rollback, both exercised once.
- v1.0 untouched: same bytes, same order flow, same uptime through the whole phase.
Open choices to settle before Phase 1
- Staging on a subdomain (
v2.analystpaneru.site) vs a path on the existing site. - Search in SQLite FTS5 vs a prebuilt JSON index for the first slice.
- Whether the first slice is public-read with paid export, or auth-only.