Skip to content

Architecture ​

Stack ​

ConcernChoice
Language/runtimeTypeScript 6.0 (strict, ESM, erasable syntax only), Node 24 LTS running .ts directly via native type stripping (no build step for Node packages), pnpm workspaces
HTTP serverFastify 5, Zod type provider, @fastify/swagger (OpenAPI)
DatabasePostgreSQL 18; Drizzle ORM; drizzle-kit SQL migrations
Jobspg-boss (Docker), SQS (AWS)
HTTP clientundici
Feed parsingfeedsmith (RSS, Atom, RDF, JSON Feed, OPML); htmlparser2 for feed autodiscovery
Contentsanitize-html; @mozilla/readability + linkedom
Auth@node-rs/argon2, otpauth
LoggingPino (JSON), with the active trace's ids
ObservabilityOpenTelemetry API and Node SDK (OTLP); @fastify/otel, pg-boss's built-in tracing, pg and Node runtime instrumentation; nodemailer for alert email. AWS: ADOT Lambda layer to X-Ray, SNS, AWS Budgets
Emailnodemailer: SMTP; on AWS its SES transport (SES v2 API)
WebVue 3, Vite, Vuetify 4, Pinia, Vue Router, TanStack Vue Query, vue-i18n
DesktopElectron, esbuild, electron-builder
MobileCapacitor (Android)
TestsVitest (v8 coverage), Testcontainers (Postgres), Playwright, axe-core (WCAG 2.2 AA scans in the Playwright suite)
InfrastructureAWS CDK (TypeScript)
CI/CDCDK Pipelines (CodePipeline + CodeBuild) defined in infra/; no GitHub workflows

Repository layout ​

Workspace packages exist only where runtime or toolchain differs.

PathContents
server/Server code: Docker image roles and Lambda handlers (Node)
web/Vue SPA (PWA), built by Vite
desktop/Electron shell around the web build
mobile/Capacitor shell around the web build
shared/Zod schemas, API types, typed API client (browser and Node)
plugin-api/@newses/plugin-api: the contract plugins are written against (definePlugin, secret(), url(), multiline(), and feeds(), context, hook, and storage types, STORAGE_LIMITS, PLUGIN_API_VERSION); zod is a peer dependency, so settings schemas use the server's copy
infra/CDK app: stage stacks, per-stage deploy and release pipelines, release buildspecs
docker/Dockerfile, compose.yaml, .env.example, reverse-proxy examples, the apps build (compose.apps.yaml, apps.Dockerfile, apps-build.sh)

server/src layers. ESLint enforces the allowed imports.

FolderContentsMay import
coreDomain services (feeds, entries, filters, search, auth) and port interfaces; no framework or cloud SDK importsdb, shared
dbDrizzle schema and migrationsshared
adaptersPort implementations (pg-boss, local FS, S3, SSE, SMTP, instrumented fetcher, …)core, db, shared, telemetry
apiNative REST, TTRSS-compatible and Google Reader routes, SSE endpointcore, db, shared, telemetry
telemetryOpenTelemetry helpers, instruments, SDK preload, Fastify tracingshared
importerTTRSS importercore, db, shared
pluginsPlugin host: registry, plugins' network access, hook runner; implements the core ports that run hookscore, db, shared, telemetry
entrypointsserver, worker, migrate, cli, and lambda/ handlers — wire adapters into coreanything

Runtime model ​

  • Docker: one container image, role selected by command: server, worker, migrate, cli.
  • AWS: Lambda handlers api, tick (dispatch with push, queueing digests, plugin deliveries, alert checks, and kept images; purge, auth prune, archive compaction), fetch, favicon, extract, plugin, digest, migrate, bundled by esbuild; each reads the database password parameter once per cold start.

