Skip to content

Development

Inboxora docs edited this page Oct 4, 2026 · 4 revisions

Development

This page is for people building, testing or documenting Inboxora. The README is deliberately short; this Wiki is the product and operational knowledge base.

Requirements

  • Node 22 (frontend/.nvmrc pins the version).
  • No global TypeScript install: typescript is a dev dependency of both projects.
  • Docker only if you want to run the full stack.
  • Chromium for browser tests: npx playwright install chromium.

Repository layout

Path Contents
backend/ Express API, IMAP/SMTP sync, conversation engine, CalDAV/CardDAV servers, SQL migrations — TypeScript, built with tsc into dist/.
frontend/ React application in TypeScript (.ts/.tsx), shared UI primitives, Playwright specs and visual references.
docs/wiki/ Reviewed source of this Wiki.
docs/CHANGELOG.md Release-level change log.
media/screenshots/ Screenshots of the running application, regenerated by CI.
scripts/ Operational scripts, including Wiki publication and screenshot verification.

Local checks

Run these before pushing; CI runs the same commands.

# frontend
cd frontend
npm ci
npm run typecheck   # tsc --noEmit
npm test          # node:test unit suite
npm run lint
npm run build

# backend
cd backend
npm ci
npm run typecheck   # tsc --noEmit
npm test
npm run lint
npm run build

TypeScript

Both projects are written in TypeScript and both must type-check cleanly before a change is pushed:

cd backend  && npm run typecheck     # tsc --noEmit
cd frontend && npm run typecheck     # tsc --noEmit

Rules for changes

  • No type-checking suppressions. Do not add @ts-nocheck, @ts-ignore or @ts-expect-error, and do not silence an error with a blanket as any cast. Fix the type, the signature or the code. The tree currently contains zero of those pragmas and zero any occurrences.
  • Narrow, do not cast. unknown coming from catch, JSON.parse, a dynamic SQL row or an external payload is narrowed with typeof/instanceof guards, or asserted to a declared interface — never to any.
  • Dynamic SQL rows are typed. backend/src/services/db.ts exports type DbRow = Record<string, unknown> — the old any boundary is gone. query<{ ... }>(...) declares the columns a call reads, and that is the expected form for new queries.
  • strict is mandatory. Both primary tsconfig.json files enable strict and noImplicitAny; tsconfig.strict.json is a compatibility entry point to that same strict configuration. npm run typecheck and npm run typecheck:strict must both remain at 0 errors.
  • No type-safety escape hatches. Do not add explicit any, as any, suppression pragmas or ESLint-disable pragmas. Model external data as unknown, then narrow it at the boundary.

Browser tests

Playwright drives the real application. The default run uses mocked API fixtures and is deterministic:

cd frontend
npm run test:e2e

Projects cover desktop (1440×900), tablet (1024×768), phone (390×844 and 412×915) and phone landscape (915×412). Visual references are committed under frontend/e2e/v3-interface.spec.ts-snapshots/ and CI only compares them — it never updates them. Regenerate deliberately and review the images in the diff:

npx playwright test e2e/v3-interface.spec.ts --update-snapshots

A separate live-backend spec runs with a provisioned PostgreSQL and Redis:

PLAYWRIGHT_REAL_APP=1 PLAYWRIGHT_WEB_SERVER_COMMAND="..." npx playwright test e2e/real-app.spec.ts

Browser gates run for pull requests to both dev and main.

Documentation screenshots

The images in the README and this Wiki come from the application itself. The generator is frontend/e2e/docs-screenshots.spec.ts plus its demo dataset frontend/e2e/docs-demo.ts; it is opt-in and never runs in the regular gate:

cd frontend
npm run build            # the spec drives `vite preview`, which serves dist/
npm run docs:screenshots

It writes *-desktop.png (1440×900) and *-mobile.png (390×844) into media/screenshots/.

Every capture is verified before it is written. assertDocsPresentation fails the run unless the page shows the shared documentation theme, the unified inbox entry point, and real content: a populated message list, a rendered message body, or the module content the capture declares (for example the month grid with a known event). That is what keeps the gallery consistent and stops an empty or unstyled screenshot from being published.

.github/workflows/docs-screenshots.yml owns this set:

  • on a pull request or a push it regenerates the images and fails if the committed ones are stale, so a screenshot can never silently describe an interface that no longer exists;
  • dispatched manually it regenerates and commits the result back to the branch;
  • it uploads the generated set as an artifact either way.

scripts/verify-docs-screenshots.mjs runs after the spec and checks that every image referenced by the README or a Wiki page exists, that no committed image is orphaned, that both viewports are present, and that each file is a real PNG of plausible size.

