Contributing
How Newses is built is in Architecture, and why in the decision records.
Setup
Clone newses-app/newses, then run nvm use, corepack enable, pnpm install, and pnpm check.
Commands
| Command | Does |
|---|---|
nvm use | Switch to Node 24 (.nvmrc) |
pnpm install | Install and link workspace packages |
pnpm check | Lint, typecheck, format check, tests (run before every commit; the AWS pipeline runs the same) |
pnpm locales:status | The messages each language has yet to translate, by package |
pnpm credits | Rewrite CREDITS.md from shared/src/credits.ts |
pnpm lint / pnpm typecheck / pnpm test / pnpm format | Individual steps |
pnpm test:coverage | The tests once with v8 coverage, then each package's and the overall coverage (pnpm coverage:status); coverage/ holds lcov.info, the HTML report, and summary.md. Reports only, never fails on coverage; not part of pnpm check |
pnpm --filter @newses/server db:generate | Generate a SQL migration from server/src/db/schema.ts changes (--name x; add --custom for hand-written SQL) |
DATABASE_URL=… pnpm --filter @newses/server db:migrate | Apply migrations |
docker compose -f docker/compose.yaml -f docker/compose.apps.yaml --profile apps run --rm apps | Builds the checkout's Linux, Windows, and Android apps (linux/amd64) into the downloads volume, which the server serves at /downloads/; RELEASE_TAG, PUBLIC_URL (https), APPS_PLATFORMS, and the Android and Windows signing values from docker/.env |
cd docker && docker compose -f compose.yaml build && docker compose up -d --build | Rebuilds the local stack from the checkout and starts it as docker/.env describes: its override files in COMPOSE_FILE (such as compose.yaml:compose.plugins.yaml) and optional services in COMPOSE_PROFILES (backup, observability, ntfy); with observability, Grafana, Tempo, Loki, and Prometheus are on 127.0.0.1:3000, given OTEL_EXPORTER_OTLP_ENDPOINT=http://lgtm:4318 |
pnpm --filter @newses/server feeds:auth | Test feeds behind HTTP Basic auth on 0.0.0.0:8090 (--port, --every minutes per item), listing their URLs and logins; from the Docker stack via host.docker.internal, with FETCH_ALLOW_PRIVATE_NETWORKS=true |
pnpm --filter @newses/web dev | Web app with hot reload; proxies /api to a server on localhost:8080 |
pnpm --filter @newses/web build:native | Web app for the desktop and mobile apps, in web/dist-native |
pnpm --filter @newses/desktop dev | Desktop app against the web app's dev server, with hot reload |
pnpm --filter @newses/desktop build:linux / build:win | Unsigned desktop packages in desktop/release (AppImage and deb; NSIS installer, built on Windows) |
pnpm --filter @newses/desktop build:win:signed | Signed NSIS installer (on Windows), with the values in desktop/electron-builder.env |
scripts/windows-signing-setup.sh | Creates the release pipeline's Azure app registration and signer role on the existing Artifact Signing profile; writes desktop/electron-builder.env, docker/.env's signing values with --docker, and SSM parameters with --ssm (--help) |
pnpm --filter @newses/mobile build:apk / install:apk | Unsigned debug APK in mobile/release (needs JDK 21 and the Android SDK); install:apk also installs it with adb |
pnpm --filter @newses/mobile build:apk:release | Release APK in mobile/release, signed with the values in mobile/android-signing.env (unsigned without them) |
scripts/android-signing-setup.sh --backup DIR | Generates the Android release keystore in an offline backup folder (or reuses it there); writes mobile/android-signing.env, docker/.env's signing values with --docker, and SSM parameters with --ssm (--help) |
scripts/image-registry-setup.sh | Creates the ECR Public repository the release pipelines publish the server image to, or updates its gallery listing, and the KMS key they sign it with; prints its URI for the stages' imageRepository in the deploy config, and the public key (--help) |
pnpm --filter @newses/web test:e2e | Playwright tests against a running deployment, signed in as an admin with subscriptions (checked before the tests run; its sessions are signed out before and after): E2E_BASE_URL, E2E_LOGIN, and E2E_PASSWORD, from the environment or playwright.env at the repository root; not part of pnpm check |
pnpm --filter @newses/infra cdk synth | Synthesise the AWS stacks and pipelines (build web first, and install the stages' plugins); deployments run through the pipelines |
pnpm --filter @newses/infra plugins:install | Install each AWS stage's plugins from the deployment config into server/.plugins/<stage>, audited, for synth to bundle (the pipelines run it) |
node plugin-api/src/publish.ts | Build @newses/plugin-api for npm in plugin-api/dist, versioned PLUGIN_API_VERSION, and list its files; --publish (with --otp CODE) publishes it, signed in to npm as a maintainer of the @newses scope |
node server/src/plugins/install.ts --dir DIR NAME@VERSION|./FILE.tgz... | Install plugins into DIR and write their list: npm packages, or files from npm pack under the current folder (--no-audit, --link to point #installed-plugins at it; docker/compose.plugins.yaml runs it, with docker/plugins/ for packed ones) |
scripts/store-deploy-config.sh | Checks the AWS deployment config (infra/deploy.config.json, gitignored; copy infra/deploy.config.example.json) against its schema and shows how it differs from the copy the pipelines' synth reads, SSM /<prefix>/deploy-config, and each stage's plugin changes; --apply stores it there, --release dev|prod then starts the stage's deploy pipeline (--help). The file is needed by cdk and the AWS scripts locally too |
git tag v1.2.3-rc.1 && git push origin v1.2.3-rc.1 | Release the apps to the dev stage (prerelease tags) or, with v1.2.3, to prod; the stage's release pipeline builds, signs, and publishes to /downloads/, and the server image to the stage's imageRepository. Prereleases must be -rc.1 to -rc.98, each a higher Android versionCode than the last and below the release |
scripts/reset-stage.sh dev|prod | Empties an AWS stage (--dry-run shows what it would delete): drops the database schema, re-runs migrate (admin adminLogin, password from SSM admin-password), empties the blob bucket, purges the queues; keeps SSM parameters and downloads; snapshots prod first (--help) |
scripts/export-instance.sh DIR [--aws dev|prod] | Exports a Docker install (the checkout's, or --compose FILE) or an AWS stage to a bundle directory: database without sessions or operations data, blobs, APP_SECRET; --freeze stops the source first for a cut-over, --archive-only leaves out re-fetchable blobs (--help) |
scripts/restore-instance.sh DIR [--aws dev|prod] | Replaces a Docker install's (the checkout's, or --compose FILE) or an AWS stage's data with a bundle: one-transaction database restore, the target's newer migrations, feed passwords, plugin secrets, and two-factor secrets re-sealed with the target's APP_SECRET, blobs; saves the Docker database or snapshots prod first (--dry-run, --help) |
scripts/freeze-stage.sh dev|prod [--undo] | Stops an AWS stage's data from changing: api and tick get no concurrency, the queue-fed functions stop polling; --undo restarts them |
aws lambda invoke --function-name <prefix>-<stage>-migrate --payload '{"task":"reissue-admin"}' --cli-binary-format raw-in-base64-out /dev/null | Gives a stage's first admin a new generated password in SSM admin-password once theirs has expired; refused while another admin is active |
aws sns subscribe --topic-arn arn:aws:sns:<region>:<account>:<prefix>-<stage>-alerts --protocol email --notification-endpoint ADDRESS | Emails a stage's operations alerts to ADDRESS, once confirmed from the email AWS sends; the topic <prefix>-budget carries the project budget's notifications, and <prefix>-<stage>-pipelines each result of the stage's deploy and release pipelines |
scripts/ses-setup.sh | The account's SES status (sandbox or production access, quota) and each mail stage's domain identity; --request-production-access asks AWS to take the account out of the SES sandbox, so those stages can email any address (AWS answers by email), and --test-recipient ADDRESS lets them email ADDRESS while in the sandbox; it only shows what it would change unless --apply (--help) |
aws ssm put-parameter --name /<prefix>/<stage>/push-tokens --type SecureString --overwrite --value 'ntfy.example.com=tk_…' | Gives a stage that sets pushTokens the ntfy access tokens it publishes pushes with (host=token, comma-separated); functions read it at their next cold start, so a deploy applies it at once |
scripts/try-release.sh | Run the dev release legs on the working tree without a tag; the publish is a dry run unless --publish (--help) |
scripts/sbom.sh | CycloneDX SBOMs of the server, Docker image, web, desktop, and mobile apps in sbom/, validated; --upload sends them to Dependency-Track (DTRACK_URL, default http://localhost:8080, and DTRACK_API_KEY, from the environment or dtrack.env), --from URL a published release's, --plugins dev|prod adds the stage's installed plugins to the server's (--help) |
Code conventions
- Node runs
.tsdirectly: erasable syntax only (no enums, namespaces, parameter properties); relative imports use the.tsextension; workspace packages export./src/index.ts. - Tests live next to code as
*.test.ts(Vitest). Database tests start a Postgres container via Testcontainers, so Docker must be running. - Migrations are generated, never edited after they are committed; change the schema and generate a new one.
webis bundled by Vite; browser code imports runtime values from@newses/shared/client(no Zod) and only types from@newses/shared.- UI strings live in each package's
src/locales/en.json(web,desktop,server), in vue-i18n's syntax:webshows them with vue-i18n,serveranddesktopwithformatMessage(shared/src/messages.ts). Write a literal@,|, or{as{'@'}. - A changed meaning takes a new key in
en.json: nothing else flags a translation gone stale. - Web layout is logical:
ms-,me-,ps-, andpe-classes, andinline-startandinline-endin CSS. Physical sides fail the lint andweb/src/logical-css.test.ts. - Text a reader or feed wrote sits in
<bdi>or hasdir="auto", in inputs too; URLs, codes, and patterns havedir="ltr".t()isolates parameters itself, so a message that gets stored goes throughwithoutIsolates. - Third-party work adapted or shipped outside a package (palettes, data, assets), and packages worth naming, are credited in
shared/src/credits.ts;pnpm creditsrewritesCREDITS.md. - A new workspace package is a top-level folder, registered in
pnpm-workspace.yamlandvitest.config.tsprojects. - No hardcoded deployment URLs (stage domains, downloads, repositories): self-hosters redeploy the app, so they come from the deploy config or the environment, with placeholders in examples. Links to the project site (its documentation and images), and the community files' links to the project's repositories, are the exception.