App structure
All paths below are under apps/cosmos/digital-services/ unless noted.
Directory map
Section titled “Directory map”| Location | Purpose |
|---|---|
src/pages/ | Route ownership — add or change Astro routes here (*.astro, dynamic routes, robots.txt.ts, etc.). |
src/layouts/ | Shared page shell, global scripts, SEO/layout defaults. Layout.astro is the main integration point. |
src/components/ | App-local components; prefer @cosmos/ui-astro (and siblings) before adding new local abstractions. |
src/scripts/contact-form/ | Active contact-form browser logic with dedicated tests. |
src/scripts/forms/ | Parallel / partially duplicated form layer — treat changes as high risk until ownership is clarified (some paths are stubs). |
src/__tests__/ | Jest unit and integration tests. |
e2e/ | Playwright smoke and user-flow coverage. |
tests/ | Standalone performance and Core Web Vitals scripts (*.mjs). |
workers/ | Gateway and image workers plus wrangler.*.toml. |
public/ | Static assets copied to output; includes _headers and _redirects. |
Edit rules
Section titled “Edit rules”- Layout-wide nav, auth link switching, theme boot, SEO defaults →
src/layouts/Layout.astro. - Maintenance mode →
src/middleware.ts. - Protected routes, session/logout APIs,
/api/*gateway behavior →workers/auth-gateway.jsand matchingwrangler.gateway.tomlroutes/vars. - Outgoing mail tool UI →
src/pages/portal/outgoing-mail.astro(plus env for worker URL; see Environment variables). - Scripts the team runs in CI/local →
package.json(canonical entry points).
Source anchors
Section titled “Source anchors”apps/cosmos/digital-services/package.jsonapps/cosmos/digital-services/src/apps/cosmos/digital-services/e2e/apps/cosmos/digital-services/tests/apps/cosmos/digital-services/workers/