Skip to content
Infrastructure of Meaning

Developer Documentation

The architecture and design choices behind Arc Codex.

Flask + Next.js 16.1.6Redis + SolrLocal + cloud inferenceAuth.js v5 Beta
I

Stack Overview

Backend
Python / Flask / gunicorn
Frontend
Next.js 16.1.6 / React 19 / TypeScript
Database
Redis (in-memory)
Library DB
SQLite (public-domain book corpus)
Search
Apache Solr (full-text)
AI Inference
Ollama — local model + cloud escalation
Auth
Auth.js v5 beta — Google + GitHub OAuth, JWT sessions
Proxy
Caddy (automatic TLS via Let's Encrypt)
Process Mgr
arc.sh + systemd (auto-starts on boot)
II

Services & Supervision

The stack is managed by a single control script and auto-starts on boot. A watchdog supervises the services at runtime and restarts any that crash, distinguishing a deliberately-stopped service from a failed one.

What runs: RSS ingestion and the full A.R.C. analysis pipeline (the Scribe); on-demand and manual publishing of user submissions; background analysis workers; automated posting to Bluesky, Mastodon, and Facebook (each toggleable at runtime with no restart); an email digest; and the Next.js frontend.

Posting is fail-safe, not fire-and-forget: the posters track which articles they have published separately, so a mid-publish failure re-tries on the next cycle rather than double-posting or silently dropping.

III

Reverse Proxy

A Caddy reverse proxy terminates TLS and routes requests: authentication and user-preference calls are handled by the Next.js application server, and the remaining API traffic goes to the Flask backend. Everything else renders from Next.js. Automatic certificate management is handled by Caddy.

IV

Public API

Arc Codex exposes a read-only public HTTP API over the same domain. It serves the article feed, individual articles with their full analysis, full-text search, an RSS feed, the wiki directive pages, the public-domain library, and the machine-readable sitemap. Signed-in users can additionally submit content for processing and manage their own preferences.

Machine-readable discovery surfaces — /rss.xml, /sitemap.xml,/news-sitemap.xml, and /opensearch.xml — are published and kept current automatically.

V

Data Model

Live application data is held in Redis for speed; the public-domain book corpus behind the Library lives in SQLite; and full-text search is served from Solr. At a conceptual level the system stores:

Articlesexpand
Each article carries its source text, metadata, editorial directive, a reading-difficulty score, the three A.R.C. analyses, and an AI-content verdict. Articles are typed as either rolling news or durable reference content.
Comments & reactionsexpand
Reader comments and per-comment reaction counts. The adversarial Counter-Analyst comment is a first-class, distinctly-styled entry.
Translationsexpand
Per-article, per-language translations are cached for a day so a repeat request is instant.
Accountsexpand
A minimal profile per signed-in user — identity from the OAuth provider plus a preferred language. Authentication is stateless (JWT); no server-side session store is required.
VI

Authentication

Soft auth — the site is fully public. Signing in with Google or GitHub is optional and unlocks preferences, publishing, and private articles. There is no username/password fallback and no third-party tracking.

Sessions are JWT-based (stateless), and preference writes are accepted only from the application server itself — never directly from the public internet — so a user can only ever change their own settings.

VII

AI Pipeline

Inference is tiered and demand-gated: a compact local model handles the bulk of the work, and a larger cloud model is reached only on escalation, within a weekly budget. The Red / Blue / Purple analyses are computed lazily — on an article’s first view rather than at ingest — so inference cost tracks readership, not ingest volume. Published articles are retained for roughly a month before they are pruned. Translation degrades gracefully when a model is unavailable: “model unavailable” is shown rather than a hard failure.

Translation is a click, not an auto-fire in the feed.A scrolled feed holds many mounted cards; firing translation on each mount would overwhelm the inference tier. A preferred language is a shortcut that skips the picker — it does not translate the whole feed automatically.

VIII

Frontend Notes

  • Feed rendering

    The lazy-loading feed structure is load-bearing — changes are surgical, never structural.

  • Theme layer

    A single stylesheet layer is the source of truth for colours and overrides everything else.

  • Preferences

    One context is the single source of truth for user preferences across the app.

  • App Router

    Next.js 16 App Router with Turbopack. Not the pages router.

  • No ads

    Fully ad-free by design. No ad networks, no analytics beacons.

IX

Search

Full-text search is served by Apache Solr, indexed over the article corpus (title, content, source, directive, and the reading-difficulty score). Search reconnects lazily so a restart of either the search engine or the application resolves itself without manual intervention.

X

Planned Features

Future roadmap
  • Auto-translate on the single-article page (safe — one article at a time).
  • Topic / category preferences per user.
  • Article deduplication (SimHash / MinHash).
  • Model auto-switching on cloud-credit exhaustion.
  • Custom pipeline metrics dashboards.

© 2026 Arc Codex

github.com/hapnesbitt/arc-codex

Harold Edwin Ross Nesbitt III

Fort Collins, CO · 40.5853° N, 105.0844° W

A.R.C. Framework v7.14 · Connection Secure