Version 1.0.0 · engine 1.0.0 · .drnx schema 1.0.0
DRNX is a single-file application. All engineering logic — hydrology, hydraulics, pipe sizing, technical drawing, PDF generation and exports — runs in the browser. Cloudflare Pages only serves static files.
The consequence: there is no application server, no build step, and no npm dependencies in production. Deployment means copying a directory.
The Workers layer (Stage E) is optional and exists solely to bypass CORS when fetching DTM tiles and to share projects. The application is fully functional without it.
drnx/
├── index.html ← THE ENTIRE application (no dependencies, no CDN)
├── _headers ← security headers (CSP, COOP/COEP, HSTS)
├── _redirects ← SPA redirects
├── wrangler.toml ← Pages configuration
├── wrangler.worker.toml ← Worker configuration (Stage E)
├── package.json ← npm scripts (optional)
├── profiles/
│ ├── PL-2026.json ← Polish normative profile (editable)
│ └── DE-2026.json ← German normative profile (editable)
├── worker/
│ ├── index.ts ← tile proxy + project sharing
│ └── schema.sql ← D1 database schema
└── docs/ ← documentation (PL/EN)
| Item | Requirement |
|---|---|
| Cloudflare account | the free plan is sufficient for Pages |
| Node.js | ≥ 18 (only to run wrangler) |
| Wrangler CLI | npm install -g wrangler |
| Paid Workers plan | only if you want Stage E (R2 + KV + D1) |
cd drnx
wrangler login
wrangler pages deploy . --project-name drnx
Wrangler returns an address such as https://drnx.pages.dev. The application is ready to use.
drnx/ directory to a GitHub or GitLab repository.None/Open the address and run, in order:
Expected result: 22/22 tests passing, including a scale-fidelity measurement taken on the generated PDF within a ±0.1 % tolerance.
wrangler pages deployment list --project-name drnx
Then in the dashboard: Pages → drnx → Custom domains → Set up a domain. Cloudflare issues the TLS certificate automatically.
Requires a paid Workers plan.
# 1. Resources
wrangler r2 bucket create drnx-tiles
wrangler r2 bucket create drnx-projects
wrangler kv namespace create META # record the returned id
wrangler d1 create drnx # record the returned database_id
# 2. Fill the identifiers into wrangler.worker.toml
# 3. Database
wrangler d1 execute drnx --file worker/schema.sql
# 4. Deploy the Worker
wrangler deploy --config wrangler.worker.toml
# 5. Check
curl https://drnx-proxy.<your-account>.workers.dev/health
# expected: {"ok":true,"role":"proxy-only"}
If you serve the Worker from a domain other than *.workers.dev, add that origin to the connect-src directive in _headers.
The files in profiles/ are editable without touching code. After every change, recompute the checksum:
python3 -c "import json,hashlib; \
p=open('profiles/PL-2026.json').read(); d=json.loads(p); \
d['sha256']=hashlib.sha256(p.encode()).hexdigest(); \
open('profiles/PL-2026.json','w').write(json.dumps(d,indent=2,ensure_ascii=False))"
The checksum is carried into the computation report and guarantees auditability: it is always clear which version of the rules produced a given result.
| Symptom | Cause | Remedy |
|---|---|---|
| Blank page | _redirects was not deployed | Confirm the file sits in the root, with no extension |
| Map does not render | Canvas had zero size at startup | Switch tabs or resize the window |
| PDF lacks Polish diacritics | Deliberate simplification — Helvetica, WinAnsi | Characters are transliterated; font embedding is a scope change |
wrangler: command not found | Not installed globally | npm install -g wrangler |
| Worker returns 403 | Host not on the allowlist | Add the host to ALLOWLIST in worker/index.ts |
| Worker returns 429 | 600 requests/min per IP | Adjust the RATE_PER_MINUTE constant |
_headers file enforces a strict CSP without unsafe-eval (beyond controlled WASM), COOP/COEP, HSTS and frame-ancestors 'none'.