Rules:

  • Server is stateless; sessions live in Postgres.
  • No local-disk state outside BlobStore.
  • Migrations run as a one-shot migrate command (on AWS, a function invoked before each deployment's functions update), guarded by a Postgres advisory lock. It loads no plugins: their startup writes to tables the migrations may not have made yet.
  • Database connections time out after 10 s and idle transactions after 60 s. The server role also limits statements to 30 s and lock waits to 10 s, so requests fail instead of hanging.
  • The server logs a warning, with pool usage and the longest event-loop delay, for responses slower than 2 s and for requests the client abandons before a response.
  • buildApp() constructs the Fastify app without listening, so it can be mounted by listen() or a Lambda adapter.
  • The SPA is a standalone static build and talks only to the API.
  • Clients treat realtime as optional and poll counters when no stream is available, or the user's change marker when the server gives one.

Ports ​

PortResponsibilitySelf-hostedAWS
JobQueueEnqueue and consume jobs with retries; optional dedupe by keypg-bossSQS (no dedupe), consumed by Lambda
SchedulerPeriodically dispatch due feeds and purgesIn-process timer in workerEventBridge Scheduler
BlobStoreFavicons, cached images, archive filesLocal volumeS3
ArchiveWriterWrite entries to the cold-storage archiveParquet through BlobStoreParquet through BlobStore, catalogued in Glue for Athena
ArchiveReaderList, search, and get archived articles; compact the archiveDuckDB in-process, over the local blob directoryAthena over the Glue table
RealtimePublish per-user invalidation events from any process; server streams them to clients over SSE, or gives the path of a marker they pollPostgres LISTEN/NOTIFYChange markers in the blob bucket, served by CloudFront; the stream answers 204
ConfigSettings and secretsEnvironmentEnvironment and SSM Parameter Store
LoggerStructured logsPinoPino
NotifierTell operators when alerts open or resolveEmail over SMTP, when configuredThe stage's SNS alert topic
MailerEmail usersnodemailer over SMTP, when SMTP_URL is setnodemailer's SES transport with the stage's configuration set (MAIL_SES_CONFIGURATION_SET)
PushSenderDeliver encrypted Web Push messages to the push services devices subscribed withWeb Push over HTTPSWeb Push over HTTPS

Web app ​

Folder (web/src)Contents
viewsRoute pages: login, signed-in layout (feed tree drawer, dialogs), reader, archive, settings
componentsReader (tree, headlines, combined list, article), dialogs, settings panels
composablesServer state (TanStack Query), live counters, shortcuts, session
libPure logic: stream keys, tree building, shortcut matching, reordering, cache patches
offlineConnectivity, and the per-account local store (IndexedDB through Dexie)
platformPlatform bridge and the apps' server and token
storesPinia store for UI state only (drawer, dialogs, notices)
  • Routes: /connect (apps only), /login, /settings/:tab, /:stream/:entry?, /:stream/archive/:key? (all or a subscription), and /publish?url=&title=&text=, /subscribe?url=, and /share?title=&text=&url=, which fill in the Publish or Subscribe dialog, or offer the shared page to subscribe to or publish (its address is the first one in text or url), then show All articles; they never act on their own. The Settings → Sharing bookmarklets open the first two for the current page (its title and up to 2,000 characters of selected text) in a small window from the server's origin, which closes once the page is published. Streams are all, fresh, starred, published, read, f<subscription>, c<category> (c0 uncategorised), l<label>, t<tag> (URL-encoded); search is ?q=.
  • The archive view lists past articles read-only. Star, Publish, Labels, and Add note restore the article (the last two read, then open their dialog on it) and open it in its feed. It is reached from a subscription's or All articles' toolbar, and from a search, which it repeats over the archive.
  • Server data lives in the TanStack Query cache. Article changes (flags, score, catch-up, note, labels, tags) patch every cached copy, then save; a refusal restores the previous values. Without offline reading, a failure to reach the server does too. Headline lists are not refetched when entries change state, so read entries stay in place until the list is reloaded.
  • With offline reading on, headline lists, entries, and the snapshot queries fall back to the store when the server cannot be reached, and without a network do not ask it. Stored lists follow the server's stream rules (subcategories, Fresh window, low scores hidden where the server hides them, feeds hidden from All) and page by offset. Without the server, search covers the store: titles, authors, and feed names of stored entries and their stored text (HTML stripped), as words folded to lower case without accents, CJK as character pairs, in multi-entry words indexes on entries and contents; every group of alternatives (OR) must match, a term when all its words do, the last one typed also as a prefix, and a negated term when they do not. A word also matches stored words with the same stem (@orama/stemmers, loaded per language) in the languages of the stored entries and the device; operators filter the stored entries as the server does, with dates in the device's time zone; newest first. Content is indexed as it downloads, older content in batches after a sync; the index counts toward the storage limit, and settings show its size. A stored entry whose content is its latest version opens without a request.
  • Connectivity is online, offline (the shell reports no network), or unreachable: a request failed at the network, took over 45 s to answer, or got 502–504. Any other answer makes it online. While unreachable, GET /server checks again after 5 s, backing off to once a minute, and at once when the network returns or the app resumes. Queries pause and are not retried unless online; the first session check still runs, so the app can say the server is unreachable, and it reloads once the server answers.
  • The local store is one IndexedDB database per account (newses-<user>, in the apps newses-<server hash>-<user>); localStorage remembers the last account, and in the apps each profile's, with the profile's offline settings and last theme. In the browser, signing out or another user signing in deletes the previous account's store; in the apps a profile keeps its store while the app runs on another, and signing out deletes it. When the server ends a session without a sign-out here (a 401, found by the page, the service worker, or the Android job), what a reader could see goes: the store keeps only changes not yet sent, which the same user sends after signing in again, when it downloads again; with none, it is deleted too.
  • Offline reading is on in the apps, and in a browser once turned on for the device. Against API 1.1 or later the app keeps the store current. The first sync takes /sync/token, then the unread (up to the device's setting: 1,000, 5,000, or 10,000; All's first, then each feed hidden from All), starred (2,000), and Recently read (2,000) headlines, the lists, preferences, themes, counters, tags, and the session without its CSRF token; later syncs follow /sync, and a 410, or keeping more unread entries, loads everything again. Syncs run at launch, on resume, when the server answers again, when counters change, and every 15 min (30 while hidden, then only where counters are polled in the background); one tab runs them at a time.
  • The store keeps unread and starred entries and those read in the last 7 days; past each limit the oldest go, and content and images no other stored entry shows go with it.
  • After each sync, the content of stored entries without a current copy (unread newest first, then starred, then recently read) downloads 100 at a time through POST /entries/contents, then their images through the image proxy: two at a time, one per image host, up to 4 MB each in 60 s, failures retried after 24 h, and on Android only on Wi-Fi unless set otherwise. Content and images together stay under the device's limit (256 MB, 1 GB, or 4 GB; in the apps per profile, 1 GB for the first and 256 MB for later ones); past it, images and then text of the lowest-priority entries go. In the apps, Settings → Account shows what each profile's store takes and removes its downloaded data; Offline settings shows all profiles' total from the storage estimate and warns when their limits together pass the quota; the apps ask for persistent storage at launch.
  • Stored images show from the device, online too, matched by their original URL whether or not the content was proxied; an entry's content renders once they are looked up or after 1.5 s (those found later then replace the others), and without a connection its other images have no source. Without offline reading, opening or scrolling past entries offline does not mark them read. Stored content is served to readers who proxy images with every image at its proxy path, and without the ones that have none.
  • With offline reading on, article changes made while the server cannot be reached, before the session is confirmed, or behind changes already waiting go to the store's outbox and the stored entries; counters are adjusted as the server will count them. Waiting changes are merged per entry and flag, keeping each catch-up in its place; an offline catch-up applies to the stored entries and is sent with the newest stored id as maxId. Each change records what the entry had before it. Each sync first sends them, oldest first, equal flag changes in bulk PATCH /entries (up to 1,000). Against API 1.2 they are compare-and-set: flags carry expect, labels and tags go as added and removed, and notes carry expected; changes the server kept for newer values are counted for the reader, and a note changed elsewhere too asks the reader to keep their own, keep the server's, or copy their own and keep the server's. Older servers have changes replaced as they are. A failure to reach the server retries after 2 s, doubling to 5 min; a 429 waits for Retry-After; a 401 waits for sign-in; a 404 drops the change, except labels, sent again without the labels that are gone; other refusals drop it and tell the reader. Entries from the server, synced or listed, show the changes still waiting for them. Signing out with changes waiting asks first.
  • Preferences, categories (create, rename, move, collapse, delete), feeds (subscribe, rename, move, settings, unsubscribe), labels, and themes (create, edit, publish, delete, import) change offline the same way, shown at once in the cached lists, which show waiting changes over both the server's and the store's copies. Objects created offline get negative ids; once the server creates one, waiting changes, stored entries' labels, and the appearanceTheme preference take its id. Deleting one before it is sent forgets it and the changes to it: its feeds and subcategories go to its parent, entries lose the label, a theme in use falls back to Original. A refused create does the same and tells the reader; a page offering several feeds asks to subscribe again; a theme name taken meanwhile gets a number, a label caption taken meanwhile means that label, and a refused theme stays as a draft in Appearance to export. Feeds and categories not yet sent are marked in the tree, labels and themes in their settings; a feed opens once subscribed. Fetching feeds, OPML, filters, sharing, and account settings need the server.
  • Settings → Plugins shows for admins, and for others where GET /server says plugins are installed; its changes need the server.
  • A status in the corner (role="status") says when the app is offline or the server unreachable, with the changes waiting and the last sync; while online, that changes are being sent, and briefly that the connection is back. Share, full-text extraction (stored full text still shows), and the archive say they need a connection when used offline and are marked aria-disabled.
  • The Offline settings tab holds the device's choices (unread entries kept, images, Wi-Fi only on Android, storage limit, sync while closed) in localStorage, what the store holds, changes waiting, the last sync and its error, Sync now, and Clear, which deletes the store and downloads it again. In a browser a switch turns offline reading on for the device, asking the browser to keep the storage, and off, which deletes the store; it says whether the browser keeps the storage and, in Safari on iOS, to add the app to the Home Screen. Synced changes patch cached lists and entries, and headline pages loaded online are written to the store.
  • The snapshot queries (session, preferences, subscriptions, categories, labels, counters, tags, themes) are copied to the store whenever they load, and the first sync writes them before any headlines; the session is also written once the route guard knows the account. When the server cannot be reached, the app starts from them, seeded as stale; once it answers, the session is checked again, and a 401 signs out.
  • Entries scored above the user's scoreHighlightAbove get a highlight bar and a bold score.
  • Opening an entry marks it read once. Combined layout can mark entries read as they scroll above the top, saved in one request per second.
  • Counters refetch on counters events. Without a stream they are polled every 60 s, paused while the page is hidden; a closed stream is retried every 5 minutes.
  • Below 900 px one pane shows at a time; below 700 px secondary toolbar actions move into a menu.
  • A theme is a set of tokens (shared/src/themes.ts): style, light and dark palettes, UI and article fonts as keys, UI text scale, corners, density, borders, shadows, and effects. Built-in themes are in shared, with the API minor each, and each style and font, arrived in; the appearanceTheme preference names one, or a custom theme's id, and themeAdjustments holds the reader's partial overrides. The theme preference is the mode: light, dark, or the system's.
  • A theme resolves as its built-in base, then its overrides, then the reader's adjustments; a reference that no longer resolves, or a built-in this app doesn't have, shows Original. The result replaces the colours of Vuetify's light and dark themes in place, provides Vuetify defaults around the routes, and sets --v-font-body, --ui-font-scale, data-theme-style, and data-effects on the document root.
  • Styles other than standard are stylesheets in web/src/themes/, unlayered so they override Vuetify's layers, scoped by data-theme-style, and aimed at app-owned classes where possible. Decorations are generated content with empty alternative text. data-effects turns on textures and animation; animation stops under reduced motion and effects under forced colours. Sketch's lines wobble through an SVG filter on frame pseudo-elements, never on text or list rows. E-ink stops every transition and animation (Vuetify's scripted ones, and its ripples, through its defaults), leaves out hover tints and dimming scrims, and keeps text at full strength. Synthwave takes its blue from the surface; its sunset and grid stay in the app bar, behind its content, and its tints there and on the open feed are faint enough that text keeps AA contrast. Noir's texture jitters titles (app bar, article heading) letter by letter, each turned and raised by an amount fixed per letter, through JitterText: only in scripts whose letters stand apart (Latin, Greek, Cyrillic), with the plain text for screen readers.
  • Against a server older than a built-in theme's, style's, or font's API minor, Appearance and Reading leave it out, and importing a theme that uses one says the server needs updating; until the server answers, all show.
  • Palette contrast checks (built-in theme tests, and warnings while adjusting) count text as secondary text shows it, faded to Vuetify's medium emphasis.
  • Custom themes export as JSON { format: 'newses-theme', version: 1, name, base, tokens }; importing posts the file's theme to /themes, so the server validates it, and numbers a name already taken.
  • The last resolved tokens are kept in localStorage and applied before mounting, so a reload starts with the reader's theme and signed-out screens use it.
  • Reading preferences (font, text size, line width) set CSS custom properties on the document root that article styles read; the default font is the theme's article font, and the text size is kept under the theme's scale.
  • LOCALES in shared lists the shipped languages. The language preference (API 1.7) holds a language tag, any tag so that a server never refuses an app's newer language, and null follows the device. Before mounting, the app shows the last choice kept per profile in localStorage, else the first of navigator.languages on offer (es-MX as es), else en, and sets lang and dir on the document root; signed-out screens stay on that. Signed in, the preference replaces it, and is fetched again each time the app regains focus. Against a server older than API 1.7, where /prefs has no language, the choice stays on the device and is never sent.
  • en and its Vuetify strings are always loaded and fill any gaps. Other languages are lazy chunks, which the service worker precaches and the native build bundles; one that fails to load leaves the current language. Vuetify's text and direction follow through createVueI18nAdapter.
  • t(), on the one composer useI18n() returns, formats numeric parameters for the language, and isolates text parameters with FSI and PDI in a right-to-left language or when they hold right-to-left text. Titles sort with Intl.Collator in the app's language.
  • Right to left, icons listed in web/src/lib/mirrored-icons.ts flip with CSS, and the desktop's window controls keep their side. Code, media controls, URLs, one-time codes, and patterns stay left to right. Theme fonts bundle latin subsets only; other scripts use system fonts.
  • Article bodies, excerpts, and titles take their direction from their text (dir="auto") and carry lang, from the entry's xml:lang, dc:language, or JSON Feed language, else its feed's (RSS <language>). A language a changed entry no longer gives is kept.
  • Fonts are system font stacks, except the theme fonts Patrick Hand and IBM Plex Mono (latin subsets), which are bundled and served from the app's own origin. A browser downloads one only when text uses it; the service worker caches fonts when first used rather than precaching them, and with offline reading on, the first sync of a page loads all of them so themes render offline.
  • Shortcuts follow TTRSS's defaults, including two-key chords (g a) with a 1.5 s window. They are ignored in text fields and while a dialog is open. On a non-Latin layout, a key not bound itself acts as the Latin letter at its position.
  • The shortcutBindings preference holds only changed actions; each replaces that action's defaults, and [] unbinds it. A key cannot be bound alone while it starts a chord.
  • PWA: the manifest's share_target (GET /share) puts installed apps in the system share sheet. The service worker (web/src/worker/sw.ts, Workbox injectManifest) precaches the app shell only; API requests always go to the network. Feed icons (/favicons/*) are cached when first shown (up to 500), so they show offline; signing out or the session ending deletes them. It is checked with the worker's globals (web/src/worker/tsconfig.json), so the offline modules it runs import neither Vue nor the DOM.
  • With offline reading on, installed Chrome and Edge apps sync with no window open: Periodic Background Sync (newses-sync, at least 30 min, when the browser grants it to the installed app) sends waiting changes, follows /sync, and downloads text; Background Sync (newses-outbox, registered when a change is kept) sends waiting changes when the connection returns. The page hands the worker the account's store and the device's choices in a small newses-worker database, as it has no localStorage; it confirms the session (and gets the CSRF token) first, and when it has ended clears what a reader could see and stops until a page signs in again. What it could not send is reported by the next page that opens. Tabs and the worker share the Web Locks, so only one syncs. Other browsers sync while the app is open, and the Offline settings say which applies.
  • New-entry notifications in browsers (off by default, per browser and user; Settings → Account → Notifications, shown where the browser has Web Push and the server gives push.key; on iPhone and iPad it asks for the app to be added to the Home Screen): turning them on asks for the permission, subscribes with the server's key (userVisibleOnly), and PUTs the subscription; turning them off DELETEs it and unsubscribes. Each launch binds the subscription to the session again, subscribing again when the key changed, and unsubscribes one another user turned on or that a server without push no longer takes. Signing out here unsubscribes; a session the server ended keeps the subscription for the same user's next sign-in. The page hands the worker the user and the notification's messages in the app's language (as Android's job gets them) in newses-worker, again when the language changes.
  • The worker shows each push message (asPushMessage checks it) as one notification (tag newses-new-entries), added to the one still showing as a running total, worded with those messages, silent while a window is visible; then, with offline reading on, it syncs as Periodic Background Sync does. Clicking it focuses a window and has it open the stream (newses-navigate message), or opens one there. A window becoming visible closes it, so the next counts from then.

Native build (build:native, web/dist-native), bundled by the desktop and mobile apps:

  • No service worker. NATIVE_CSP (shared/src/web-csp.ts) is in a <meta>: WEB_CSP with connect-src https:, because the server is chosen at runtime.
  • The shells set window.rssReaderBridge (web/src/platform/bridge.ts) before the app's scripts run: server profiles (a server and a user each, one active) with each profile's bearer token in secure storage, open in the system browser, share a link (the share sheet, else a new mail with no recipients; the browser uses navigator.share, else a mailto: link), save a file, notify, app version, update status, network status (and on Android whether it is Wi-Fi), and refresh requests (resume, unlock, the tray; Android's return to the foreground). An update that is ready or available prompts once per version per launch; settings shows the version, the update status, and Check for updates. The web build uses a browser stand-in; the native build outside a shell keeps profiles and tokens in memory.
  • Profiles are named by the reader's label, else login @ server: the server's instance name, kept with each of its profiles and updated when the app checks the server at launch, or else its host, with an initial on a colour from the profile's id. A profile menu at the top of the drawer, and "Use another profile" on the sign-in page and the unreachable-server screen, lists them (signed-out ones marked) to switch to, and opens the connect screen to add a server. Settings → Account lists them to switch to, rename, or remove; removing asks first, saying how many changes not yet sent are lost, then deletes its store and settings and revokes its session. Sign-in fills in the profile's login.
  • The connect screen ("Add a server" once a profile exists) opens on first run, from "Add server", and from "Change server" while there is one profile (sign-in page, unreachable server). It takes an HTTPS origin and checks GET /api/v1/server: another product or API major is refused, an older minor warned about. Another server moves the app to that server's profile, a signed-in one first, or to a new one; the profile left keeps its session and store. Moving to another profile waits for a sync or send in progress, stores what the Android job fetched, stops background sync, then reloads the app on the new profile.
  • Sign-in asks for a bearer token, which the bridge keeps for the active profile; the login request carries no token, so it ends no other profile's session. Signing in as another user than the profile's moves the app to that user's profile on the server, made if needed, and the profile left stays signed out. Any 401 forgets the token and returns to sign-in; signing out revokes the session, then forgets it.
  • Feed icons load from iconUrl on the server. A server before API 1.3 gives an iconUrl that needs the session, which an <img> cannot send, so against one they load from the user's iconsPath (login and session responses; the signed /feed-icons path).
  • Against a server before API 1.4 the feed dialog leaves out Pause updates, Hide from All articles, and the check interval.
  • Server-relative URLs in entry content (proxied images, links) are made absolute against the server; public page links use the server's origin.
  • The counters stream is read with fetch, which can send the token; 204 or an error falls back to polling, and an ended stream reconnects after 5 s.
  • OPML export saves through the bridge. Links to other origins open in the system browser and never navigate the app.
  • Every response carries X-Content-Type-Options: nosniff, and HSTS (1 year) when the request arrived over HTTPS; API responses default to Cache-Control: no-store. On AWS, CloudFront also adds HSTS to every response and a viewer-response function adds charset=utf-8 to text responses from S3.
  • In the Docker image the server serves the build from WEB_DIR, with a CSP (scripts from self only, frames from the sanitiser's video hosts), Referrer-Policy: no-referrer, and immutable caching of fingerprinted assets. Unknown non-API GETs return index.html. On AWS, CloudFront serves the build from S3 with the same headers, and a viewer-request function maps extensionless paths to index.html.

Desktop app ​

desktop/: Electron for Windows and Linux (x64). esbuild bundles the main process and preload into out/, beside the native web build (out/web); electron-builder packages a per-user NSIS installer, a zip of the app (runs without installing; not updated by electron-updater), a portable exe, an AppImage, and a deb.

  • The web build is served from app://newses, a privileged standard scheme: client-side routes fall back to index.html, and responses carry the native CSP as a header. The API sees that origin.
  • The window has context isolation, the sandbox, no Node integration, and no webviews. New windows are denied and navigation away from the app is blocked; http(s) links open in the system browser. The only mailto: the app opens is the bridge's shared link, which the main process builds from a title, text, and http(s) URL. Only the notification and clipboard-write permissions are granted.
  • Fuses: no RunAsNode, NODE_OPTIONS, or inspect arguments; the app loads only from its integrity-checked asar.
  • The preload exposes the bridge; the main process answers only frames on the app origin and validates arguments.
  • The app's theme preference sets Electron's theme source: system follows the OS (prefers-color-scheme), light and dark pin it. The window's background follows the appearance theme's, and the last one is kept in settings so a new window opens in it.
  • No native title bar: the app bar moves the window (an empty strip at the top on screens without one), and the window controls overlay its end (Window Controls Overlay, transparent), drawn in the appearance theme's text colour, also kept in settings. Open overlays and the narrow layout's drawer turn the drag area off.
  • settings.json in the user data folder (owner-only) holds the profiles, the active one, window bounds, and each profile's token encrypted with safeStorage (DPAPI on Windows, the keyring on Linux). On Linux without a keyring (basic_text) tokens are kept in memory only, so each launch signs in.
  • Portable exe (portable target): unpacks the app into a new temporary folder on each launch (unpackDirName: false) and deletes it on exit. With PORTABLE_EXECUTABLE_DIR set, the app moves userData (settings, the offline store, Chromium's data) to Newses Data beside the exe before taking the single-instance lock, or keeps the default when that folder cannot be written. On another PC or Windows user, DPAPI cannot decrypt the tokens, so each profile signs in again.
  • One instance at a time. Closing saves the window bounds unless the window is minimized or off every screen; they are restored while still on a screen, else the window opens centred on the primary screen. The menu (File, Edit, View) has no bar; its shortcuts work.
  • WSLg places Linux windows itself, ignoring the bounds the app asks for, and does not report Windows-side moves or minimizing to the app. A window closed while minimized there reopens minimized and off-screen.
  • New entries: while the window is hidden or unfocused, the main process shows one notification of the unread entries added to existing subscriptions since it went there ("12 new entries": the categories, most first). The first shows at once; it is then replaced with the running total, when that has grown, at most every 15 min, and closed when the window is focused. Clicking it opens the feed or category, or All; after a move to another profile it only shows the window. Hidden windows poll counters (on AWS, the change marker) every 30 min (the AWS dispatch interval) instead of pausing; resume, unlock, and the tray's Check now refresh at once. Notifications can be turned off.
  • The tray and application menu use desktop/src/locales, in the language the app reports (setLanguage), kept in settings.json for menus built before the window runs; on first run, the system's. Each menu role has its label, as Electron's stay English.
  • Optional, in settings: keep running in the tray when the window closes (Open, Check now, with several profiles a Profiles submenu marking the active one, Quit; picking another shows the window and moves the app there), and start at login (--hidden, straight to the tray when it is on; a login item on Windows, an XDG autostart entry on Linux; not offered by the portable exe). Desktop options live in settings.json.
  • Updates (release builds only; electron-updater on the stage's /downloads feed): checked at launch and every 6 h. AppImages and signed NSIS installs (uninstaller beside the exe, publisher in the feed config) download in the background and install on restart or quit; updates must carry the same Windows publisher. A deb, the Windows zip, or the portable exe gets a link to the downloads page instead. Prereleases update to newer prereleases (semver order).
  • pnpm dev serves app://newses from the web app's Vite dev server in native mode, so the origin and bridge match the packaged app.

Mobile app ​

mobile/: Capacitor for Android, app.newses, served from https://localhost. android/ is committed.

  • build assembles www/ from the native web build and bridge.js (the bridge bundled with the Capacitor plugins), loaded before the app's scripts, then syncs it into android/.
  • Bridge: the profiles in Preferences; each profile's token in secure storage (AES-GCM with an Android Keystore key); links in Custom Tabs; files saved to the cache and offered through the share sheet; shared links through the share sheet, the title as the subject; status and navigation bar icons are light over a dark theme background, judged by its luminance rather than the mode.
  • Background sync: the app's BackgroundSync plugin runs a WorkManager job every 30 min (every 4 h while the server's pushes arrive, see Push), needing a network (unmetered with images on Wi-Fi only) and a battery that is not low. It follows /sync from the store's token (at most 20 pages), then fetches the text of unread and starred entries that changed, keeping each response in app storage (at most 8 MB), tagged with the profile, without sending waiting changes. It runs for the active profile only: the bridge hands it that profile's id, server, and bearer token, which it keeps encrypted with its own Keystore key. On launch and resume the web app takes the pages fetched for the active profile, dropping any other's, and stores them in order, a sync page only when it carries on from the store's token, then hands over its token after each sync; a 401 stops the job until sign-in and deletes what it kept, and turning it off, signing out, Clear, offline reading off, leaving the profile, or another profile taking it over deletes what it kept.
  • New-entry notifications (off by default; Settings → Account → Notifications, which asks for POST_NOTIFICATIONS on Android 13+ and stays off when refused): with them on, the bridge also hands the job the store's highest entry and subscription ids, each subscription's category and title, and the notification's messages in the app's language (the title per plural form, lists of one to three places, "and N more", the channel name), again when the language changes. From each /sync page the job counts unread entries above those ids, outside subscriptions added since, as a running total; entries read or deleted since drop out. While the app is not on screen it shows one notification (channel new-entries), worded as the desktop's, replacing the last: alerting when the total grew, quietly when it shrank, removed at none. Tapping it opens the feed or category, or All. Resuming the app removes it and starts the total again.
  • The back button closes the top dialog or menu, then the drawer, then goes back; at the start of the app's history it exits.
  • The app draws edge to edge (the native build's viewport has viewport-fit=cover): #app is inset by the safe areas (Capacitor's --safe-area-inset-* variables, else env()) and contains the layout, which scrolls inside it.
  • Push: with background sync on and a server that gives push.key, the plugin registers with the reader's UnifiedPush distributor (org.unifiedpush.android:connector, no embedded FCM): the one chosen, else the only one installed; with several, Settings → Offline asks for one (the system's picker, else a list). The registration carries the server's key and is made again for a new key or distributor, after a failure or an unanswered request (10 min), and daily. NewsesPushService takes the distributor's endpoint and keys, which PushSubscriptionWorker sends with PUT /push/subscription and the job's token, so it works with the app closed; a message that decrypts runs the job once, after any run in progress. While an endpoint is registered the timer runs every 4 h. Leaving the profile DELETEs its session's subscription and sends the endpoint with the new one's; turning background sync off, signing out, and offline reading off unregister. The distributor unregistering, or refusing, falls back to the 30-minute timer. Settings → Offline says through which distributor pushes arrive, or suggests installing one (ntfy, at push.distributor when the server gives it).
  • HTTPS only (cleartext off), the permissions are INTERNET, ACCESS_NETWORK_STATE, and POST_NOTIFICATIONS (and those WorkManager adds: wake lock, boot completed, foreground service), and app data is not backed up (Keystore keys do not move between devices).
  • Share to the app: an ACTION_SEND text/plain filter on the singleTask activity; the app's ShareTarget plugin passes the text and its subject to the bridge (also for a share that launches the app). The first http(s) URL, titled by the subject or else the rest of the text, is offered to subscribe to or publish, after sign-in when signed out; servers before API 1.5 open the subscribe dialog filled in. The page goes to the active profile; with others signed in, the dialog names it and can move the page to another, kept in sessionStorage across the reload.
  • Updates (release builds only): at launch, at most daily, the bridge fetches the stage's /downloads/latest.json natively (no CORS) and compares its versionCode; a newer APK opens in the browser, which hands it to the package installer. The last result is kept between launches.
  • versionName comes from the release tag and versionCode is major·1000000 + minor·10000 + patch·100 + a prerelease slot: -rc.N (1–98) is N, a release 99, a try-release.sh build (-try.*) 0; other prerelease tags are refused. Local builds are 0.0.0-dev (code 1). Release APKs are signed with the release keystore when ANDROID_KEYSTORE_* is set, else unsigned.

Ingest pipeline ​

Scheduler ─▶ claim due sources ─▶ feed.fetch job per host (≤ 20 sources, fetched one after another)
  fetch      conditional GET (ETag/Last-Modified); per host at most 2 concurrent requests, starts ≥ 1 s apart
  decode     bytes → text; charset from BOM, then HTTP Content-Type, then XML declaration/HTML meta, else UTF-8
  parse      feedsmith → per-format mapping to normalised entries; XML that fails to parse is a fetch error
             dates parsed leniently, zone-less dates are UTC, unparseable dates are null
             entry links, enclosures, and site URLs kept only if absolute http(s)
  identify   feed GUID, else sha256(link + title), else sha256(content); duplicates within a document dropped
             a new item takes over an imported entry (GUID `ttrss:…`) with the same link in the same source
  sanitise   allow-list HTML; strip control characters; resolve relative URLs (incl. srcset); drop tracking pixels
             (1×1 images, images from hosts in `trackers.ts`); titles to plain text
  store      insert new entries; rewrite existing ones only when their content hash changed; replace enclosures
  fan out    new entries become unread user entries for every subscription, unless older than its purge age
             the entry's feed categories become the subscriber's tags
  filter     each recipient's enabled filters, in order, until "stop" (see Filters)
  notify     Realtime `counters` event per user who received entries
  push       Web Push message to each such user's devices, at most one per window (see Push)
  full text  `entry.extract` job for the source when a subscriber opted in and entries were added
  schedule   next fetch after the interval, or after backoff on failure; favicon refresh when older than 30 days

Updater:

  • Dispatch claims due sources that have an unpaused subscription with FOR UPDATE SKIP LOCKED, at most 20 per host, pushing their next fetch 15 minutes out, so concurrent dispatchers never double-fetch. A finished fetch sets the real next time.
  • One feed.fetch job per host may wait in the queue; sources that cannot join it stay due for the next dispatch.
  • A feed.fetch job holds its host's lease (fetch_hosts.lease_id, 2 minutes, renewed before each source, released at the end). A job that finds the host leased pushes its sources' claim to 15 minutes out and is queued again a minute later, or leaves them due when a job for the host already waits; one that loses its lease leaves the rest due.
  • The base interval is the shortest among unpaused subscriptions, each taking the subscription's override, else the user's updateIntervalMinutes preference, else FEED_UPDATE_INTERVAL_MINUTES; never below 5 minutes. Users and subscriptions cannot set less than 15 minutes.
  • The interval in effect is the longest of the base, the publisher's hint (Cache-Control max-age/Expires, RSS ttl, sy:updatePeriod; at most 24 h), the source's slowdown, and its host's minimum (fetch_host_rules, set by admins). The source stores it and what set it; the next fetch waits it plus up to 10 % random jitter.
  • Each 429, or 503 with Retry-After, doubles the source's slowdown, starting from the interval without it, up to 24 h. Five successful fetches in a row halve it; it is cleared once no longer than the interval without it.
  • Changing a subscription's interval or pause, a user's updateIntervalMinutes, subscribing to or unsubscribing from a fetched source, and setting or clearing a host's minimum reschedule the source: next fetch at its last fetch plus the new interval (with jitter), not before now or blocked_until. Sources that are disabled, failing, never fetched, or due within the 15-minute claim window keep their time.
  • Subscriptions report the interval in effect and why (own, shared when other subscriptions make it shorter, publisher, slowdown, siteMinimum) and the next fetch; paused ones report paused and neither, so other subscribers' fetches stay private.
  • sort_at is the published time (fetch time when absent), clamped to now.
  • A failed fetch waits interval × 2^(failures − 1), capped at 24 h and never less than Retry-After. HTTP 410, or FEED_DISABLE_AFTER_FAILURES consecutive failures, disables the source.
  • Every request to a remote host (feeds, subscribe, favicons, images, full text, pages) goes through PoliteFetcher: within the per-host limits (2 concurrent, ≥ 1 s apart, per process), never to a paused host (host_blocked), and a 429, or a 503 with Retry-After (without it: 10 minutes), pauses the host that answered until then (fetch_hosts.blocked_until, shared by all processes).
  • Retry-After (and HTTP 429 without it: 10 minutes) sets the source's blocked_until. A paused host's sources are postponed until the pause ends, without counting failures.
  • Per user, in a minute from their first request, on-demand full text (20), subscribing to a feed not yet fetched (10), reading a page to publish (10), the feed debugger (5), and OPML imports (5) are counted in rate_limits; past the limit they get 429 with Retry-After, except publishing, which publishes the page unread.
  • "Update now" clears errors, re-enables the source, and enqueues a fetch. It is a no-op within a minute of the last fetch and refused (throttled) while blocked_until is in the future.
  • A permanent redirect (301/308 from the first hop on) moves the source to the new URL after a successful fetch, unless another shared source already has that URL; a source with credentials moves only within its origin.
  • Image proxy (per-user proxyImages preference): when an entry is served to such a user, img src/srcset, picture source srcset, and video poster URLs become /api/v1/images/<hmac>/<base64url URL>, signed with the image-url key, and image enclosures (by MIME type, else file extension) carry that path as proxy. The route serves from BlobStore (images/<sha256 of URL>) or fetches once through PoliteFetcher, up to 4 MB, accepting only images (declared or sniffed). Failures are not retried for 24 h. Responses are public, max-age 30 days, immutable, with a sandboxing CSP and Access-Control-Allow-Origin: * (also on 403 and 404), so the apps can read them whatever CloudFront cached.
  • Kept images: a sweep (every 5 minutes on Docker, after each dispatch on AWS, at most 2 minutes) lists the images of entries someone keeps (starred, published, noted, labelled, or shared) in entry_images: those of the content and full text, at most 30, as POST /entries/contents lists them, again when the content version changes (entry_image_sets). It then fetches listed images not cached, 4 at a time across hosts, and failed ones again after 24 h, at most 3 times in a row; a paused host's wait for the next run.
  • Favicons: declared <link rel="icon">/apple-touch-icon, else /favicon.ico; the first 3 candidates only; page read up to 512 KB, icons up to 256 KB; reused from another source of the same site checked within 30 days instead of refetched; share the per-host limits. Stored in BlobStore as favicons/<sha256 of type and bytes>, so sources showing the same icon share one blob, deleted once no source shows it. iconUrl is /<key>: public, max-age 1 year, immutable, with a sandboxing CSP.

Purge (every 6 h):

  • Deletes user entries older than the purge age: the subscription's purge_days, else the user's purgeDays preference, else FEED_PURGE_DAYS; 0 never. Kept entries (starred, published, noted, labelled, or shared) are never purged.
  • Deletes user entries without a subscription (pages, kept entries of unsubscribed feeds) that are no longer kept once unchanged (updated_at) for the user's purge age, so counted from when they stopped being kept.
  • Deletes entries no user references once they have been absent from their feed for 7 days (last_seen_at), so purged entries are not re-ingested as new.
  • Deletes feed sources with no subscriptions and no kept entries, and their favicons; never the pages source.
  • Forgets the images of entries no longer kept, then deletes proxied images and remembered failures fetched more than 30 days ago, except images of kept entries.
  • Deletes tombstones older than 30 days, and host rows whose pause and lease have both ended.
  • With ARCHIVE_ENABLED, entries other than pages and those of sources with credentials go to the archive before they are deleted, in batches of 1,000, for up to 3 minutes per run: unreferenced entries past the grace period, then every entry of a feed source about to be deleted. Each batch's delete re-checks its conditions, so an entry used again meanwhile stays (and is also archived). A source is deleted only once its entries are; the rest waits for the next run.

Archive:

  • Parquet files under the blob root, archive/entries/month=YYYY-MM/<uuid>.parquet, one month of sort_at per folder, rows sorted by feed URL and sort_at, snappy-compressed; files are only added. Layout: server/src/adapters/archive-format.ts.
  • Columns: the entry's id (null for imported rows), feed URL and title, GUID, link, title, author, content, its plain text, language, published, source-updated, fetched, sort, and archived times, and enclosures.
  • AWS: the Glue table archive_entries in database <prefix>_<stage> projects partitions from the month folders; objects move to Intelligent-Tiering. Queries run in the <prefix>-<stage> Athena workgroup, results under athena-results/ (kept a day), at most 10 GB scanned per query.
  • Reads: an article is a feed URL and GUID; readers keep the copy archived last, and the database's copy of an article wins over the archive's. Order: newest sort_at first, then feed URL and GUID. Search matches the copy archived last: every word and phrase anywhere in the title or plain text and none of the negated ones, ignoring case and accents (in the database: the full-text index, stems included), with title:, author:, and dates; cold storage counts OR as AND. Past articles have no state, so operators asking for state (star:true, note:true, tag:, label:, and the like) match none, and their negations every one.
  • A user's archive of a feed is the entries of its source they do not hold (purged for them, or older than their subscription) plus archived rows with the feed's URL; only current subscribers reach it.
  • Restoring an article re-inserts the entry with its original id when that is free (else a new one) and its enclosures, unless the database still has it, then adds the user's entry, read, in its subscription, with the requested state. Sync picks it up through updated_at. A restored article that is not kept is purged, and archived, again.
  • Compaction (daily): each month before the current one with several files becomes one file, without duplicates, sorted as written; the files read are then deleted. Docker: DuckDB writes the file, at most 10 minutes per run. AWS: Athena UNLOADs the month to archive/staging/, from where it moves into the month folder, at most 3 minutes per run.
  • Docker reads the archive only from a local blob directory: with BLOB_BUCKET it is written but not read.

Fetching untrusted URLs (HttpFetcher):

  • http(s) only, at most 5 redirects, a 20 s timeout, and a 10 MB body limit (lower per request where less is needed); downloads stop once the limit is exceeded. Responses are decompressed.
  • Private, loopback, link-local, multicast, documentation, and IPv4-embedding IPv6 (NAT64, 6to4, Teredo) addresses are refused unless allowed by FETCH_ALLOW_PRIVATE_NETWORKS. The check runs on the resolved address at connect time, which also covers redirects and DNS rebinding.
  • Errors from subscribing and from fetching a page name the failure class (private network, HTTP status, too large, unreachable), never the network error text. A 401 says whether a login was sent (fetch_login_required, fetch_login_refused).
  • HTTP Basic credentials (UTF-8) go only to the origin of the URL fetched, never across a redirect to another origin.

Subscription lifecycle:

  • Subscribing normalises the URL. An existing feed source is reused without fetching. Otherwise the URL is fetched and must parse as a feed, or be an HTML page whose <link rel="alternate"> names exactly one feed; several feeds are returned for the user to choose.
  • Subscribing with HTTP Basic credentials (credentials on POST /subscriptions, API 1.12) always fetches with them and creates a source of the subscription's own; a feed a page names on another origin is refused (feed_login_elsewhere). A user has one subscription per URL, with credentials or without. PATCH tries new credentials before storing them (without password, the stored one); adding or removing them moves the subscription to a new own source or to the shared one, whose entries arrive as new, while its kept entries stay with no subscription. Subscriptions return authLogin, never the password. The web apps send credentials only while online, never through the offline outbox.
  • Subscribing to a new source ingests the response that validated it, so the feed is not fetched twice. OPML import creates sources and subscriptions only; their entries arrive with the first scheduled fetch. Subscribing to a source that already has entries delivers those within the purge window immediately.
  • Unsubscribing deletes the user's entries from that feed except kept ones, which stay with no subscription. Feed sources without subscriptions are left for purge.
  • OPML import counts feeds the user reads with credentials as already subscribed; the export lists their URLs only.
  • Deleting a category moves its feeds and child categories to its parent.
  • OPML import reuses categories with the same name and parent, and existing subscriptions, so re-importing is a no-op. It skips TTRSS's tt-rss-prefs, tt-rss-labels, and tt-rss-filters outlines. A file with more than 2,000 feeds and folders, or folders nested more than 10 deep, is refused before anything is written; the rest is written in a few statements, in one transaction. Feeds with addresses past /api/v1's length limit are listed as invalid; longer folder names and feed titles are cut.

Full text:

  • entry.extract jobs (one per feed source at a time) take the source's 20 newest entries not tried yet, newest first, and fetch each linked page through the per-host limits, unless the host is paused (HTML only, at most 5 MB). Readability (@mozilla/readability on linkedom) extracts the article, which is sanitised like feed content and stored in entries.full_content. Failures are recorded in full_content_error and not retried by jobs.
  • POST /api/v1/entries/:id/full-text extracts on demand, retrying earlier failures, and returns the stored text when there is one.
  • Readers see the full text first for subscriptions opted in to it, with a toggle back to the feed's content, and on request for others. TTRSS and Google Reader clients get it in place of the content for opted-in subscriptions. The original content is always kept, and search indexes it only.

Observability ​

SignalRecordedWhere
TracesRequests (span per route), jobs and scheduled tasks, pg-boss send/process, database queries inside a request or job, requests to remote hostsDocker: OTLP, when OTEL_EXPORTER_OTLP_ENDPOINT is set. AWS: X-Ray
Metricshttp.server.request.duration by route and status; rss.outbound.requests/.duration by purpose and outcome; rss.jobs.duration/.failures by job; rss.ops.alerts.active; pg-boss queue depth; pg pool; Node event loop, heap, GCOTLP
LogsPino lines carry trace_id and span_idstdout; also OTLP
Operations dataRollups and audit events belowPostgres; admin Operations page
  • The Docker image preloads server/src/telemetry/register.ts; without an OTLP endpoint no SDK module loads. The standard OTEL_* variables (sampler, export interval, per-signal exporters) apply. Service names are newses-<role>.
  • Telemetry never carries credentials, cookies, raw request URLs, feed URLs, or article content: request spans keep the route pattern, outbound spans the host. Database spans keep parameterised statements, never values. Remote hosts never receive trace headers.
  • Request logs keep the route pattern (unmatched without a route), and log lines above debug name hosts, not feed, page, or image URLs. With LOG_LEVEL debug or trace, request logs carry the URL and debug lines the addresses; parameters and query fields a route lists in logSecrets (published-feed keys, share ids, image signatures, icon tokens) are redacted at every level. COMPAT_TRACE logs compatibility-API parameters as clients send them.
  • pg-boss jobs continue the trace that queued them: pg-boss stores the W3C trace context on the job (no baggage). SQS carries it as a traceparent message attribute, and each Lambda invocation keeps its own trace, its job span linked to the queuing span.

Operations data (OpsRecorder counts in memory and adds to the tables every minute on Docker; on AWS at the end of each invocation that used the database, so the api function holds counts from database-free requests until its next such invocation and never wakes a paused database to write them):

TableGrainFeeds
user_activity_dailyUser, day, client (web, desktop, mobile from X-RSS-Client; greader, ttrss, public, other by path)Users tab; articles read come from user_entries.read_at
request_stats_hourlyHour, client, status classSummary, api.errors
host_fetch_stats_hourlyHour, host, purpose (feed, favicon, image, fulltext, subscribe, plugin), outcomeSites tab, host rules
job_stats_hourlyHour, job or taskJobs tab, jobs.failing
audit_eventsOne security event (the logSecurity events)Audit tab
ops_alerts, ops_stateOne alert episode per rule and subject; the last checkAlerts tab, stale-monitoring banner

Rollups and resolved alerts are pruned after OPS_RETENTION_DAYS, audit events after AUDIT_RETENTION_DAYS, with the 6-hourly purge.

ops.check (worker every 5 minutes; after each dispatch on AWS) evaluates the rules, opens and resolves alerts, and notifies on changes:

RuleSubjectSeverityFires when
host.rate_limitedHostWarningA 429, or 503 with Retry-After, in the current or previous hour
host.over_budgetHostWarningMore than OPS_HOST_HOURLY_BUDGET requests to the host in one hour
host.failingHostWarningHalf or more of ≥ 10 requests failed in 6 hours
jobs.failingJobCriticalMore than 20% of ≥ 5 runs failed in the current or previous hour
jobs.backlogQueueWarning100 or more jobs ready and waiting (pg-boss)
ingest.staleallCriticalEnabled feeds with an unpaused subscription overdue by more than 2 hours
api.errorsallCriticalMore than 5% of ≥ 20 API requests answered 5xx in the current or previous hour
plugin.disabledPluginWarningThe plugin was turned off for the instance after failing repeatedly, until an admin enables it
plugin.refusedPlugin (its id, else its package)WarningThe deployment installs a plugin the server would not load, with the registry's reason, until a deployment loads it or no longer installs it

User email ​

  • Every user mail comes from MAIL_FROM (default Newses <newses@host> on the PUBLIC_URL host, else localhost); a user's address only appears as Reply-To.
  • SMTP_URL (smtp:// or smtps://) turns user mail on, independent of alert email; ALERT_EMAIL_FROM defaults to MAIL_FROM. SMTP_URL and MAIL_SES_CONFIGURATION_SET exclude each other; the Docker image refuses SES, whose SDK only the functions bundle.
  • A user's address receives mail once confirmed: PUT /account/email keeps it pending and mails PUBLIC_URL/confirm-email#<token> (else the request's origin), whose page posts the token to POST /account/email/confirm after a click, without a session; the token's hash is kept for 24 hours, and a new request replaces it. Requests are limited per user (emailConfirm).
  • POST /entries/:id/email mails the user's entry (whole content, else its excerpt, with its link) to at most 5 addresses with an optional note; Reply-To is the sender's confirmed address, without which it is refused (email_unconfirmed). With the sender's proxyImages, images are signed proxy URLs on PUBLIC_URL. Limited per user (emailArticle).
  • Unread digest (digestFrequency daily or weekly, at digestHour on digestWeekday in timeZone, UTC when unset; the web app sets the device's zone when turning it on): digest.dispatch (every 5 minutes on Docker, after each dispatch on AWS) creates the state of users with digests on and none (after a restore), then claims at most 50 users whose digest is due (SKIP LOCKED, leased for an hour), the longest due first, and queues a digest.send job for each with its lease. The jobs send one digest at a time in the order queued: the worker one at a time, on AWS the digest function from <prefix>-<stage>-digest-send, one per invocation and at most 2 at once. A job sends only while the user's claim is still the one it was queued with, so a job delivered twice, or claimed again after its lease lapsed, sends nothing; one that fails is logged and not retried, and the user is claimed again once the lease lapses. Each gets their unread entries above the watermark shown in All (not hidden from All, not scored below scoreHideBelow), the newest 100 listed by category and feed with their excerpt, a link into the reader route and to the original, and the rest counted; with digestMarkRead, the listed ones are marked read. The watermark moves past every entry above it, read or not, once mailed or when none is unread; a failed mail or a user without a confirmed address keeps it. Changing a digest preference or the time zone sets the next due time, turning digests off deletes the state. Digests need mail and PUBLIC_URL (GET /server's digest) and are in the user's language.
  • Test digest: POST /account/digest/test (API 1.17, 3 a minute per user) is refused without digests (mail_unavailable), a confirmed address (email_unconfirmed), or an unread entry shown in All that came in over the last 24 hours (digest_test_empty); otherwise it answers 202 and queues a digest.send job for the test, sent as due digests are, behind those queued before it. One that fails is logged, not retried. The digest holds those entries, the newest 100 listed, with every digest.compose addition of the plugins on for the user (not counted toward turning them off) and, for each that added nothing, why; its subject and opening say it is a test, it has no unsubscribe link, and it leaves the user's digest state and the entries' read state as they were. In Settings → Plugins, a user's Send test of a plugin with digest.compose (Plugin.digests) asks for one once the plugin's own test passes, or at once without one.
  • Digest unsubscribe: PUBLIC_URL/public/unsubscribe/<user id>.<HMAC> (digest-unsubscribe key, so a restore onto another APP_SECRET invalidates old links). GET shows a page whose button posts back, POST (the page's, or the mail client's one-click with any body) turns digests off.
  • Mail sent on a schedule carries List-Unsubscribe and List-Unsubscribe-Post: List-Unsubscribe=One-Click (RFC 8058); SES receives raw MIME, so the headers are kept.

Plugins ​

  • @newses/plugin-api versions the contract apart from the app. While its major is 0, additions raise the patch and breaking changes the minor. A plugin's apiVersion is a caret range (^0.1, ^0.1.2) that must accept PLUGIN_API_VERSION.
  • The workspace package keeps no version and is private; plugin-api/src/publish.ts builds it to JavaScript and declarations in plugin-api/dist, as the public npm package versioned PLUGIN_API_VERSION with zod a peer dependency, and publishes it with --publish, refusing a version npm has. Its /testing entry is the test kit: runHook (runs a hook as the server does: the contract's version, settings parsed by the plugin's schemas, the hook's limit from EVENT_LIMITS or DIGEST_LIMITS, a digest result checked with digestAdditionsSchema), createTestContext (approved hosts only, redirects returned), MemoryStore (the stores' limits), and fixture entries.
  • definePlugin types each hook's context by the plugin's settings schemas (ContextOf); the runtime check is the registry's.
  • The installed plugins are INSTALLED_PLUGINS from #installed-plugins (server/package.json imports), which is server/src/plugins/installed.ts, none, in the repository. A deployment installs plugins when it builds, never while it runs: server/src/plugins/install.ts installs npm packages at exact versions (at most 20) into a folder under server/ with npm, without install scripts or peer dependencies, so plugins resolve the server's zod and @newses/plugin-api; refuses a plugin bringing its own copy of either; fails on high and critical advisories; and writes the list (installed.js, default imports) and plugins.json. Plugins' licences are checked with the build's (Third-party notices).
  • AWS: each stage's plugins in the deployment config; the deploy pipeline's synth runs pnpm --filter @newses/infra plugins:install after the checks, into server/.plugins/<stage>, and every function's bundle aliases #installed-plugins to that stage's list (infra/src/plugins.ts); synth refuses a stage whose installed list differs from its config. Docker: docker/compose.plugins.yaml builds newses-plugins:local from the app image (NEWSES_IMAGE) with PLUGINS installed into /app/server/.plugins, installed.ts re-exporting its list (--link), and the licences rewritten, for migrate, server, and worker; up -d --build applies a change. PLUGINS may also name plugins packed with npm pack as ./plugins/<file>.tgz, from a plugins folder beside the compose file that the build mounts, never copies into the image; the installer reads each one's name and version from its package.json, installs it as it does npm packages, and lists it by its path. AWS stages install from npm only.
  • Every process loads them once (loadPlugins: the server and worker, and each function at a cold start), records the ones refused (ops_state plugins.refused, for plugin.refused), writing each installed plugin's event hooks and user scope to its plugin_settings row (and none to plugins no longer installed) for the triggers; saving a plugin's instance settings writes them too.
  • The registry takes the installed plugins (source and default export) and refuses, with the reason, each one whose definition does not parse (id, semver version, scopes, lower-case hosts, known hooks only), whose apiVersion rejects this contract, or whose id an earlier plugin took. It logs what it loads and refuses, and never throws.
  • The runner runs one hook of one plugin under the hook's time limit, aborting the context's signal when it ends, and checks the result against the hook's output schema. A throw, timeout, or unusable result is a failure the caller skips. Each run has a span (rss.plugin.id, rss.plugin.hook, rss.plugin.outcome) and counts as job plugin:<id>:<hook> in the job statistics and metrics, so the Operations page and the failing-jobs alert cover plugins.
  • A hook runs only while the plugin is on for the instance and, with scope user, for the user it runs for, and while its saved settings parse with the installed version's schema; otherwise the runner skips it without counting a run.
  • A hook's context: the plugin's id, the hook's signal, the server's logger with every line tagged plugin, the instance settings and (for a user's run of a plugin with user settings) the user's, with secrets opened, its storage for the instance and (for a user's run) the user, and a standard fetch. That fetch reaches http(s) URLs on hosts approved for the plugin only, through PoliteFetcher.request (per-host limits of their own, 6 concurrent, ≥ 1 s apart, per process; the pauses of feed fetches, a 429, or 503 with Retry-After, pausing the host), with the address guard of HttpFetcher (FETCH_ALLOW_PRIVATE_NETWORKS) except for hosts in PLUGIN_TRUSTED_HOSTS (the operator's own services, such as a model server on the Docker network, which may resolve to private addresses), returning redirects instead of following them, ending with the hook's signal and no time limit of its own. Requests count in the per-host statistics as purpose plugin; refusals reject with a TypeError.
  • Settings (core/plugins, behind the PluginCatalog port the registry implements): a plugin's settings.instance and settings.user are zod object schemas, user settings only with scope user. secret() and url() mark top-level string fields, and feeds() top-level user settings holding subscription ids; a mark anywhere else refuses the plugin. Admins enable a plugin, set its instance settings, and approve its hosts (at most 50); users enable plugins with scope user and set their settings. A change replaces the plain fields; a secret given is set, given null cleared, left out kept. The result must parse with the schema whenever settings change or the scope is on, URL fields only on approved hosts, at most 64 KiB with sealed secrets. Views of settings name the secrets set, never their values. Rows outlast the plugin's removal until an admin removes them, with its storage; a user's go with the user.
  • Settings forms: the registry describes each scope's settings as JSON Schema (z.toJSONSchema, input side), each top-level property's marks as newses (secret, url, multiline, feeds, shownWhen), and secrets without their default. shownWhen names other top-level selects or checkboxes of the scope and values of theirs, which the registry checks; the form shows the setting only while each has one of them, and saves a hidden setting's value as it is. The web app edits text, multi-line text, URLs, secrets, booleans, selects, numbers, the user's feeds (picked from their subscriptions, one they left kept until saved), and lists of objects of the other kinds; a setting it cannot edit is sent back as saved. A plugin's messages are plain text per language tag (name, description, settings.<field>, .hint, .option.<value>, .item.<property>), shown in the reader's language, else its language without a region, else English, else the key.
  • Storage: per plugin for the instance, or per plugin and user; keys of 1 to 200 characters, JSON values of at most 64 KiB, at most 10,000 keys and 16 MiB per store (STORAGE_LIMITS, checked under a per-store advisory lock), optional expiry of at most 366 days. Expired values are ignored and deleted with the 6-hourly purge.
  • Failures: every counted run resets or adds to the plugin's failures in a row, a user's run of a plugin with user settings on the user's row, any other on the instance's, with how it failed and, for a throw, what it said (last_failure_detail: the error's message as plain text, at most 300 characters), which Settings → Plugins shows. The 10th in a row turns the plugin off there (disabled_reason failures); on the instance's that raises plugin.disabled. Enabling it again clears the count.
  • Tests ("Send test"): a plugin's test hook runs with the saved settings, for the user (a plugin with user settings) or the instance, while the plugin is on there, under 30 s, and reports { ok, message } (plain text, at most 500 characters). A test that throws, runs out of time, or reports otherwise fails, with what it threw. Tests are not jobs and never count toward turning a plugin off.
  • Event hooks (entries.added, published.changed) each declare a debounce window (debounceSeconds, 0 to 3600, default 0). Events are recorded in plugin_events, in the transaction that made the change, for each plugin on for the instance that implements the hook and, with user scope, is on for the user (plugin_listeners): entries.added by the fan-out for each subscriber's new user entries (fetched or backfilled), before filters run; published.changed by statement-level triggers on user_entries (rows inserted published, updates changing published, published rows deleted while their user remains), so every path counts: the APIs, sync, published pages, filters, and the TTRSS import.
  • Dispatch (PluginEventService.dispatch): a plugin, user, and hook's events become one delivery (plugin_deliveries, at most 500 entries, the last state of each) once the window since the first has passed. A due delivery is claimed with SKIP LOCKED for a 3-minute lease and run under a 60-second limit; one that fails is retried after 1, 4, 16, and 64 minutes, then 4 and 6 hours, then dropped and logged; one whose plugin is off, uninstalled, or no longer implements the hook is dropped. A lease that lapses (a crashed run) makes it due again, so deliveries arrive at least once. Each run counts as job plugin:<id>:<hook> (Jobs tab, jobs.failing) and toward the plugin's failures in a row.
  • Delivery reads the entries as the user sees them then. entries.added carries those the user still has, each with plain text (full text when extracted, 20,000 characters at most) and content hash; published.changed carries the entries now published, the ids of the others, and the published feed's URL (PUBLIC_URL/public/feeds/<key>, once the user has a key and the server PUBLIC_URL). An entry's feed is the user's subscription and title; a feed with a login has no URL, and pages have no feed.
  • digest.compose runs while a user's digest is sent, for each plugin implementing it that is on for the instance and, with user scope, for the user, all at once, each under 5 minutes. It gets the listed entries as events carry them (without text) with their excerpts and content hashes, the digest's language and frequency, the count left out, and the first 2,000 of those left out (unlisted), newest first, as listed entries are; it returns an overview (at most 4,000 characters), sections (plugin API 0.1.2), and text per entry id (at most 1,000 each). Sections are headings with points, as paragraphs or a list, each point citing entries by id; DIGEST_LIMITS bounds them. All are plain text: control characters other than line breaks are removed, cited ids the plugin was not given and text for ids the digest does not list are ignored, and a hook that throws, times out, or returns more adds nothing. Overviews and then sections open the digest under each plugin's name in the digest's language, each point followed by the titles of the entries it cites, linked into the web app; per-entry text follows the entry's excerpt; all escaped, in install order.
  • Actions (actions, at most 5, named as plugin ids are): buttons beside Send test (Plugin.actions), labelled by the plugin's messages action.<name> and action.<name>.hint, run as a test is (with the saved settings, for the user with user settings, else the instance, under 30 s, never counted) and reporting a TestResult. One with digest (only with user settings) is given what digest.compose would get for a test digest now; nothing is sent.
  • Docker runs dispatch in the worker every 30 s (25 s budget). AWS has nothing polling, so the database can pause: every function's counters notice (each change to a user's entries) queues a plugin.dispatch message on <prefix>-<stage>-plugin-dispatch, delayed until the next delivery is due, when events wait and the process has not queued one for then already. The plugin function runs dispatch (3-minute budget) for each message and queues the next; the tick dispatch catches up on any missed.

Data model ​

Shared rows are stored once per instance; per-user rows carry user_id. Every table synced to clients has updated_at and sync_xid (the id of the transaction that last wrote the row), maintained by database triggers. Statement-level triggers record deletions of categories, subscriptions, labels, and user entries as tombstones for incremental sync. Assigning or removing a label or tag touches the user entry, so sync carries its label ids and tags; tags copied at fan-out do not. A change to an entry's content hash (title, link, or content) or full text touches every subscriber's user entry; fetches that change neither, and failed extractions, do not.

EntityScopeNotes
usersInstanceLogin (unique), Argon2id hash, role (admin/user), disabled flag; sealed TOTP secret, enabled time, last accepted time step; confirmed email address and when; a pending address with its link token's hash and expiry
recovery_codesUserSHA-256 hash, used time
sessionsUserToken hash, kind (cookie/bearer/api), user agent, app password (api only), last seen, expiry
app_passwordsUserName, hash, last used
push_subscriptionsUser→ session (one each, deleted with it); push service endpoint (unique), device public key and auth secret, last delivery. Not synced
push_stateUserHighest user entry id pushed (watermark), whether entries wait for the window to end, last message time. Not synced
digest_stateUserHighest user entry id a digest covered (watermark), when the next is due, last digest time; only for users with digests on. Not synced
image_cacheInstanceBlob key, fetch time, size, failed flag, failures in a row
entry_imagesEntryImages (blob key, URL) of a kept entry's content version, which entry_image_sets records
user_prefsUserOne row per changed preference (JSON value); unset keys take the defaults in shared
categoriesUserSelf-referencing tree (parent_id), order
feed_sourcesSharedNormalised URL, unique among sources without credentials; fetch state (ETag, Last-Modified, next fetch, error count, last error with its reason and params, publisher TTL hint, capped hint, slowdown and successes since, blocked_until); interval in effect and its reason; site URL; favicon ref; HTTP Basic login and password, sealed (feed-credentials key, the source's id as context), on a source of one subscription's own that is never found by URL, shared, or archived. The pages source (newses:pages, disabled) holds pages from outside any feed; nobody can subscribe to it, and it is never fetched or purged
fetch_host_rulesInstanceHost (with port), admins' minimum interval, admin who set it. Not synced
subscriptionsUser→ feed source, category; title override, interval and purge overrides, full-text opt-in, paused, hidden from All. Unique (user, feed source)
entriesShared→ feed source; GUID, link, title, author, content, content hash, extracted full text (with attempt time and error), published/updated times, language, normalised feed categories, tsvector (generated, GIN index). Unique (feed source, GUID). A page is one user's own: GUID page: + SHA-256 of the user id and normalised URL; its feed title is the link's host
enclosuresShared→ entry; URL, MIME type, length, dimensions
user_entriesUser→ entry, subscription (nullable when archived) or archived feed; unread, starred, published, score, plain-text note (null when none), read time, share UUID. Unique (user, entry)
archived_feedsUserTitle and URL of an unsubscribed feed that still holds kept entries
labels / entry_labelsUserCaption (unique per user, case-insensitive), text and background colours (#rrggbb); many-to-many with user_entries
entry_tagsUser(user entry, tag) pairs; tags are lower-case, single-spaced, without commas, at most 64 characters and 50 per entry
themesUserName (unique per user, case-insensitive, at most 60 characters), built-in base key, partial tokens (JSON) over the base, shared flag; at most 50 per user. Not synced
filters / filter_rules / filter_actionsUserOrdered filters; match any/all, inverse, enabled; rules: field (title, content, title-or-content, author, link, tag), RE2 pattern, inverse, scope (subscription and category id arrays; empty for all feeds); actions: type with a label, tag, or score
access_keysUserSecret keys for published feed and generated feeds
plugin_settingsInstancePer plugin id, installed or not: enabled, settings (JSON), secret fields sealed (plugin-secrets key, plugin, scope, and field as context), approved hosts, failed runs in a row, last failure, why the server turned it off; the installed version's event hooks and user scope. Not synced
plugin_user_settingsUserThe same per plugin and user, without hosts. Not synced
plugin_events, plugin_deliveriesUserChanges waiting for a plugin's event hook (plugin, user, hook, user entry, published state), and the deliveries made of them (events, attempts, due time, lease). Not synced
plugin_storageInstance or userPlugins' key-value data: plugin id, user (null for the instance), key, JSON value and its size, expiry. Not synced
import_mapInstance(TTRSS table, source id) → new id and owning user; on user rows, when that user's last import finished

Key indexes:

  • user_entries (user_id, unread), partial indexes on starred and published.
  • user_entries (subscription_id, …) for feed views.
  • entries (feed_source_id, published_at DESC).

Headline lists use keyset pagination on (sort key, id). user_entries.sort_at is a denormalised copy of the entry's published time (fetch time when absent), so every headline view is served by one index. Descending index columns are NULLS LAST; queries order the same way so the indexes apply.

Search:

  • q is read by parseSearchQuery in shared, alike for headline lists, the archive, offline search, and TTRSS getHeadlines: TTRSS's operators filter the stream, and the rest is free text. Unknown operators and values are free text; operator keywords are English in every language.
  • title:, author:, and note: match a substring ignoring case; tag: a whole tag, normalised as tags are; label: a label's caption ignoring case. note:, unread:, star:, and pub: take true or false. A leading - negates any operator; values with spaces are quoted.
  • Dates (@YYYY-MM-DD, @today, @yesterday, @-Ndays, @-Nweeks) match the day of sort_at in the reader's time zone: timeZone (IANA) on GET /entries and GET /archive/entries, which the web app sends; UTC without it, as for the compatibility APIs.
  • Operators alone have nothing to rank by, so they list newest first.
  • A generated tsvector on entries (markup stripped, title weighted above content) holds each word folded (newses_simple: simple after unaccent), and again stemmed in the entry's language (newses_<language>: the Snowball stemmer after unaccent) when lang names one of SEARCH_LANGUAGES in shared, the stemmers PostgreSQL and the web app both have.
  • The free text keeps websearch_to_tsquery's meaning (quotes, OR, -), built term by term: a word or phrase matches folded, or stemmed in one of the reader's languages, those of their feeds (each subscription's newest entry) and of their app.
  • title:, author:, and note: fold accents too (unaccent).
  • The user's notes match too, folded, through a partial GIN index on to_tsvector('newses_simple', note); notes have no language, so they are not stemmed. Notes do not count towards the 20,000 below.
  • A query matching at most 20,000 entries instance-wide (counted from the GIN index) is resolved into a materialised set of the user's matches, then sorted. A more common one walks the headline index, where matches are dense.
  • Relevance order ranks (ts_rank) the 1,000 most recent matches and pages by offset.

Authentication ​

ClientCredentialNotes
WebhttpOnly, SameSite=Lax session cookieCSRF token on state-changing requests; TOTP at login when enabled
Electron / CapacitorBearer session tokenTOTP at login when enabled; stored in OS secure storage (Electron safeStorage, platform keystore on mobile)
TTRSS / Google Reader clientsApp password → api sessionApp passwords bypass TOTP
  • Session tokens are 256-bit random values stored as SHA-256 hashes. Cookie sessions last 30 days, bearer and api sessions 90 days, all sliding on use. Logging in ends the session the client sent, if any.
  • api sessions are opened only by an app-password login through a compatibility API and belong to that app password: revoking it ends them, and each keeps its 10 most recent.
  • The cookie is __Host-rss_session (Secure) over HTTPS and rss_session over plain HTTP; HTTPS is taken from X-Forwarded-Proto only when TRUST_PROXY trusts the proxy.
  • A user created with a generated password (the AWS bootstrap admin, users the TTRSS importer creates) has password_change_required until they change it, and the web app shows only the password change.
  • A generated password expires 7 days after it is set (password_expires_at). Past that, it no longer signs in: login answers 401 password_expired, counted as a failed login and logged as login_failed with that reason, and the user's sessions end. Changing or resetting the password clears both. On AWS, the migrate function's reissue-admin task gives the first admin a new generated password in SSM, and enables it, but only while no other admin is active.
  • The first admin's login may not contain admin, root, or superuser, nor be sa with only digits and separators besides (isReservedAdminLogin in shared). Bootstrapping into a database without users refuses one, and startup logs a security warning while an enabled admin has one.
  • Cookie-session requests other than GET/HEAD/OPTIONS must send the session's CSRF token in X-CSRF-Token. Login accepts JSON only, so cross-site form posts cannot log a browser in.
  • Failed logins are counted in login_attempts per account (lockout after 5) and per IP (after 20). Lockouts start at 1 s and double per further failure, up to 15 minutes. A wrong current password when changing it counts against the account. A lockout only delays further password, code, and app-password checks for that account or IP; signed-in sessions keep working, so an attacker can at worst hold off new sign-ins 15 minutes at a time.
  • Passwords are 8–1,024 characters and not on the bundled common-password list (the 10,000 most frequent of 8+ characters, shared/src/common-passwords.ts).
  • Logins, failures, lockouts, CSRF rejections, password changes, session revocations, and admin user changes are logged with a security field naming the event, and kept in audit_events with the account concerned, the acting admin, address, and user agent. The logger redacts credentials and auth headers.
  • TOTP (RFC 6238: SHA-1, 6 digits, 30 s, ±1 step) is optional per user. With it on, a correct password returns a signed 5-minute challenge instead of a session; POST /auth/login/2fa exchanges it with a TOTP code or one of 10 single-use recovery codes. A code from a time step at or before the last accepted one is refused. Code failures count against the account and IP like password failures.
  • Starting enrolment and turning 2FA off re-check the password; turning off and regenerating recovery codes need a code. Enabling 2FA signs out the user's other sessions. Admins (POST /admin/users/:id/2fa/reset) and cli user reset-2fa turn it off and sign the user out everywhere.
  • App passwords are 160-bit random values shown once (xxxx-xxxx-…; case and dashes ignored), stored as SHA-256 hashes, at most 50 per user. Creating one re-checks the account password. AuthService.authenticateAppPassword is the only check that accepts them: it skips TOTP, refuses account passwords, shares the login throttle, and records last use at most hourly. /auth/login never accepts them. An admin password reset revokes them; a disabled user's are refused.
  • Changing or resetting a password, or disabling a user, revokes their other sessions.
  • APP_SECRET (Docker env; SSM app-secret on AWS) is the root of per-purpose keys derived with HKDF-SHA256 (server/src/core/crypto.ts). Stored secrets are sealed with AES-256-GCM as v1.<iv>.<ciphertext>.<tag>, authenticated against their owning row; tokens are signed with HMAC-SHA256. A new secret voids every sealed value and signature; there is no rotation. cli reseal-secrets re-seals feed passwords, plugin secrets, and TOTP secrets sealed under another instance's secret, read from stdin, with this one; feed passwords and plugin secrets this secret opens already are left, so it can be run again.

Authorization ​

Function level:

SurfaceWho may call itEnforced by
Web app files, /healthz, GET /api/v1/server, GET /api/v1/openapi.jsonAnyone—
POST /api/v1/auth/login, POST /api/v1/auth/login/2faAnyone; the code step only with the challenge its login returnedLogin throttle; signed challenge
Other /api/v1/*A cookie or bearer session of an enabled user; api sessions are ignored. While password_change_required, only session, login, logout, and password change; others get 403 password_change_requiredregisterAuth and requireUser (server/src/api/auth.ts)
/api/v1/admin/*AdminsrequireAdmin
GET /api/v1/images/<hmac>/<url>Anyone with the signed addressImage URL signature
/favicons/<sha256>Anyone, for keys a feed source showsContent key
/feed-icons/<segment>/<id>.icoAnyone with the user's signed segment, for that user's subscriptions onlySegment signature
/public/feeds/<key>, /public/share/<uuid>Anyone with the key or share id, while the owner is enabled; else 404access_keys, user_entries.share_id
/public.phpAnyone; redirects only—
TTRSS /api/, Google Reader /accounts/ClientLogin and /reader/api/0/*Login: anyone, with an app password. Everything else: an api session from that loginserver/src/api/compat/common.ts

Disabling a user ends their sessions, and session checks refuse disabled users, so every row above requiring a session excludes them.

Data level:

  • A row with a user id belongs to that user. Services scope every read and write to the caller's id, so another user's rows answer 404.
  • Feed sources and entries are shared between subscribers. A user reaches them only through their own subscriptions and user entries, and never sees who else subscribes.
  • The archive of a feed is open to its current subscribers only.
  • Themes: every user reads shared ones; only the author changes, publishes, or deletes one; admins may unpublish anyone's.
  • A published feed or shared entry is readable by anyone holding its key or share id; only the owner regenerates the key or revokes the share.

Admins:

  • Manage users (create, change role, disable, delete, reset password or 2FA), set per-site minimum intervals, and unpublish themes. The last active admin cannot be demoted, disabled, or deleted.
  • See each user's login, role, status, last sign-in, and activity (requests by client, entries read) on the Operations page, per-site fetch statistics for all users together, and the audit log. They do not see other users' feeds, entries, notes, labels, filters, or preferences.
  • Can sign in as a user by resetting their password. The reset is audited, ends the user's sessions and app passwords, and stops the user's own password working, so it does not go unnoticed.
  • Operators with access to the database, the host, or the AWS account are outside these rules.

APIs ​

SurfacePathNotes
Native REST/api/v1/*OpenAPI at /api/v1/openapi.json: the input rules (types, required fields, lengths, ranges), generated from the shared Zod schemas; typed client in shared
Server info/api/v1/serverProduct, build, API version, instance name, and push key
Events/api/v1/eventsSSE: counters invalidation events
Images/api/v1/images/<hmac>/<url>Proxied entry images
Public/public/*Published feeds and share links
TTRSS-compatible/api/, /api/index.php (POST, op)See below
Icons/favicons/<sha256>Subscriptions' iconUrl; from the blob bucket through CloudFront on AWS
Feed icons/feed-icons/<user segment>/<id>.icoFor TTRSS clients and the apps (iconsPath); see below
Change markers/changes/<HMAC of the user id>AWS only (changesPath): from the blob bucket through CloudFront, never cached
Google Reader/accounts/ClientLogin, /reader/api/0/*; also under /api/greader.phpSee below

Native REST API ​

  • GET /server returns the product (newses; apps also accept the earlier rss-reader), the server build (NEWSES_VERSION: the commit on AWS, a Docker build argument, else dev), the API version (API_VERSION in shared), the instance name when the operator set one (INSTANCE_NAME; on AWS the stage's instanceName in the deployment config), where its source is (source, see Third-party notices), and the VAPID public key devices subscribe to push with (push.key, API 1.11), with the UnifiedPush distributor the operator offers readers (push.distributor, PUSH_DISTRIBUTOR_URL; the Docker ntfy profile sets it, and on AWS the stage's pushDistributorUrl), and whether users can add an email address, as user mail is configured (mail, API 1.14). A new major breaks existing apps; a new minor adds endpoints apps may require. Users who must change their password can still reach it.
  • Names, titles, notes, and addresses have one set of length limits (shared/src/limits.ts). The schemas check them, and the services check them again, so the compatibility APIs and OPML import hold to them too. Titles a feed gives itself are cut to the limit instead.
  • /api/v1 responses over 1 KB are compressed for clients that accept it (Brotli at quality 4, else gzip), except event streams and images. On AWS, CloudFront's API behaviour does not cache, so it forwards Accept-Encoding to the API and passes compressed responses through, and the Lambda adapter returns them base64-encoded, which keeps large sync and content pages under Lambda's 6 MB response limit.
  • CORS on /api/v1/* allows the app origins app://newses (Electron) and https://localhost (Capacitor Android): requests with Authorization and Content-Type, Retry-After exposed, preflights cached for a day. Credentials are never allowed, so apps use bearer tokens and cookie sessions stay same-origin. Other origins get no CORS headers. CORS is applied before authentication, so apps can read errors too.
  • Errors are { error, message }: a code and English text. Failures the web app shows, whose code does not say enough, add reason (ERROR_REASONS in shared) and its params. The web app shows the reason's text, else the code's, else message.
  • Entries are identified by user_entries.id. A headline list selects one stream: a subscription, a category (with subcategories; 0 is uncategorised), a label, a tag, or a special feed (all, fresh, starred, published, recentlyRead).
  • Fresh: unread entries with sort_at within the user's freshMaxAgeHours. Recently read: entries read within the last 7 days, in reading order.
  • All and Fresh, and a search or catch-up without a stream, leave out entries of subscriptions hidden from All (hideFromAll), as do their unread counts; the compatibility APIs' All, Fresh, and reading list follow them.
  • Scores are whole numbers within ±1,000,000, set with the entry's flags. Entries scored below the user's scoreHideBelow are left out of subscription, category, All, and Fresh lists and unread counts; Starred, Published, label, tag, and Recently read lists show them, and catch-up marks them read.
  • adaptive view resolves to unread when the stream has unread entries, else all; the cursor carries the resolved view.
  • State changes and catch-up publish counters; rows already in the requested state are not updated.
  • Compare-and-set (API 1.2), for changes sent late: PATCH /entries and PATCH /entries/:id take expect, the values the client saw; a flag changes only where it still has that value, and entries where it has neither that nor the target keep theirs and come back in conflicts with their values now. PATCH /entries/:id/labels and /tags add and remove (unknown labels ignored) and return the result. PUT /entries/:id/note with expected answers 409 conflict when the note is neither that nor the new text.
  • GET /archive/entries lists past articles of the user's feeds (one subscription, or all), with search (q) and a cursor; GET /archive/entries/:key returns one with content and enclosures; POST /archive/entries/:key/restore takes PATCH /entries/:id's body and returns the restored entry. Keys are opaque: the month of the article's sort time, its feed URL, and GUID.
  • POST /published-feed/pages (API 1.5) publishes a page from outside the user's feeds: an http(s) address, and optionally a title and plain-text text, which becomes paragraphs; all sanitised. A missing title or text is read from the page, fetched as full text is; a page that cannot be read is published all the same, titled with its address. The page is the user's own entry in the pages source, read and published, with no subscription. Publishing the same address again replaces what is given, reads the page again for what is not (keeping what was stored when it cannot), republishes it, and moves it to the top. Returns the entry.
  • POST /subscriptions/:id/debug (API 1.6) fetches a subscribed feed through the polite fetcher without validators and stores nothing: status, final and permanent URLs, headers without set-cookie, the body as text (first 256 KB), the parse result or error with any feeds an HTML page advertises, and up to 500 entries as ingest would store them, each with the user's enabled filters that would apply, in order up to one that stops. A paused host is reported, not asked; fetch failures say what failed without network detail.
  • API 1.7 adds lang to entries and archived entries, and lastErrorReason and lastErrorParams to subscriptions, which say lastError in the reader's language; apps fall back to lastError.
  • From API 1.8, appearanceTheme, themeAdjustments, and /themes take each built-in theme and style, and from API 1.10 each font, articleFont included, from the API minor recorded for it in shared.
  • GET /themes returns the user's themes and those others share, each with its author and whether it is the user's. Publishing sets shared; POST /admin/themes/:id/unpublish withdraws one, logged as theme_unpublished. Stored tokens a later version no longer accepts are left out of the response. The web app refetches the list when it regains focus, so authors' edits and withdrawn themes reach other users; a theme that no longer resolves shows Original.
  • GET /admin/sites/rules lists admins' minimum intervals per host; PUT /admin/sites/rules/:host (15 min to 7 days) and DELETE set and clear one, logged as site_interval_set and site_interval_cleared. A host is given with its port when not the default, as in feed URLs. GET /admin/ops/hosts shows each host's minimum.
  • Plugins (API 1.15, tests and failure details 1.16, digests and actions 1.17; GET /server's plugins says whether any is installed): GET /plugins lists every installed plugin to admins, with its source, instance settings, and status, and to others those on for the instance; each with its messages, settings forms, approved hosts, and the user's own settings for plugins with user scope, and for admins the ids of plugins no longer installed whose settings are kept. PATCH /admin/plugins/:id enables a plugin, sets its instance settings, and approves its hosts, logged as plugin_updated (setting names, never values); DELETE /admin/plugins/:id removes a plugin's settings, every user's, its storage, and its waiting events and deliveries, installed or not, logged as plugin_removed. PATCH /account/plugins/:id sets the user's settings of a plugin on for the instance, DELETE /account/plugins/:id removes them and the plugin's storage, events, and deliveries for the user. POST /account/plugins/:id/test tests a plugin with user settings with the user's, POST /admin/plugins/:id/test one without with the instance's, each at most 5 a minute per user; a plugin off there is refused (409 plugin_off). POST /account/plugins/:id/actions/:name and POST /admin/plugins/:id/actions/:name run an action as the test routes run a test (10 a minute per user); a digest action is refused without unread entries from the last day (digest_test_empty). No response carries a secret's value.
  • GET /sync returns categories, subscriptions, labels, and entries (without content) changed since a token, and deleted ids. Each call only covers changes below the oldest transaction id still in progress in the database, so rows committed late are never skipped and the clock plays no part. A first call takes every row, then the token carries on from that call's watermark. Entries page by (sync_xid, id); more asks for another call. Tokens from another copy of the instance (a new sync epoch, as after a restore), older than the 30-day tombstone retention, or unreadable get 410 resync_required; tokens from before sync_xid get the rows written before it by updated_at, then the rest. GET /sync/token returns a token at the watermark without walking history, for clients that load current state from the headline lists. Entries carry readAt and contentVersion, an opaque value that changes with the content hash or extracted full text.
  • POST /entries/contents takes up to 100 ids in priority order and returns each entry's stored content, full text, enclosures, and content version, with its images (those of the content, then image enclosures; at most 30) mapped to signed proxy paths whatever the user's proxyImages; ids the user does not hold come back as missing, and those past the size budget (never the first) as deferred.

Filters:

  • Patterns are RE2 syntax (re2js), matched case-insensitively and in linear time; patterns RE2 cannot compile are refused when saved.
  • content rules match the stored HTML; tag rules match each tag; a category scope includes its subcategories.
  • Enabled filters run in order on each user entry as it is delivered (fetch and new-subscription backfill), in the same transaction, until a stop action. Matching filters' actions combine: delete wins, scores add up within ±1,000,000, labels and tags accumulate (at most 50 tags).
  • POST /filters/test checks a draft against the user's 1,000 most recent entries and returns up to 50 matches. POST /filters/:id/apply runs one saved filter over existing entries, newest first, for at most 15 s per call, returning a cursor to continue; it never deletes kept entries (starred, published, noted, labelled, shared).

Events stream:

  • Events are per-user invalidation signals; clients refetch what they describe. Events of one type within 1 s are sent once.
  • X-Accel-Buffering: no disables nginx buffering; a comment line every 25 s keeps proxies from timing out; streams end after 30 minutes and clients reconnect, which re-checks the session.

Push:

  • PUT /push/subscription (API 1.11) takes the endpoint (https, at most 2,048 characters) and keys of PushSubscription.toJSON() as the calling session's one subscription; another session's with the same endpoint moves to it. DELETE removes it, as does the session ending (sign-out, revocation, expiry).
  • The VAPID key pair is derived from APP_SECRET (vapid); the contact it names to push services is PUBLIC_URL when it is https, else the project site.
  • Ingest pushes the unread entries a fetch delivered to users with subscriptions: one message per user per window of 27 minutes, so a 30-minute dispatch schedule pushes every cycle. Entries within a window wait for it to end and go out on the next flush (every 5 minutes on Docker, after each dispatch on AWS). A user's first subscription counts from then on; a new subscription's backfill, imports, and entries already read are not counted. With nothing to count, nothing is sent and the window stays as it was.
  • Messages are JSON, encrypted for the device (RFC 8291, aes128gcm) and signed (RFC 8292): count, up to 5 places (the category, else the feed, titles cut to 80 characters) with their counts, morePlaces, and target, the stream to open (the one feed, the one category, else /all). TTL 12 h, Topic: new-entries, Urgency: normal.
  • Requests to push services have the fetcher's private-address guard (FETCH_ALLOW_PRIVATE_NETWORKS), except for hosts in PUSH_TRUSTED_HOSTS (the operator's own distributor, which may resolve to the LAN), and a 10 s timeout; to hosts in PUSH_TOKENS (host=token pairs; on AWS the SecureString /<prefix>/<stage>/push-tokens when the stage sets pushTokens) they carry that ntfy access token as the auth parameter beside VAPID, for a ntfy that only lets users publish. They are counted in the outbound metrics with purpose push, not in per-host statistics. 404 and 410 delete the subscription; other failures are logged and the message is dropped.

Public pages ​

  • /public/share/<uuid>: a shared entry as a server-rendered HTML page. user_entries.share_id is a random UUID set when the user shares the entry and cleared when they revoke it. The page's text is in the viewer's Accept-Language, else its owner's language, else English, with Vary: Accept-Language; the not-found page skips the owner.
  • /public/feeds/<key>: RSS 2.0 of the user's 50 newest published entries, with content. The key is 32 random bytes (base64url) in access_keys, stored as is so the address can be shown again; regenerating replaces it. Its title and description, like the OPML export's title, are in the owner's language. It sets no <language>, which would claim one for the articles.
  • /public.php?op=rss&id=-2&key=<key> and /public.php?op=share&key=<uuid>, TTRSS's addresses for the same pages, redirect (301) to them; other public.php requests answer 404.
  • The share and feed pages answer 404 for unknown ids. Pages send their own CSP (no scripts, frames only from the sanitiser's video hosts), Referrer-Policy: no-referrer, and X-Robots-Tag: noindex.
  • Images go through the image proxy when the owner has it on. Feed URLs are absolute, from PUBLIC_URL, else the request's origin.
  • The feed carries a weak ETag over its items and answers If-None-Match with 304.

TTRSS-compatible API ​

  • Operations: login, logout, isLoggedIn, getApiLevel, getVersion, getConfig, getPref, getUnread, getCounters, getFeeds, getCategories, getFeedTree, getHeadlines, getArticle, updateArticle, catchupFeed, updateFeed, getLabels, setArticleLabel, subscribeToFeed, unsubscribeFeed, shareToPublished.
  • shareToPublished publishes url as POST /published-feed/pages does, with tags stripped from title and content (as TTRSS does), and title and content past the limits cut rather than refused.
  • Feed IDs are subscription IDs; special feed IDs:
    • -1 starred
    • -2 published
    • -3 fresh
    • -4 all
    • -6 recently read
    • 0 archived (empty)
  • Category IDs are category IDs; 0 uncategorised, -1 special feeds, -2 labels, -3 all feeds, -4 all feeds with special feeds and labels. Category streams include subcategories.
  • Labels are feed ID -1025 - label_id, in feed lists, counters, getLabels, setArticleLabel, and each headline's labels ([feed ID, caption, fg, bg]). A non-numeric feed_id names a tag.
  • getHeadlines pages by limit (at most 200) and skip; view_mode unread, adaptive, and marked (starred) apply, others list all; order_by=date_reverse lists oldest first; search uses full-text search, across all feeds with search_mode=all_feeds.
  • updateArticle fields: 0 starred, 1 published, 2 unread, 3 note (data); modes 0 clear, 1 set, 2 toggle.
  • subscribeToFeed codes: 0 already subscribed, 1 added (feed_id), 2 invalid URL or login, 3 no feed found, 4 several feeds found (feeds: URL → title), 5 fetch failed. login and password subscribe with HTTP Basic credentials.
  • getConfig (also config in the login answer) gives icons_url feed-icons/<user segment>: icons are served at /feed-icons/<segment>/<subscription id>.ico, the segment being the user ID signed with the feed-icons key.
  • Content goes through the image proxy for users who turned it on. getPref answers the TTRSS preferences that have an equivalent here and null for others, which are logged.
  • Requests are POSTs whose body is JSON, whatever its declared type, or form-encoded; query strings are ignored, so passwords never appear in logged URLs. sid is an api session token; login accepts app passwords only and reports API level 20.
  • Parameters are typed as TTRSS clients send them: numbers and booleans as JSON values or strings, id lists as arrays or comma-separated. Values past /api/v1's length limits answer INCORRECT_USAGE, or code 2 from subscribeToFeed.
  • Every answer is HTTP 200 {seq, status, content}, seq echoing the request. Errors have status 1 and content.error: NOT_LOGGED_IN, LOGIN_ERROR, API_DISABLED (password must be changed), UNKNOWN_METHOD (with method), INCORRECT_USAGE, FEED_NOT_FOUND.

Google Reader API ​

  • Auth: ClientLogin (POST form Email, Passwd; app passwords only) answers SID=…, LSID=null, Auth=… lines, or 401 Error=BadAuthentication. Calls send Authorization: GoogleLogin auth=<token>; without a valid api session they get 401, or 403 while the password must be changed. /reader/api/0/token issues the T write token, which writes accept unchecked: header authentication leaves no cross-site forgery to prevent.
  • Endpoints (JSON whatever output asks; writes answer OK; others 404):
    • user-info, subscription/list, subscription/edit (subscribe, unsubscribe, edit), subscription/quickadd, subscription/export (OPML)
    • tag/list, unread-count
    • stream/contents (stream in the path or s), stream/items/ids, stream/items/contents (i repeated)
    • edit-tag, rename-tag, disable-tag, mark-all-as-read
  • Item IDs are user_entries IDs: long form tag:google.com,2005:reader/item/<16 hex> in items, decimal in stream/items/ids; requests may use either, or bare 16-digit hex.
  • Streams (user/<id>/… is the same as user/-/…):
StreamSelects
user/-/state/com.google/reading-listAll
user/-/state/com.google/starredStarred
user/-/state/com.google/readAll, read only
user/-/state/com.google/broadcastPublished
user/-/label/<name>The folder with that name, else the tag
feed/<subscription id>That subscription; feed/<feed URL> also matches
  • Folders are categories, named by their path (Parent/Child); tags are labels. A label whose caption equals a folder's name is hidden from the API, and tagging items with a folder's name does nothing. Tagging with an unknown name creates the label; subscription/edit with an unknown folder creates a top-level category.
  • it/xt include or exclude the read and starred states (kept-unread counts as unread); ot and nt (seconds) bound the sort time, ot inclusive; r=o lists oldest first; c continues from a page's continuation.
  • Page sizes: stream/contents default 20, at most 1,000 and within the entry list's content budget; stream/items/ids default 1,000, at most 10,000; stream/items/contents at most 1,000 ids.
  • edit-tag adds and removes read, kept-unread (marks unread), starred, broadcast (published), and labels.
  • mark-all-as-read marks the stream read, with ts (microseconds) only entries delivered to the user by then.
  • Items carry categories with their states, folder, and tags; origin.streamId is the subscription; summary.content goes through the image proxy for users who turned it on. subscription/list gives iconUrl from the feed icon path, absolute from PUBLIC_URL or the request's origin.
  • quickadd subscribes to the first feed a page advertises.
  • Names, titles, and addresses past /api/v1's length limits answer 400; quickadd answers numResults: 0.

Both compatibility APIs log each unsupported call with the client's user agent. COMPAT_TRACE logs every call and its parameters, credentials redacted; it is on for the AWS dev stage.

The settings page shows apps' connection details from /api/v1/auth/app-passwords/connection: the server URL (PUBLIC_URL, else the request's origin) and the suggested sync interval, 60 minutes.

Deployment ​

Self-hosted ​

docker/compose.yaml:

ServiceImageNotes
dbpostgres:18-alpineNamed volume
migrateapp image, migrateRuns to completion before server/worker start
serverapp image, serverServes API and SPA, and the downloads volume at /downloads/ once compose.apps.yaml has built the apps; behind the user's reverse proxy for TLS; /healthz checks database and queue
workerapp image, workerJobs and scheduler; healthy while the feed dispatch, every minute, has written its heartbeat file within 3 minutes
backup (backup profile)postgres:18-alpineNightly pg_dump to a volume
dashboards (observability profile)app image, shOn each start, replaces the dashboards volume's contents with the image's copy of docker/observability/dashboards, so an upgrade or up -d --build refreshes them; lgtm waits for it
ntfy (ntfy profile)binwiederhier/ntfy, pinned by digestUnifiedPush distributor for the Android app at NTFY_HOST, its own hostname (it does not run under a path), published on NTFY_PORT (8081) or routed by compose.nginx-proxy.yaml; deny-all, with anyone allowed to publish to up* topics (write-only) unless NTFY_AUTH_ACCESS replaces that (*:up*:deny: only users given access, such as the server's with its token in PUSH_TOKENS), so reading needs a user given access; the web app off; users and cache in the ntfy volume. NTFY_HOST also sets the app containers' PUSH_DISTRIBUTOR_URL and PUSH_TRUSTED_HOSTS
lgtm (observability profile)grafana/otel-lgtmOTLP collector, Tempo, Loki, Prometheus, and Grafana on 127.0.0.1:3000, with the dashboards from the dashboards volume and their provisioning file from an inline Compose configs entry
  • No service mounts host files, so a release's compose file runs from a folder holding only it and .env; the project directory (docker/ in a checkout) holds .env, whose COMPOSE_PROFILES and COMPOSE_FILE name the stack's optional services and override files for every command run there. Inline configs need Docker Compose 2.23.1 or later.
  • docker/compose.apps.yaml (override, not published with releases, as it builds from a checkout): the apps service (apps profile, run with run --rm, built again on each run with pull_policy: build) on docker/apps.Dockerfile (Node on Debian, pinned by index digest, with JDK 21, the Android SDK, the command-line tools checked by SHA-256, 32-bit Wine for the NSIS installer, which electron-builder runs to write the uninstaller, and jsign, checked by SHA-256; linux/amd64 only, as the Android build tools are x86_64 only), built from the checkout with apps.Dockerfile.dockerignore, which leaves out installs, builds, .env files, and keystores. docker/apps-build.sh builds, for APPS_PLATFORMS (linux, windows, android; all three by default), the AppImage and deb with latest-linux.yml, the NSIS installer, block map, latest.yml, zip, and portable exe (one electron-builder run for both desktop platforms), and the signed APK, their SBOMs and the OpenAPI document, for RELEASE_TAG and PUBLIC_URL/downloads (https only), then runs publish.ts --platforms and publish-local.ts into the downloads volume. An install from a release's files runs it from a checkout with --env-file naming its .env, which gives the project name and so the volume. The keystore (base64), its passwords, and its alias are Compose secrets from .env variables (ANDROID_KEYSTORE_BASE64, ANDROID_KEYSTORE_PASSWORD, ANDROID_KEY_ALIAS, ANDROID_KEY_PASSWORD), read as files, never the container's environment; with any empty, Android stops the build. The Windows apps are signed off Windows with jsign (electron-builder.jsign.cjs, a sign hook given jsign's options in a file, SHA-256 with an RFC 3161 timestamp, replacing any signature) from a .pfx (WIN_CERTIFICATE_BASE64, WIN_CERTIFICATE_PASSWORD; DigiCert's timestamp server) or Artifact Signing (AZURE_CLIENT_SECRET, with AZURE_TENANT_ID, AZURE_CLIENT_ID, and the WIN_SIGNING_* values as environment; Microsoft's timestamp server), whichever is set, both refused; the secrets are Compose secrets, which jsign reads from files (file:). Signing needs WIN_PUBLISHER_NAME, checked against a .pfx's CN and written into the app's feed config; with neither, the Windows apps are unsigned and update by the downloads page. Compose needs every secret's variable in .env, even empty. Gradle and the Electron downloads cache in apps-gradle and apps-cache.
  • server mounts the downloads volume read-only as DOWNLOADS_DIR; the image creates /data/downloads owned by node, so the volume is writable by the apps build, which runs as node too.
  • With DOWNLOADS_DIR, the server serves it at /downloads/ with the downloads layout's headers (below), the page with its CSP; /downloads redirects there, and a missing file is a 404, never the SPA. publish-local.ts copies the versioned files first, then renames the feeds, latest.json, and index.html into place, and deletes the folder of the prerelease it replaces.
  • App image (docker/Dockerfile): Node on Alpine, pinned by index digest, for linux/amd64 and linux/arm64. OCI labels come from the build arguments NEWSES_VERSION, NEWSES_REVISION (commit), and NEWSES_SOURCE (repository URL); the web build runs on the builder's platform. It installs only the server's dependencies: the packages only the Lambdas load (the Athena, SNS, SQS, and SSM clients, @fastify/aws-lambda) are devDependencies, imported only under entrypoints/lambda (lint-enforced).

AWS ​

flowchart LR
  U[Browser / apps] --> CF[CloudFront]
  CF -- default --> S3W[(S3: SPA)]
  CF -- "/downloads, /downloads/*" --> S3D[(S3: downloads)]
  CF -- "/favicons/*" --> S3B
  CF -- "/api, /api/*, /reader/*, /accounts/*, /feed-icons/*, /public/*, /public.php" --> API[HTTP API] --> FA[λ api]
  EB[EventBridge Scheduler] --> FT[λ tick]
  FT --> QF[[SQS fetch]] --> FF[λ fetch]
  FF --> QI[[SQS favicon]] --> FI[λ favicon]
  FA & FF --> QX[[SQS extract]] --> FX[λ extract]
  FA & FF & FT --> QP[[SQS plugin-dispatch]] --> FP[λ plugin]
  FA & FT --> QD[[SQS digest-send]] --> FD[λ digest]
  FA & FT & FF & FI & FX & FP & FD --> DB[(RDS PostgreSQL, shared by stages)]
  FA & FT & FF & FI --> S3B[(S3: blobs)]
  FA & FT --> ATH[Athena + Glue: archive] --> S3B
  FA & FF & FI & FX & FP & FD --> NET((Internet feeds))
  • Stacks per stage: Params (generated credentials), Data (blob bucket, archive catalog), App (functions, HTTP API, queues with dead-letter queues, schedules, migrate trigger, alert topic), Edge (CloudFront, SPA and downloads buckets, DNS records), Release (the release pipeline), all in the deployment's region. Both pipelines also deploy the shared <prefix>-db-params and <prefix>-db stacks (VPC with public subnets only, the database instance) before their stage, and the shared <prefix>-budget stack alongside it; both produce the same resources, without construct-path metadata, and a test holds them equal. The pipelines deploy each stack in one action, without change sets; Release deploys alongside Params and Data. CloudFront uses an existing certificate in us-east-1 covering every stage's domain, imported by ARN; DNS records go in an existing Route 53 zone that each stage's domain is directly under.
  • Names: stacks are <prefix>-<stage>-{params,data,app,edge,release,pipeline}, <prefix>-db-params, <prefix>-db, and <prefix>-budget, and resources with settable names use <prefix>-<stage>-<role> (functions, log groups, queues, schedules, HTTP API, CloudFront function and policies) or, when shared, <prefix>-db. Bucket names are generated from the stack name, except <prefix>-<stage>-downloads-<account>, which the release pipeline is granted by name. Everything is tagged project=<prefix>, and everything but the shared stacks stage=<stage>.
  • Functions run outside any VPC, so they reach feeds without NAT. The database is one RDS PostgreSQL 18 db.t4g.micro instance, <prefix>-db:
    • Single-AZ, 20 GB gp3 that can grow to 50 GB, 14-day backups, deletion protection, and a final snapshot on removal.
    • Publicly reachable on 5432, with TLS required (rds.force_ssl); its address is in the String parameter /<prefix>/db/endpoint.
    • Each stage has a database and login role <prefix>_<stage>, which owns it. PUBLIC has no CONNECT on it, so stages cannot reach each other's data.
    • The migrate function creates or updates the role and database as the master user rss_admin (password in /<prefix>/db/master-password, generated by <prefix>-db-params, which deploys first because CloudFormation resolves ssm-secure references when a deployment starts) before migrating.
  • Dispatch runs every 30 minutes, so a feed is checked at most that often, whatever its interval; purge (every 6 h), auth prune (hourly), and archive compaction (daily, 04:00 UTC) fall on dispatch times. One fetch invocation handles one host's batch; at most 8 run at once.
  • CloudFront adds a secret x-origin-verify header to API requests; the API refuses requests without it.
  • CloudFront does not forward the viewer's Host, so functions get PUBLIC_URL set to the stage's domain.
  • /api/v1/images/* is cached at the edge (managed CachingOptimized policy: no cookies or viewer headers in the key, TTL from the API's Cache-Control); other API paths are not cached.
  • /favicons/* comes from the blob bucket through its own Origin Access Control, with no function involved; the Data stack's bucket policy lets the account's distributions read only favicons/*. The edge keeps icons a year, and a response headers policy sets their Cache-Control (S3 stores none) and sandboxing CSP.
  • Generated credentials are Standard SSM parameters under /<prefix>/<stage>/, created once by a custom resource in Params and deleted with it; Params deploys before App, whose functions read them: db-password (the stage role's), admin-password, and app-secret (SecureString), origin-header (String, because CloudFront resolves only String parameters). TRUST_PROXY is two hops (API Gateway appends CloudFront's address after the viewer's).
  • The SPA bucket is private, accessed via Origin Access Control. assets/ is cached as immutable; other files are revalidated, and each deployment invalidates the distribution.
  • The downloads bucket is private behind its own Origin Access Control, written only by the release pipeline (kept with the stack when the stage retains data). /downloads redirects to /downloads/, and folder paths serve index.html; the page has its own CSP (no scripts). Pages on the stage's downloadsCorsOrigins (the project site) may fetch the downloads cross-origin (GET and HEAD).
  • Logs go to CloudWatch, kept a month. No CloudWatch metrics, alarms, or dashboards; the Operations page reports, and ops.check runs after each dispatch.
  • Tracing: functions run the ADOT layer (adotLayerArn in the deployment config) when the stage's traceSampling is above 0. The SDK samples that share of traces by trace id (traceidratio) and sends spans to X-Ray through Lambda's local endpoint; Lambda active tracing (not needed for these spans), Application Signals, and X-Ray Transaction Search are off. Only the aws-lambda and aws-sdk instrumentations run; undici is never instrumented, so feed requests carry no trace headers. Only our spans and AWS SDK calls are recorded: functions are bundled, so pg is not instrumented. Service names are <prefix>-<function>.
  • Alerts: tick publishes alert changes to the SNS topic <prefix>-<stage>-alerts; email subscriptions are added outside the stack (see AGENTS.md), so addresses stay out of the repository.
  • User mail: with the stage's mail option, the app stack makes the stage domain an SES identity (Easy DKIM records, MAIL FROM bounce.<domain> with its MX and SPF records, in the hosted zone) and the configuration set <prefix>-<stage>-mail, which suppresses addresses that bounced or complained. Only api and digest may send (ses:SendEmail on the identity, the configuration set, and email-address identities, which the SES sandbox also checks for recipients); they and tick, which queues digests only with mail, get MAIL_SES_CONFIGURATION_SET; mail comes from newses@<domain>. A new account is in the SES sandbox, which delivers only to verified addresses until production access is granted (see AGENTS.md).
  • Pipeline results: the stage's pipeline stack owns the SNS topic <prefix>-<stage>-pipelines; CodeStar Notifications rules send each succeeded or failed run of the stage's deploy and release pipelines to it. Email subscriptions are added the same way as for alerts.
  • Budget: the <prefix>-budget stack holds one monthly AWS Budget (budgetUsd in the deployment config) over running the project: everything tagged project=<prefix>, both stages, except the CodeBuild and CodePipeline services. Whichever pipeline runs first creates it; later runs change nothing, and removing a stage leaves it in place. It notifies its own topic, <prefix>-budget, at 80% and 100% of actual spend and 100% of forecast. It counts only once the project cost-allocation tag is active, which only the paying account (an organization's management account) can do. Untaggable charges (X-Ray, tax) fall outside it.
  • Web traffic is same-origin through CloudFront. The API behaviour forwards Origin and OPTIONS, so the apps' CORS preflights reach the API; the pipeline smoke test sends one.

Constraints:

  • Responses are capped at 6 MB; list pages with content, and contents batches, end early past 2 MB of content and full text (UTF-8).
  • No SSE. Each counters event rewrites the user's change marker, changes/<HMAC of the user id> (changes key) in the blob bucket, with new text (one more write for events during one in flight). Login and session responses give its path as changesPath (API 1.11). Open apps poll it every 60 s while visible (hidden desktop apps with notifications on: every 30 min) through CloudFront's /changes/* behaviour, never cached and answered by S3, so polls reach neither Lambda nor the database; counters are fetched only when its text changed. Apps open no event stream then. Responses are no-cache, revalidated by the browser, and readable from the apps' origins (Access-Control-Allow-Origin: *); the path needs no session. Before a first event S3 answers 403, read as no marker yet.

Releases ​

A version tag releases the apps, and the server image when the stage has an imageRepository, to one stage: prerelease tags (v1.2.3-rc.1) to dev, other v* tags to prod. The version comes from the tag only.

StageRuns
SourceThe tagged commit, over the GitHub connection. Runs without a tag (creation, a manual release) skip the next stages.
BuildIn parallel: Linux x64 (release-linux.yml: AppImage, deb, latest-linux.yml, signed APK, desktop and mobile SBOMs, the OpenAPI document; installs the Android SDK and JDK 21) and Windows Server 2022 (release-windows.yml: Node 24 by download, the Artifact Signing client tools, signed NSIS installer, block map, latest.yml, zip of the signed app, signed portable exe). With an image repository, also the image legs (release-image.yml, privileged): x64 and ARM each build the server image natively with buildx and push it by digest alone, without provenance attestations; the x64 leg adds the image SBOM, from syft on the pushed image. Each hands exactly its files to a scratch bucket (7-day lifecycle) under releases/<tag>/, the image legs their digests as image-<arch>.digest.
Publishrelease-publish.yml: checks the full set, adds the installers' URLs and hashes to the SBOMs, adds the server's files with the image, writes SHA256SUMS, the feeds, latest.json, and index.html, pushes and signs the image's version tag, uploads to the downloads bucket, HEAD-checks every URL, moves the image's other tags, then tags the prerelease it replaced superseded=true.
  • Downloads layout: downloads/<version>/<file> (immutable; installers download as attachments, .apk as application/vnd.android.package-archive, SBOMs newses-<version>-{desktop,mobile,image}.cdx.json inline as application/vnd.cyclonedx+json, the apps' naming the installers they describe by URL and SHA-256, newses-<version>-openapi.json inline as application/vnd.oai.openapi+json, the release's /api/v1/openapi.json built without a database, with the image the server's files inline, and SHA256SUMS for every versioned file); downloads/latest.yml, latest-linux.yml (electron-updater, pointing into the version folder), latest.json (ReleaseManifest in @newses/shared/release: each platform's installers when the release built them, all three on AWS and those asked for on Docker, with only their feeds, SBOMs, and page sections; server when the stage publishes the image), and index.html (no-cache; per file its SHA-256 and commands to download, check, and install it, as no scripts run on the page).
  • Server files, from docker/: newses-<version>-compose.yaml, compose.yaml without build: and with the image pinned as <repository>:<version>@<digest>, still overridable with NEWSES_IMAGE; newses-<version>-env.example, .env.example as is; newses-<version>-compose.nginx-proxy.yaml, the nginx-proxy override as is; newses-<version>-compose.plugins.yaml, the plugins override building from the pinned image, still overridable with NEWSES_IMAGE; newses-<version>-cosign.pub, the image's signing key. The page's commands save them as compose.yaml, .env, compose.nginx-proxy.yaml, compose.plugins.yaml, and cosign.pub.
  • Superseded prereleases expire 30 days after upload; prod releases are kept.
  • Server image: publish-image.ts join --dry-run gives the digest the legs' digests join into, which the compose file pins; once the files are written, join pushes the multi-arch image under the version's tag (X.Y.Z, X.Y.Z-rc.N), must give that digest, and signs it once with cosign and the KMS key alias/<prefix>-image-signing, recorded in Rekor and stored under the tag sha256-<digest>.sig; after the URL check, tag moves the floating tags to it (infra/src/release/image.ts): a release moves X.Y, X, and latest when it is the newest release each covers; a prerelease moves next and deletes every other prerelease tag with its images and signature. A version's tag never moves: publishing it again must join the same images, so a failed publish is retried with the build legs' files, and a rebuild is a new version. The build stage pulls the Node base from ECR Public's mirror of Docker Hub's official images, at the Dockerfile's digest; BuildKit and the Dockerfile frontend come from Docker Hub.
  • Release builds embed the stage's /downloads URL (on Docker, PUBLIC_URL/downloads): desktop as electron-updater's generic feed (electron-builder.release.cjs, no update channels), Android as DOWNLOADS_URL in the bridge.
  • Signing material is SecureString parameters under /<prefix>/release/windows-signing/ and /<prefix>/release/android-signing/, shared by both stages and written by scripts/windows-signing-setup.sh and scripts/android-signing-setup.sh. Each build project reads only its own platform's parameters, as project environment variables; only the publish project writes the downloads bucket, and only its stage's. The image legs push to the stage's image repository; only the publish project also tags and deletes there, and signs with the image signing key, which it is granted by its alias.
  • scripts/try-release.sh runs the dev legs on the working tree under a made-up prerelease tag, with a dry-run publish unless --publish; the dry run deletes the images the image legs pushed.

Deployment config:

  • The account-specific values live in infra/deploy.config.json, never committed; infra/deploy.config.example.json shows the shape, validated by infra/src/deploy-config.ts: resourcePrefix (<prefix> in this section: the start of every physical name, tag, and parameter path, with _ for - in database names; the example's is newses), account, region, GitHub repository and CodeConnections connection, certificate, hosted zone, ADOT layer, budget, and the stages (dev and/or prod: branch, release tags, domain, data retention, backups, compatibility trace, archive, trace sampling, downloads CORS origins, server image repository, the UnifiedPush distributor readers are offered, whether the functions read push tokens, plugins).
  • The pipelines' synth step writes that file from the String parameter /<prefix>/deploy-config; a change to it takes effect on each pipeline's next run, which store-deploy-config.sh --release STAGE starts. Tests synthesise against the example.
  • Scripts that act on a stage (reset-stage.sh, freeze-stage.sh, try-release.sh, import-ttrss.sh --aws, export-instance.sh --aws, restore-instance.sh --aws, the signing setups with --ssm, image-registry-setup.sh) read the region, domains, and account from the same file.

Operator setup, once per account:

  • Prerequisites: a CodeConnections connection to the GitHub repository, an ACM certificate in us-east-1 for the stages' domains, and the Route 53 hosted zone.
  • In an organization's member account, Budgets works only after the management account has launched Cost Explorer (console only) and allows member accounts access in Cost Management preferences; until then the <prefix>-budget stack fails. The management account's IAM roles reach these pages only once its root user activates IAM access to Billing information.
  • infra/deploy.config.json from the example, then stored as the parameter (AGENTS.md).
  • pnpm --filter @newses/infra cdk bootstrap aws://<account>/<region>
  • pnpm --filter @newses/infra cdk deploy <prefix>-dev-pipeline (and <prefix>-prod-pipeline); a new pipeline runs once on creation, and later changes deploy through it, release stacks included.
  • In the paying account's Billing console (or aws ce update-cost-allocation-tags-status), the project cost-allocation tag activated once it appears, up to 24 h after the first deployment.
  • The signing parameters, before the first release: scripts/windows-signing-setup.sh --ssm and scripts/android-signing-setup.sh --backup DIR --ssm.
  • The server image repository, before the first release that publishes the image: scripts/image-registry-setup.sh creates the ECR Public repository (in us-east-1) with its gallery listing and prints its URI for the stages' imageRepository, and creates the image signing key (ECDSA P-256, in the deployment's region) and prints its public key. A custom registry alias, claimed in the ECR Public console, gives the repository a second URI; the default alias's keeps working.
  • The first admin is the deploy config's adminLogin, with a generated password in the SSM SecureString /<prefix>/<stage>/admin-password that must be changed at first sign-in. If it expires first, reissue-admin (AGENTS.md) replaces it.

Moving an instance ​

scripts/export-instance.sh writes a bundle that scripts/restore-instance.sh loads into another instance, replacing its data; either end is a Docker install or an AWS stage.

  • The scripts, and import-ttrss.sh, act on the Docker install whose compose files --compose (repeatable) or COMPOSE_FILE names, else the checkout's docker/compose.yaml; its .env, project name, and image come with it (scripts/lib/docker-stack.sh). They warn when the install's image is a release other than the checkout's commit, and give commands for the install in use.
Bundle fileContents
manifestkey=value lines: format (1), source, export time, whether blobs are archive only, user, subscription, entry, and blob counts; written last, so a bundle without it is incomplete
db.dumppg_dump -Fc --no-owner --no-acl, without the pgboss schema or the rows of sessions, push_subscriptions, push_state, digest_state, login_attempts, rate_limits, the hourly stats, ops_alerts, and ops_state
migrationsThe source's applied migration hashes
blobs/LocalBlobStore layout (data files, content types under .meta/); cli blobs pull|push DIR copies it from and to S3
app-secretThe source's APP_SECRET, for re-sealing only
  • The bundle directory is mode 0700 and holds password hashes and the source's secret.
  • The database is dumped before blobs are copied: purge archives entries before deleting them, so a running source can at worst leave an entry both live and archived.
  • A restore is refused unless the target has applied every migration in migrations; the target's newer ones run after the restore (migrate).
  • The restore stops the target, then drops drizzle, pgboss, and public and restores the dump in one transaction, committed only once the whole dump was read; it then migrates, runs cli reseal-secrets, empties and refills the blob store, purges AWS job queues, and starts the target. The target keeps its APP_SECRET, configuration, and SSM parameters.
  • Ids are unchanged, so share links, access keys, and app passwords stay valid; sessions end, and the sync epoch is new, so apps sync from scratch; image-proxy and feed-icon signatures are made again with the target's keys.
  • Freezing an AWS stage (freeze-stage.sh, export-instance.sh --freeze, and every restore) sets the reserved concurrency of api and tick to 0 and disables the event source mappings of fetch, favicon, extract, plugin, and digest, so jobs wait in their queues rather than fail into the dead-letter queues; unfreezing removes the reserved concurrency and enables the mappings. Docker's equivalent stops server and worker.

SBOMs ​

CycloneDX 1.6, one per deliverable, composed by infra/src/release/build-sbom.ts (scripts/sbom.sh locally) as newses-<version>-<deliverable>.cdx.json:

DeliverableContentsSource
serverServer dependencies (Lambdas and Docker), and the Lambda-only devDependencies with their dependencies; with --plugins STAGE, the stage's installed pluginspnpm sbom --prod, and pnpm sbom selected; npm sbom in server/.plugins/<stage>
imageDocker image: Alpine packages, Node, node_modulessyft on the built image (released: the linux/amd64 one)
webWeb app dependenciespnpm sbom --prod
desktopWeb app, Electron, electron-updater and its dependenciespnpm sbom, selected (the main process is bundled, so all are devDependencies)
mobileWeb app, Capacitor packages, the APK's release runtime classpathpnpm sbom --prod, CycloneDX Gradle plugin (:app:cyclonedxDirectBom)
  • Workspace packages (@newses/* at 0.0.0) and Gradle projects are first party and left out; the root component is newses-<deliverable>, linked to the repository URL in the root package.json.
  • The release pipeline publishes the desktop and mobile SBOMs, and the image's when the stage publishes the image; the others are made locally.
  • Dependency-Track is an external server; uploads run locally (PUT /api/v1/bom, auto-creating the project). Project newses-<deliverable>, version the release's or, untagged, the branch's; tags newses and prod (release), dev (prerelease), or local (untagged); tagged uploads become the latest version. The API key needs BOM_UPLOAD, PROJECT_CREATION_UPLOAD, and VIEW_PORTFOLIO.

Third-party notices ​

What each build bundles, as { name, version, license, text, notice, url } entries (shared/src/third-party-licenses.ts), shown in the About tab with the acknowledgements in shared/src/credits.ts:

BuildFileFrom
Web (both modes)third-party-licenses.json beside index.html, precachedRollup chunks and assets of the app and service worker builds (web/vite.config.ts)
Desktopthird-party-licenses-platform.json beside the web buildesbuild metafile of the main and preload bundles, and Electron; Electron's LICENSE.electron.txt and LICENSES.chromium.html sit beside the executable
Androidthird-party-licenses-platform.json beside the web buildesbuild metafile of the bridge, the plugin packages, and, with an APK, the release classpath's CycloneDX SBOM (texts linked, not shipped)
Serverthird-party-licenses.json beside server/src/licenses.ts (Docker) or the Lambda handlerDocker: installed node_modules, and the plugins' with compose.plugins.yaml; AWS: esbuild metafile (plugins included) and the installed argon2
  • Each build fails on a package whose licence is outside ALLOWED_LICENSES (AGPL-compatible) or unknown; pnpm check checks the production dependencies of server, web, mobile, and shared the same way.
  • GET /server/licenses returns the server's to signed-in users, 404 where the build wrote none (development).
  • source in GET /server: SOURCE_URL (Docker), the stage's sourceUrl (AWS), else the root package.json repository at the release tag (/tree/v1.2.3) or commit (/tree/<sha>), or the repository itself for other builds.

Project site ​

  • The landing page, user guides, contributor pages, and download page are a VitePress site in newses-app/newses.app, with its own CDK app and pipeline, in this deployment's AWS account but in separate stacks. This repository's builds, image, and stacks never reference it.
  • Domains: newses.app (www.newses.app redirects to it) and dev.newses.app (not indexed), both under the newses.app hosted zone and certificate. No analytics or cookies.
  • The site's dev and main branches build from this repository's matching branch, reading docs/architecture.md, docs/adr/, and AGENTS.md at build time and publishing them under /contributing/; requirements.md is not published.
  • /download and the self-hosting guides read the matching app stage's /downloads/latest.json in the browser, and the guides the server's files it names, so a release needs no site rebuild.

Released under the AGPL-3.0-or-later license.