The Wiki links images through absolute raw.githubusercontent.com URLs pointing at main; scripts/publish-wiki.sh can retarget those URLs when publishing from another branch.

Keeping the branch clean

This branch carries product documentation, not development archaeology. Dated investigation reports, audit notes and one-off regression scripts do not belong in the tree — their findings go into the relevant Wiki page, into docs/CHANGELOG.md, or into the commit message that fixed the issue. Git history keeps the full record.

The 4.0.1 TypeScript migration is recorded in Release notes 4.0.1 and docs/CHANGELOG.md; it has no separate root-level audit reports.

Documentation policy

  • docs/wiki/ is the reviewed source of the Wiki. Any user-visible behaviour, configuration or troubleshooting change must update the relevant page in the same change set.
  • Pages use relative links such as [Calendar](Calendar). The publication script rewrites them to Wiki page names, so keep internal links relative and free of paths.
  • Cross-check a claim against the behaviour first; the Wiki is documentation, not a wish list. If something is not implemented, say so explicitly (for example: mail merge does not provide template personalization, and Undo Send is not recall).
  • Keep only the latest released notes in the main release navigation. Add older versions to Archive.md and the collapsed Archive sidebar group without renaming their pages or breaking existing links. Reset Release-notes-Unreleased.md after preparing a release.
  • Publish the Wiki with scripts/publish-wiki.sh after a release, once the reviewed pages are on the released branch.

Interface conventions

  • The default interface uses Ink in the light appearance and Dark ink in the dark appearance, with self-hosted DM Sans, Fraunces and JetBrains Mono. Each appearance has its own default theme and the mode can follow the system; a single theme chosen before separate defaults existed is kept as an explicit choice for its tone, so a preference is never silently reset.
  • Shared controls live in ui.tsx / ui.css; Calendar and Contacts have scoped presentation styles; email HTML keeps its own isolated renderer.
  • v3-interface.spec.ts checks both behaviour and image references at desktop, tablet and mobile sizes. Fixtures freeze date/time and locale, use synthetic data and wait for self-hosted fonts. See V3 interface for the feature mapping and regression coverage.
  • Keep API responses and file formats compatible: DAV resource names, sync tokens and legacy storage keys are contracts, not implementation details. The retained legacy identifiers are recorded in docs/technical-identifier-audit.md.

Contributing

  • Search the issue tracker first, and discuss larger changes in an issue before implementing them.
  • One concern per pull request; add or update automated tests for behaviour changes.
  • Use concise Conventional Commit subjects, for example fix: handle calendar ETag conflicts.
  • Contributions are accepted under AGPL-3.0-only; see CONTRIBUTING.md.

CI selection and parallel validation

The shared ci-plan.yml workflow validates the checkout and classifies changed paths using a real Git diff (including both sides of renames, with no API file-list truncation). Pull-request validation is selected by subsystem instead of treating every non-documentation change as a full application change:

  • backend unit tests select backend typecheck/build/lint/unit validation only;
  • frontend unit tests select the frontend validation only;
  • production frontend/UI and Playwright changes select browser E2E, with documentation screenshot validation for UI-facing paths;
  • production backend changes select backend validation and the PostgreSQL integration layer;
  • conversation/migration paths additionally select the dedicated PostgreSQL upgrade/regression/ scale workflow;
  • full-stack production changes select real-app Playwright;
  • ntfy, UnifiedPush, nginx and compose paths select the push-stack workflow;
  • unknown/shared build or CI inputs deliberately fall back to the full validation set.

This routing is a safety optimisation, not a relaxation of required checks. Each workflow keeps a stable final result check for branch protection. When its heavy suite is not applicable, the job is reported as skipped and the final check succeeds only after the planner confirms that decision. Manual dispatch forces all checks.

Every heavy PR job has a 15-minute timeout. This is a hard guard against leaked handles, retry loops or tests waiting forever on an unavailable service. The browser suite remains split into four parallel shards; PostgreSQL upgrade, regression and scale use separate parallel service instances. The expected PR critical path is therefore bounded by the slowest applicable group rather than by the sum of all project suites.

A dev push with an open matching PR is covered by that PR's merge-revision tests; the push reports why its duplicate jobs were omitted. If the PR query or planner fails, the final gate fails. A skipped/not-applicable result is never presented as executed test coverage.

Create version changes in dev and merge the release PR before using scripts/release.sh. The helper only tags an already-merged, version-matched main commit and never pushes main. Versioned Docker publishing validates both native architectures before changing latest. The separate native-app workflow checks the same existing tag before using signing keys and keeps its release draft until the complete artifact set is verified.

Clone this wiki locally