Swartzit now uses embedded SQLite with WAL and FTS5, plus the existing in-process cache. No separate PostgreSQL VM or cache service is required. See deployment and full-data migration.
Production release safety, database backups, restore rehearsals, and the Linux auto-update workflow are documented in docs/release-operations.md.
Swartzit is a self-hosted discussion commons: a public, readable timeline with communities, pseudonymous accounts, local voting and comments, source-aware imports, media metadata, bookmarks, reading history, and a small admin surface. It is designed to run on a Mac or a small server that you control, with the database and public web address kept separate from the application process.
Browse communities without an account, follow topics when signed in, open a discussion with source attribution, and export public data. Imported posts keep their original source link and metrics distinct from Swartzit’s local score, views, and comments.
The About page explains the public-first model and the app also includes sign-in, signup, bookmarks, reading history, dark mode, media controls, and admin tools for crawler jobs, reports, logs, users, and runtime health.
Local accounts have public profile pages at /u/<handle> with a display name,
bio, optional HTTPS avatar, join date, post/comment counts, and approved recent
activity. Profile changes publish immediately and are never sent to the
moderation queue.
When publication moderation is enabled, new direct posts, cross-posts, source
imports, and comments enter the moderation queue as pending. Swartzit runs
lightweight deterministic checks for profanity,
slurs, obfuscated abuse, harassment, link bursts, repeated text, and threats.
It stores only structured categories, severity, rule version, and urgency—not
matched private text. High-severity threat signals are held and surfaced
urgently for human review; the classifier never silently bans or suspends an
account.
Administrators can approve, reject, dismiss, suspend, or escalate post/comment queue items. Every decision is recorded in the moderation audit history. Existing imported content remains published during upgrade, while new content covered by the publication gate follows the review workflow. This keeps moderation behavior explicit and makes it possible to change the rules without rewriting the original content.
Publication moderation is an instance module for posts, comments, imports, and content-runner output. Administrators can turn off the publication gate from Settings when an instance wants those items to publish immediately. Profile changes always publish immediately, regardless of this setting. Disabling the module bypasses the classifier and preserves the moderation tables and historical audit records; reports, account suspension, IP security, and operational logs remain available. Existing pending submissions are released and recorded as dismissed when the module is disabled.
The repository includes a formula at Formula/swartzit.rb. The pinned release
formula installs the tagged archive:
brew tap techmore/swartzit
brew install swartzit
swartzit start
swartzit statusFor development builds from main, use brew install --HEAD techmore/swartzit/swartzit.
For repeatable release comparisons, run the dependency-free benchmark against a running API:
make perf-smoke PERF_REQUESTS=500 PERF_CONCURRENCY=8It emits JSON with completion count, errors, elapsed time, p50, p95, maximum latency, and response size. Keep results with the hardware profile and database fixture; do not compare numbers across machines without recording both.
Startup scripts use the lightweight API readiness endpoint at /ready rather
than loading a post. For a disposable database-scale check that applies the
read-path indexes and post_stats projection, use:
make db-performance-benchmarkThe benchmark creates and removes its own PostgreSQL database, exercises fresh
10k/100k-post fixtures, and does not touch the live application data. See
docs/performance-baseline.md for telemetry,
pg_stat_statements, and result-recording guidance.
On macOS, install the small native status companion so end users can see at a glance whether Swartzit is running. It refreshes every 30 seconds and provides a compact status card, Open/Refresh actions, responsive Start/Stop controls, and hot-reloadable web-interface binding actions:
bash scripts/install-mac-status.shThe status item checks the API, web UI, database, optional Caddy/public URL, and worker state using the same swartzit status --json command exposed to scripts and Homebrew. Open the menu to see a calm Running, Stopped, or Unavailable status card; Network, Recent activity, and Server details keep diagnostics available without turning the dropdown into a wall of status rows. The Updates row checks Homebrew in the background and becomes Install update when a newer release is available; that action uses the same backup, upgrade, restart, and health-check flow as swartzit update --yes, with live phases for backup, installation, service verification, and menu refresh preserved while the companion restarts. It uses the same Swartzit icon as the web app/favicon, enforces one menu companion per user, shows native macOS symbols for actions and network types, runs as a per-user LaunchAgent, and does not store application data in the menu-bar app.
Use Network in the menu to choose an active loopback, Wi-Fi/LAN,
USB/Thunderbolt Ethernet adapter, WireGuard/VPN tunnel, or concrete macOS
interface. Swartzit stops and restarts its API and web processes with the
selected web binding, rewrites Caddy's upstream to that same interface, reloads
Caddy, and then rechecks health. If Caddy is installed/configured, a failed
Caddy refresh makes the menu action fail visibly instead of leaving HTTPS on a
stale upstream. The API remains loopback-only unless
SWARTZIT_API_INTERFACE was explicitly configured. A generic VPN option is
also retained for automatically selecting the first active tunnel.
The same options are available to scripts with:
swartzit interfaces --json
swartzit restart en0Only interfaces with a detected IPv4 address are offered, so the menu cannot switch to a disconnected subnet accidentally.
swartzit start defaults the web UI to the detected Wi-Fi interface (en0,
falling back to en1) while keeping the API on loopback. Choose another mode
explicitly when needed:
swartzit start wifi
swartzit start loopback
swartzit start ethernet
swartzit start vpn
SWARTZIT_API_INTERFACE=wifi swartzit start wifi # expose the API tooThe menu item follows the current runtime state, so it reports when the web UI is Wi-Fi-bound even if the API remains private.
The API /health endpoint reports its UTC start time and live uptime seconds.
swartzit status --json exposes those values under uptime; a stale pulse is
shown as stale instead of being mistaken for a current successful check.
The public tap is pinned to the timestamped release archive. Users can install the current release with:
brew tap techmore/swartzit
brew install swartzitThe formula is built from source on the local Mac, while the tag and SHA256
keep the source reproducible. To update safely, use swartzit update --yes; it
backs up SQLite before upgrading, refreshes the installed native menu
companion from the same Homebrew release, and records the recovery paths. To
refresh that companion independently, use swartzit status-install on macOS.
To restore an earlier verified dump, use the rollback command documented below.
The formula builds the Rust API and SvelteKit web app with embedded SQLite. The API, website and worker share one deployment and persistent state directory.
Use the consistent SQLite snapshot rather than treating the public JSON export as a disaster-recovery backup:
scripts/db-backup.sh
scripts/db-restore-verify.sh \
.local/backups/<timestamp>/swartzit.dumpThe backup command writes a dump, SHA256 checksum, table row counts, and a gzip
archive under .local/backups/. It uses a lock to prevent overlapping dumps and
keeps the newest seven archives by default. Change the policy with
SWARTZIT_BACKUP_RETENTION. The verification command creates a temporary
SQLite file, restores the snapshot, compares every application table
against the source counts, validates the optional media archive, and removes only
that temporary verification instance. Pass either the timestamped swartzit.dump
or the complete swartzit-<timestamp>-backup.tgz archive. The media archive is
kept beside the dump when the configured canonical media directory exists, so a
database restore and media restore can be validated together without contacting
Catbox or an S3 provider.
Keep at least one dump and one .tgz archive off the Mac as well; the local
artifacts are intentionally ignored by Git because they contain private data.
For the Ubuntu Ser8 host, the repository also includes a daily GitHub backup
timer. It writes database-only snapshots to a separate private repository,
checks each dump and its table counts before pushing, and retains snapshots for
the most recent 14 calendar days. See
docs/github-database-backups.md for the
one-time repository and SSH deploy-key setup.
On macOS, install the automatic circular backup job after the app is running:
swartzit backup-installIt runs immediately at login and every six hours thereafter, retaining seven
verified-count snapshots. Configure SWARTZIT_BACKUP_INTERVAL,
SWARTZIT_BACKUP_RETENTION, SWARTZIT_BACKUP_DIR, and SWARTZIT_STATE_DIR
before reinstalling the job. The LaunchAgent writes backup.log and
backup-error.log in the persistent state directory.
To restore a verified dump into the active instance, stop the app, make a fresh pre-rollback backup, restore the dump, and restart with health checks:
swartzit rollback --backup \
"$HOME/Library/Application Support/Swartzit/backups/<timestamp>/swartzit.dump" \
--yesThe command records last-rollback.json and preserves the pre-rollback dump
and archive. It requires --yes because the database file is replaced. Add
--leave-stopped when the database should be restored without restarting the
application.
swartzit update --yes always creates a pre-upgrade dump and archive before
Homebrew changes the package, then refreshes the native menu, backup, and uptime
monitor LaunchAgents from the new release while preserving their settings. Use
that command instead of a bare brew upgrade swartzit when preserving a
recovery point matters.
For the full Mac/VM prototype-to-Ubuntu production workflow, including restore
verification, the guarded GitHub deployment workflow, bind preservation,
automatic code rollback, and opt-in upgrade error reporting, see
docs/production-updates.md.
Swartzit keeps a provider-neutral media_assets record and serves stable URLs:
/media/<id>
/media/<id>/original
/media/<id>/thumbnail
The original is canonical; the local cache is disposable. New runner uploads use the configured primary provider, while older database-backed blobs remain readable until an administrator chooses Migrate media. Configure the primary in Admin → Settings or with environment variables:
SWARTZIT_MEDIA_PRIMARY=filesystem # filesystem (default), s3, or ipfs
SWARTZIT_MEDIA_SECONDARY=disabled # legacy single-secondary setting
SWARTZIT_MEDIA_SECONDARIES=s3,ipfs # zero or more: filesystem, s3, ipfs
SWARTZIT_MEDIA_ROOT="$HOME/Library/Application Support/Swartzit/media"
SWARTZIT_MEDIA_CACHE_DIR="$HOME/Library/Application Support/Swartzit/cache"
SWARTZIT_MEDIA_CACHE_MAX_BYTES=5368709120
SWARTZIT_MEDIA_SHARE=disabled # disabled (default) or catboxThe S3-compatible adapter accepts SWARTZIT_S3_ENDPOINT,
SWARTZIT_S3_BUCKET, SWARTZIT_S3_REGION, SWARTZIT_S3_ACCESS_KEY,
SWARTZIT_S3_SECRET_KEY, and optional SWARTZIT_S3_PUBLIC_BASE_URL. Swartzit
writes content-addressed objects, records checksums and replicas, and verifies
the stored bytes before serving them. IPFS uses a local Kubo RPC endpoint and
pins each uploaded variant. Set SWARTZIT_IPFS_GATEWAY_URL if gateway URLs
should be included in media metadata, and set SWARTZIT_IPFS_API_TOKEN when the
RPC endpoint requires bearer authentication:
SWARTZIT_IPFS_API_URL=http://127.0.0.1:5001 SWARTZIT_IPFS_GATEWAY_URL=https://ipfs.example.net
The primary is written during the upload request. If secondary providers are
enabled, Swartzit records one durable replication job per provider and retries
each partner upload in the background; the Admin storage panel shows pending,
failed, and completed replicas. If the primary cannot be read, Swartzit
verifies and serves a ready secondary copy, then repopulates the bounded local
cache. Switching providers changes new writes; the migration action copies
existing assets into the selected primary and all selected secondaries, while
verification checks every recorded primary and secondary replica. The
singular SWARTZIT_MEDIA_SECONDARY setting remains supported for upgrades;
SWARTZIT_MEDIA_SECONDARIES is preferred for new installations.
Catbox is an explicit share/export adapter only. It is disabled by default and
is never treated as canonical storage, a backup, a CDN, or a streaming origin.
Configure an account hash with SWARTZIT_CATBOX_USERHASH if account-scoped
deletion is needed. Review Catbox’s current terms before enabling external
sharing for a hosted or commercial instance.
Read freely. Participate under a pseudonym. Take your community with you.
Run bash scripts/bootstrap-admin.sh after configuring the SQLite file. It creates or
promotes u/techmore (override with ADMIN_HANDLE). New accounts receive a random
password printed once; existing accounts keep their password. Sign in at /login
and open /admin. The API checks the database admin role on every request.
On the current development instance, u/techmore is already an administrator.
Use your existing password at Sign in, then open
Admin or use the Admin navigation link.
# Default admin: techmore
bash scripts/bootstrap-admin.sh
# Another instance administrator
ADMIN_HANDLE=your_handle bash scripts/bootstrap-admin.sh
# Explicit password recovery; revokes this account's existing sessions
RESET_ADMIN_PASSWORD=1 ADMIN_HANDLE=techmore bash scripts/bootstrap-admin.shThe script requires Cargo and direct database access. Export DATABASE_URL for
a non-default database. Keep the generated password in your password manager.
For password recovery, run RESET_ADMIN_PASSWORD=1 bash scripts/bootstrap-admin.sh.
With ADMIN_PASSWORD unset, this generates a new password and revokes existing sessions for that account.
ADMIN_PASSWORD may supply a password through the environment instead of generating
one. Do not put passwords in source control or command history.
The dashboard shows registered account totals (excluding demo-only identities), content totals, unexpired sessions, database size and pool usage, host load, and runtime API rate/latency/errors. Page loads count JavaScript-enabled navigations, including repeats, with no visitor identifier. Runtime counters reset on restart. The host load is for the entire Mac/Linux host, not just Swartzit.
The admin workspace has Overview, Users, Content, Reports, Server, Analytics, and Logs tabs. Users includes handle search, roles, activity counts, and session revocation (self-revocation is blocked; use Sign out). Content provides searchable posts, comments, and communities with text inspection and links to discussions. Reports can be marked resolved; resolution does not remove the reported content. Management actions are recorded in the circular log. Role changes and password recovery still use the host-side bootstrap command; suspension and content removal are not implemented.
Analytics includes 14 days of daily registrations, posts, and comments using UTC dates. Traffic metrics remain runtime-only. Logs support severity filters, text search, expandable structured details, and older/newer pages through retained events. Search covers only the bounded retained history. Pause live updates while investigating; all views also have manual refresh and error/retry states.
Operational request/startup/bootstrap events persist in a 1,000-slot SQLite ring, replacing the oldest slots. The dashboard displays the newest 100. Logs omit IP addresses, headers, request bodies, tokens, query strings, and raw paths. Admin polling and page-view events are excluded from the request log. This ring does not manage external process-manager/stdout logs or external storage retention.
Swartzit is a self-hosted discussion prototype with public reading, pseudonymous accounts, communities, posts, threaded comments, voting, subscriptions, search, public exports, and an admin dashboard.
Admin → Settings → Biblical mode (off by default) offers each visitor a
Standard / Bible switch in the header. Bible mode turns the instance into a
place for Scripture, sermons, and study: a Reformed / Presbyterian presentation,
a KJV Bible reader at /bible with public-domain LibriVox audio for every
chapter, a persistent listening player (play a whole book such as Titus, a
daily reading, or a sermon), the Westminster Shorter Catechism, and a timeline
focused on c/scripture, c/daily_reading, c/sermons, and c/deeper_dives.
scripts/bible-feed.mjs fills those communities from the built-in reading
plan and from curated Reformed and Presbyterian sermon and teaching podcasts.
See docs/biblical-mode.md.
Posts expose separate counters for opens, engaged views (10 seconds), and deeper reads (30 seconds). Post pages and Admin → Content show all three; feed cards show opens. JavaScript counts time only while the document is visible and the post article intersects the viewport. Time spent hidden or away from the article does not count, and long timer gaps from sleep/throttling are ignored.
Each page visit gets a random in-memory ID scoped to that post. No cookie, IP, account ID, or cross-post visitor identifier is stored for this measurement. Repeated requests for the same visit do not increment a milestone twice. Refreshing/revisiting creates another visit: these are not unique-reader counts. Non-JavaScript reads remain accessible but are not counted.
The API accepts POST /api/posts/{id}/views with a 64-character hexadecimal visit_id and visible_seconds of 0, 10, or 30. Open must be recorded first. The server checks elapsed wall time and atomically counts each milestone once; it cannot prove that a human was reading. These analytics can be spoofed and do not currently gate votes, likes, or reputation.
Aggregate counters persist. Deduplication records expire after one hour; expired rows are cleaned in batches on subsequent view requests (idle instances may keep expired rows until traffic resumes). View events are excluded from circular request logs. Visibility milestones are a starting policy for future experiments, not a configured voting requirement.
The public community directory supports search, paging, and links to each community's discussions. The Communities link is in the main navigation. Signed-in users can create communities from that page. The existing API also supports community subscriptions; ownership/moderator roles are not assigned by community creation yet.
To prepopulate an instance with 20 familiar discussion topics:
bash scripts/post-install.shRun it from a checkout with Cargo available. Export DATABASE_URL for a non-default database. It applies migrations and adds empty communities such as technology, science, programming, books, cooking, gaming, privacy, and space. These are independent communities with original descriptions, not a Reddit import, affiliation, or current popularity ranking. No users or posts are copied. Rerunning is safe: matching slugs and their descriptions remain unchanged. This is optional and separate from demo seeding and administrator bootstrap. Edit crates/server/starter-communities.sql to customize the starter list.
Signup uses named username/password fields, new-password autocomplete, and a normal POST/redirect flow to help password managers recognize account creation. Native suggestions depend on browser/password-manager settings and may not appear in embedded browsers. “Suggest a strong password” generates a 24-character random password locally using Web Crypto; save it before submitting. Account creation also works without JavaScript, while the suggestion button requires JavaScript.
With Rust, Python 3, and Node.js installed:
bash scripts/run-local.shThe script starts the Rust API and standalone SvelteKit website, using the
persistent SQLite file under .local/. It reuses healthy listeners and skips
rebuilds when artifacts already exist. The website uses port 4173, the API 18080;
SQLite has no network listener. Stop services with bash scripts/stop-local.sh.
Your database and media remain in the persistent state directory.
For a direct HTTPS domain from the Mac, configure the router to forward TCP 80 and 443 to this Mac, then start the optional Caddy terminator:
SWARTZIT_DOMAIN=stoverparc.org SWARTZIT_CADDY=1 bash scripts/run-local.shCaddy obtains and renews the certificate automatically once DNS points to the router and both forwards are active. If the Mac changes Wi-Fi networks, use the new LAN address printed by the launcher or reserve a DHCP lease in the router; the public DNS record does not change.
The launcher accepts a network mode or a concrete macOS interface so you do not need to hand-edit bind addresses:
bash scripts/run-local.sh local # this Mac only
bash scripts/run-local.sh lan # Wi-Fi/LAN; prints the URL
bash scripts/run-local.sh ethernet # Ethernet (en1 by default)
bash scripts/run-local.sh en0 # bind to this exact interface
bash scripts/run-local.sh vpn # Tailscale or utun VPN URL
SWARTZIT_ORIGIN=https://your-hostname \
bash scripts/run-local.sh public # localhost + Caddy/HTTPS
bash scripts/network-status.sh # list detected addresses
bash scripts/status-local.sh # all local components
bash scripts/status-local.sh --json # machine-readable statuslan is the default and keeps the API/database private. VPN mode prefers a
Tailscale IPv4 address and otherwise reports the first macOS utun address;
use SWARTZIT_ORIGIN when a VPN DNS name is the address people should use.
The public mode requires an explicit origin and only exposes the web server
through Caddy.
For stoverparc.org, a typical public setup is:
SWARTZIT_ORIGIN=https://stoverparc.org \
SWARTZIT_CHECK_URL=https://stoverparc.org/ \
SWARTZIT_CADDY=1 bash scripts/run-local.sh public
SWARTZIT_CHECK_URL=https://stoverparc.org/ \
SWARTZIT_CHECK_INTERVAL=300 bash scripts/swartzit-monitor.sh --onceThe monitor can run continuously, or as a native macOS LaunchAgent that starts when you log in:
SWARTZIT_CHECK_URL=https://stoverparc.org/ \
SWARTZIT_CHECK_INTERVAL=300 bash scripts/install-mac-monitor.shThe monitor writes an atomic uptime-pulse.json under the persistent Swartzit
state directory. It records the latest result, latency, consecutive failures,
last success/failure, and a short recent history. The admin Settings tab
shows that pulse separately from local API/database health, so a running Mac is
not mistaken for a reachable public app. The packaged equivalents are:
swartzit monitor --once # check once and update the pulse
swartzit monitor-install # install/reinstall the macOS LaunchAgent
swartzit status --json # local components plus the latest pulseFor the WireGuard-backed public path used by stoverparc.org, bind the web
server to the tunnel address. Caddy listens on wildcard 80/443, obtains and
renews the domain certificate, and proxies to that selected web address; the
API remains on loopback:
swartzit caddy-install
SWARTZIT_CADDY=1 SWARTZIT_DOMAIN=stoverparc.org \
swartzit restart utun4
swartzit statusThe menu's Network action keeps this upstream synchronized
when switching between Wi-Fi, Ethernet, and WireGuard. The public server or
router must forward TCP 80 and 443 through the WireGuard path to
192.168.3.250.
Orchard is an optional native macOS companion for inspecting Apple containers.
The admin Settings tab stores its module toggle in the database; disabling
it removes the Orchard controls and native menu actions without uninstalling
Orchard or changing existing containers. When enabled, install it with
brew install orchard, or use Open Orchard and Install Orchard with
Homebrew… from the native Swartzit menu item. Orchard manages the container
runtime; Swartzit still serves the API/web processes and the pulse checks the
configured public URL. The integration is isolated so it can be replaced by
another container companion later.
status-local.sh reports API, web, SQLite, Caddy, worker, and (when
configured) public URL state. The API defaults to loopback even when the web
interface is bound to Wi-Fi or Ethernet; set SWARTZIT_API_INTERFACE only when
you intentionally want the API exposed on another interface.
This is a local prototype. Federation, full community migration/import, and media transfer are not implemented yet.
For an always-on instance, use a small Linux VPS rather than keeping the Mac running. The practical minimum for the complete stack (SQLite, Rust API, SvelteKit web server, Caddy, and the scheduler) is a 2 GiB / 1-2 vCPU machine with about 50 GiB of disk. A 512 MiB / $4 proxy-only machine is not enough for the database and workers; a 2 GiB DigitalOcean Basic Droplet is roughly $12/month before optional backups and taxes. The current price list is at DigitalOcean Droplet pricing.
The repository includes a repeatable Ubuntu installer. It builds a pinned checkout, installs the API and web systemd services, and enables the crawler timer. Supply secrets out of band; never commit them:
sudo REPO_URL=https://github.com/techmore/swartzit.git \
REF=main \
DATABASE_URL='sqlite:/var/lib/swartzit/state/swartzit.sqlite' \
ORIGIN=https://swartzit.example.org \
SCHEDULER_HANDLE=techmore \
SCHEDULER_PASSWORD='use-a-password-manager-value' \
CADDY_DOMAIN=swartzit.example.org \
bash scripts/install-server.shThe installer creates the SQLite database in the persistent state directory. It keeps the API on 127.0.0.1:18080, the web server on
127.0.0.1:4173, and exposes only Caddy. Check the services with:
systemctl status swartzit swartzit-web swartzit-worker.timer
journalctl -u swartzit-worker.serviceThe installer places the optional GitHub database backup service and timer.
Configure and enable them separately after creating a private backup repository;
see docs/github-database-backups.md.
The Linux source updater is installed at
scripts/swartzit-linux-update.sh. It creates and validates a native
SQLite snapshot before stopping services, keeps /etc/swartzit/*.env
unchanged, and gates promotion on API/web health. It is intentionally opt-in:
configure the production GitHub environment described in
docs/production-updates.md, or enable the
provided swartzit-update.timer explicitly.
For an Ubuntu host that receives its public HTTPS traffic through a separate
WireGuard-connected Caddy edge, set the web bind to the host's WireGuard
address and install the optional wg0 startup dependency. The WireGuard
profile must already be installed at /etc/wireguard/wg0.conf; the installer
does not accept or store private keys:
sudo WEB_HOST=192.168.3.251 \
WIREGUARD_INTERFACE=wg0 \
REPO_URL=https://github.com/techmore/swartzit.git \
REF=main \
DATABASE_URL='sqlite:/var/lib/swartzit/state/swartzit.sqlite' \
ORIGIN=https://stoverparc.org \
SCHEDULER_HANDLE=techmore \
SCHEDULER_PASSWORD='use-a-password-manager-value' \
bash scripts/install-server.shThis enables wg-quick@wg0 at boot and makes swartzit-web wait for the
tunnel before binding. When CADDY_DOMAIN is set with WIREGUARD_INTERFACE=wg0,
the installer also makes Ubuntu Caddy wait for and follow that tunnel, so the
gateway can forward TCP 80/443 directly to 192.168.3.251. Caddy proxies to
the selected WEB_HOST:4173 listener and the API remains on loopback. If Caddy
terminates TLS on another machine, point that edge at 192.168.3.251:4173
instead.
The admin Crawler Jobs tab stores provider, source, destination community,
interval, maximum items, moderation mode, and run status. The worker runs once
per minute and claims due jobs without overlapping runs. The Commons/Daddario
adapter uses the existing bounded publisher. Reddit uses its public JSON feed
and RSS accepts public HTTPS feeds; X uses the official API and requires
X_BEARER_TOKEN in the worker environment. An X job can use either an
@handle/profile URL or a search source such as
search:("Alexandra Daddario" OR Daddario) has:media -is:retweet -is:reply.
Search jobs expand public authors and attachments, skip protected authors, and
preserve the original status URL and metric snapshot. Provider errors are
recorded as failed; the worker never scrapes a browser login or reports a
fabricated success. Provider credentials belong in the worker environment, not
in the job record or repository.
The worker is cross-platform Node code: use bash scripts/run-worker.sh or
node scripts/swartzit-worker.mjs for a one-shot pass on any supported host.
macOS can install a launchd schedule with swartzit worker-install; Linux uses
the same worker through swartzit-worker.timer. Browser-session collection
remains a Mac-only capability because it requires the dedicated signed-in Ego
Lite session; RSS, Reddit, and official X API jobs can run on any host.
Admin → Content Runners includes disabled starter recipes for a bounded X
cross-post and local Draw Things generation. The X recipe can collect several
accounts, topics, or explicit queries over a rolling or explicit start/end
window; it deduplicates canonical source URLs and caps each execution at eight
posts. Set X_BEARER_TOKEN only in the worker environment, add it to the
runner's allowed environment keys, and enter account/topic values in the
runner editor. The adapter is scripts/x-cross-post-runner.mjs.
Draw Things uses the installed draw-things-cli directly on the worker host.
The starter model is flux_1_schnell_q5p.ckpt when that model is present; pick
another local model in the editor when needed. Prompts expand {date},
{weekday}, {community}, {runner}, {seed}, and {index} at execution
time. Test runs the actual command without publishing, records the output
path and prompt, and only Run now or an enabled schedule creates a post.
Generated Draw Things posts also have an optional structured feedback panel: overall preference plus prompt match, natural color, realism, likeness, composition, and detail. Each person can update their rating, skip dimensions that do not apply, and see the aggregate signal without affecting normal post votes or moderation.
Swartzit stores external media metadata and source URLs separately from its canonical media store. The bounded LRU cache is enabled only for media objects; it never caches sessions, admin pages, or authenticated responses. External source media still respects the source license and can be purged independently. IPFS is now an optional durable backend for media that is explicitly redistributable; it is not enabled by default and its Kubo RPC endpoint must remain private.
The planned JEV/Ego Lite finance bridge is a separate, local, read-only component for user-approved balance snapshots, transaction review, and draft bill planning. Bank credentials, cookies, MFA codes, screenshots, and raw transaction feeds must stay outside Swartzit. See docs/jev-finance-bridge.md for the tool boundary, redaction, retention, and browser handoff requirements.
For deployment that should survive a home-network outage, point the domain at the VPS and run the full stack there. A VPS acting only as a Caddy/WireGuard proxy is useful for keeping the Mac private, but it does not run Swartzit when the Mac is offline.
Run Swartzit first with bash scripts/run-local.sh. Localhost URLs only work
on your own computer. Both sharing methods below forward to the website on
port 4173, which proxies API calls internally. Keep the API on
loopback and the SQLite file on local disk. Your Mac must stay awake and the app must remain running.
In a second terminal:
brew install cloudflared # Only if not already installed
cloudflared tunnel --url http://127.0.0.1:4173Share the generated https://…trycloudflare.com URL. Visitors can read in an
ordinary browser, create accounts, and sign in. Admins use the same URL with
/admin. Sign in again when changing from localhost to a public URL because
browser sessions are stored per origin.
For signup form submissions through the tunnel, restart the app with its public origin (leave the tunnel running; replace the example with your generated URL):
ORIGIN=https://your-generated-name.trycloudflare.com bash scripts/run-local.shUse that public URL for signup. Restart with the new ORIGIN if the tunnel URL changes. Without this, the framework rejects cross-origin form submissions.
Quick Tunnels require no Cloudflare account, purchased domain, or router port
forwarding. They expose the site publicly through Cloudflare and are intended
for testing. Ctrl-C in the tunnel terminal stops sharing; restarting produces
a new URL. Limits include 200 concurrent requests and no SSE support. Existing
.cloudflared/config.yaml configuration may prevent Quick Tunnels from working;
consult the documentation without overwriting another tunnel's configuration.
For a stable hostname, configure a named tunnel with your domain and an HTTP
service pointing to http://127.0.0.1:4173. Supervise the tunnel for continuous
hosting. See Quick Tunnels
and Cloudflare Tunnel setup.
Leave the app running. From the repository root in another terminal:
brew install tor # macOS; on Linux use your distribution's Tor package
mkdir -p .local/tor-data .local/tor-service
chmod 700 .local/tor-data .local/tor-service
tor --SocksPort 0 \
--DataDirectory "$PWD/.local/tor-data" \
--HiddenServiceDir "$PWD/.local/tor-service" \
--HiddenServicePort "80 127.0.0.1:4173"Wait for Tor to bootstrap. In another terminal, from the same repository root:
cat .local/tor-service/hostnameShare http://<the-generated-address>.onion and open it in Tor Browser.
Admins can sign in there and visit /admin. No purchased domain, public inbound
port, or router forwarding is required. Outbound Tor connectivity is necessary.
For onion signup, restart the app with
ORIGIN=http://your-generated-address.onion bash scripts/run-local.sh and use
that onion URL. Form submissions require the configured public origin; switching
between localhost, a tunnel, and an onion URL requires updating ORIGIN.
Ctrl-C stops the onion service. Repeat the same command with the same directories
to resume at the same address. Back up .local/tor-service privately: it contains
the keys controlling that onion identity. Only share the hostname. .local/
is excluded from Git. If you previously used .tor-service, preserve those keys
to keep your existing address rather than creating a new identity.
This command runs a dedicated Tor process, not a supervised system service. See Tor deployment notes and the Tor Project setup guide.
Requirements: Rust stable, Node.js/npm, and Python 3 for backup tools.
The Rust API reads exported environment variables; copying .env.example
alone does not load them. Choose a private local database path. The example below
starts the API only on its default port 8080.
Common checks are also available through make check, make test, make fmt,
and make web-build.
mkdir -p .local
export DATABASE_URL="sqlite:$PWD/.local/swartzit.sqlite"
cargo run -p swartzit-server -- --seed-demo
cargo run -p swartzit-server
curl http://127.0.0.1:8080/api/posts
# Subscribe without an account or JavaScript
curl http://127.0.0.1:8080/feed.xml
# Create a pseudonymous account (passwords are stored as Argon2 hashes)
curl -X POST http://127.0.0.1:8080/api/accounts \
-H 'content-type: application/json' \
-d '{"handle":"new_reader","password":"a long passphrase"}'
# Start a 30-day session
curl -X POST http://127.0.0.1:8080/api/sessions \
-H 'content-type: application/json' \
-d '{"handle":"new_reader","password":"a long passphrase"}'
# Use the returned token to publish
curl -X POST http://127.0.0.1:8080/api/communities \
-H 'authorization: Bearer TOKEN' -H 'content-type: application/json' \
-d '{"slug":"localnet","name":"Local Net","description":"A community with its own home."}'
curl -X POST http://127.0.0.1:8080/api/posts \
-H 'authorization: Bearer TOKEN' -H 'content-type: application/json' \
-d '{"community":"commons","title":"A new thought","body":"Hello, commons."}'
# Reply to a post (parent_id is optional for a top-level comment)
curl -X POST http://127.0.0.1:8080/api/posts/1/comments \
-H 'authorization: Bearer TOKEN' -H 'content-type: application/json' \
-d '{"body":"A thoughtful reply.","parent_id":null}'
# Upvote (+1), downvote (-1), or clear a vote (0)
curl -X POST http://127.0.0.1:8080/api/posts/1/vote \
-H 'authorization: Bearer TOKEN' -H 'content-type: application/json' \
-d '{"value":1}'
# Inspect or revoke the current session
curl http://127.0.0.1:8080/api/me -H 'authorization: Bearer TOKEN'
curl -X DELETE http://127.0.0.1:8080/api/sessions -H 'authorization: Bearer TOKEN'
# Export public discussion data (not a complete database backup)
curl http://127.0.0.1:8080/api/export > swartzit-export.jsonTo run the website against this manually started API, use a second terminal:
npm --prefix apps/web ci
npm --prefix apps/web run build
HOST=127.0.0.1 PORT=4173 ORIGIN=http://127.0.0.1:4173 \
API_URL=http://127.0.0.1:8080 node apps/web/buildFor a permanent site, set ORIGIN to its public URL. Match API_URL to the
API's BIND_ADDR: the local startup script uses 18080, while the standalone
API defaults to 8080. Keep both processes on loopback when the reverse proxy or
Tor runs on the same host. RSS currently lives on the Rust API only; the website
proxies /api/*. Public exports omit account credentials and do not replace
PostgreSQL backups.
Admins can open Admin → Imports, select a prepared JSON file, review the
batch, and submit it. Signed-in members can also use the + composer to
search for a community and paste a public X or Reddit post URL. Swartzit keeps
the canonical source link, source text, trusted source media, and metrics;
Reddit imports also keep a bounded snapshot of top-level comments. New
cross-posts stay hidden until they are approved in Admin → Moderation. A
migration creates c/x_imports and the independent fan community
c/alexandra_daddario. Use --community SLUG to route a batch into another
existing community.
Prepare a batch from the existing Hermes X mirror archive (no Signal delivery):
node scripts/prepare-import.mjs --archive /path/to/hermes-signal-cli-x-mirror/archive/posts --limit 20 > x-import.jsonAdd --author techmore_edu to include only that author's archived posts
(case-insensitive, optional leading @). This does not select their home feed
or fetch new posts. The limit applies after filtering; no matches produces an
empty batch rather than substituting unrelated content.
For a focused faith link runner, use the X API and Reddit's public JSON search with three bounded searches each. Protestant and Presbyterian terms are weighted above broader biblical and Christian terms; duplicate links are collapsed before publishing.
node scripts/x-faith-runner.mjs \
--community x_imports --limit 10 --per-query 20 \
--output .local/import-previews/protestant-x.json
node scripts/scheduled-imports.mjs \
--job x --batch .local/import-previews/protestant-x.json --limit 10The runner looks for Presbyterian, Reformed, confessional, Westminster,
sola scriptura, sola fide, biblical, expository, gospel, theology, and
general Christian terms in descending priority. It imports only public results
returned by X or Reddit, preserves each source link and observed metrics, and
leaves moderation to the existing import workflow.
Hermes can be the local collector while Swartzit remains the publisher. Give
Hermes access to a signed-in browser session for public Following/For You
collection, or an authorized X API connector for unattended collection. Hermes
must write a fresh normalized JSON array using the same record shape accepted by
POST /api/admin/imports, including the real source_url, source_author,
observed_at, and any observed media and metrics. It must never copy cookies,
read DMs, bypass visibility controls, or invent missing values.
Publish one Hermes batch from the repository root:
node scripts/hermes-content-sync.mjs \
--job feed --batch .local/hermes/inbox/following-2026-09-22.json --limit 10For a hands-off local loop, have Hermes atomically place completed batches in an inbox directory and invoke:
node scripts/hermes-content-sync.mjs --job feed --inbox .local/hermes/inbox --limit 10Successful files move to .local/hermes/archive and receive a receipt in
.local/hermes/receipts; failed files stay in the inbox for inspection and
retry. The wrapper calls scheduled-imports.mjs, so canonical URL deduplication,
media enrichment, attribution checks, admin authentication, and session cleanup
remain in one place. A Commons photo run can be scheduled locally with
node scripts/hermes-content-sync.mjs --job ddario --limit 3 --due-hours 24.
This is a local handoff contract, not a new Signal integration.
Prepare reusable Commons photos from the Alexandra Daddario library manifest:
node scripts/prepare-import.mjs --manifest /path/to/alexandra-daddario/manifest.json --limit 10 > photo-import.jsonThe photo adapter reads source URLs, fetches Commons credit/license metadata, and skips unsupported licenses and other image hosts. It does not transfer local photo files, private ratings, or library comments. Review the original file's terms and attribution before publishing.
POST /api/admin/imports accepts one normalized record with a Bearer admin
session. Required fields are community, provider (x or commons),
source_url, source_author, title, body, and ISO-8601 observed_at.
Optional fields: published_at, source_views, source_likes,
source_reposts, source_replies, media, and attribution. Media accepts
legacy image URL strings or objects: { "kind": "image" | "video", "src": "https://...", "poster": "https://...", "alt": "..." }. Poster and alt are
optional. Up to eight attachments allow a post plus its quoted-post media.
X photos/posters must use pbs.twimg.com; videos must be MP4s on video.twimg.com.
Unknown metrics are null, not zero. Every refresh replaces the complete source
snapshot; omitted metrics become unknown. Older snapshots cannot overwrite
newer ones. Canonical source URLs prevent duplicate posts, including concurrent
imports and X/Twitter URL aliases. Reimports preserve local votes, views,
comments, and community placement.
Readers can sort discussions by local activity or X snapshot counts, copy a
discussion link, and sort local comments oldest/newest. Source images load
automatically and directly from their original CDN; this is not
torrent storage or an offline media mirror. Source counts are timestamped
snapshots, not live counters. The existing Hermes archive does not contain
engagement counts, so those show as unknown unless supplied by a collector.
X imports are automatically enriched with public photos, animated-GIF MP4s,
videos, and quoted-post attachments where X exposes them. Videos play inline,
muted as they enter view, and pause when they leave; the autoplay control can
turn this off. Legacy image-only records remain compatible.
Source reply bodies and permanent video downloads are not implemented.
Media stays on X's CDN and can become unavailable if X removes or blocks it.
Backfill existing X cross-posts with node scripts/backfill-x-media.mjs;
this preserves their captured engagement timestamps and local discussions.
Existing Signal jobs are unchanged.
The Swartzit content sync Codex heartbeat is scheduled hourly. It reads
public posts from the signed-in @techmore_edu account's Following and For You
feeds (up to ten posts total), then publishes through the runner. It also checks
the Daddario library each run, publishing up to three eligible Commons sources
when 24 hours have elapsed since its last successful photo run.
This requires the Mac/Codex, the local server, and an accessible signed-in Brave session. It is an agent-operated collector, not an independent Linux service. Scheduled execution has been enabled; future unattended browser runs may still encounter login or user-control blocks. The photo task posts from the existing manifest and reports exhaustion; it does not discover new photos automatically.
See the run procedure for collection limits and recovery.
See the runner map for the ownership and startup rules for
local, Hermes, hosted, and heartbeat jobs.
The publisher accepts only fresh X batches, exits nonzero on failures, revokes
its session, prevents overlapping publishers, and checkpoints successful photos
individually. The latest 100 receipts are retained per job in
.local/sync-x.json and .local/sync-ddario.json. Credentials stay in the
gitignored .local/import-scheduler.env; never commit or print them.
node scripts/scheduled-imports.mjs --job x --batch .local/import-previews/scheduled-x.json --limit 10
node scripts/scheduled-imports.mjs --job ddario --limit 3 --due-hours 24
node --test scripts/scheduled-imports.test.mjsAdjust or pause Swartzit content sync in Codex automations. Source URLs deduplicate across both feeds; local votes and comments survive refreshes.
The intended deployment shape is a Linux system container or VM managed with
Incus, with SQLite in the persistent state directory and the server supervised by
systemd. OCI images remain an optional interoperability format for Apple
container on macOS and other runtimes; Docker is not required.
See deploy/incus/README.md for the first-run host
setup sketch. It is not a complete, tested production installer: hosting also
requires the Node website, database backups, and supervision for both app
processes. Forward public traffic to the website on 4173.
The first release deliberately keeps uploads and federation out of the public API while their privacy, moderation, migration, and onion behavior are being specified.
Signed-in users can choose Bookmark on feed cards or discussion pages.
Save to folder saves or moves a post into a folder; posts can also remain
Unfiled. Open Bookmarks in the account navigation (/bookmarks) to
browse saved posts, create or rename folders, move bookmarks, or remove them.
Deleting a folder moves its bookmarks to Unfiled without unsaving the posts.
Each post can be saved once per account, in one folder at a time.
Bookmarks and folders belong to the signed-in account and are excluded from
public feeds and community exports. Their API routes require a bearer session:
GET /api/bookmarks (optional folder_id, unfiled=true, and page),
GET/POST /api/bookmark-folders, POST/DELETE /api/bookmark-folders/{id},
and GET/POST/DELETE /api/posts/{id}/bookmark. Folder writes accept { "name": "Reading" }; bookmark writes accept { "folder_id": null } or a folder ID.
The SQLite baseline creates the bookmark tables, and subsequent SQLite
migrations run automatically when the server starts.
The bookmark isolation/lifecycle test uses a disposable SQLite database:
cargo test --locked private_bookmarks_and_folder_lifecycle.
For optional host-side tools, see the guides for bookmark organization, media archival, and classifier benchmark batteries.
Use the Dark mode / Light mode toggle at the bottom-right of any page.
The site follows the operating system's theme until you choose a mode, then
remembers that choice in this browser (swartzit_theme in local storage).
The preference applies to public pages, forms, bookmarks, and the admin panel;
it does not require an account.
The Security tab shows recent proxy-derived request activity, timestamps, routes, statuses, and reversible address blocks. Swartzit stores a keyed one-way hash of each address, not the raw IP. Detailed access history is kept in a 5,000-request circular buffer and older aggregate activity is cleaned up after seven days. To enable this behind Caddy or another trusted reverse proxy, set these variables for the API:
TRUST_PROXY=true
IP_HASH_SECRET='a-long-random-secret'
SWARTZIT_IP_ACTIVITY_SUCCESS=1Only enable TRUST_PROXY when every request reaching the API comes through
that proxy; otherwise clients can forge forwarding headers. Blocks can be
temporary or indefinite and can be removed from the same tab. Migration
0018_ip_security.sql creates the activity and block tables.
Imported X video playback uses the site's no-referrer policy: X's CDN can
reject video requests with a third-party Referer (HTTP 403). Keep the referrer
meta tag in apps/web/src/app.html when customizing the layout. This also keeps
private page addresses out of outbound requests. Videos still stream directly
from X, with byte-range support for seeking; Swartzit does not proxy or store them.
Imported X posts record the public pbs.twimg.com/profile_images URL returned
by the source API or syndication endpoint. Profile images can be copied into a
small local cache and served from Swartzit so the reader is not dependent on X
for every avatar request:
API_URL=http://127.0.0.1:18080 \
PROFILE_IMAGE_CACHE_DIR=/var/lib/swartzit/profile-cache \
node scripts/cache-profile-images.mjsThe cache job follows only HTTPS X profile-image URLs, refuses redirects, and
skips files over 1 MiB or with a non-image content type. It deduplicates
downloads by the source image URL, then links one local cached file to every
post that uses that avatar. The API serves cached files at
/profile-images/:post_id; the web app uses only that local route, so a cache
miss does not trigger a browser request back to X. Run the job from a timer
after imports, and make PROFILE_IMAGE_CACHE_DIR writable by the service
account. This cache is intentionally limited to profile avatars; post photos
and videos remain source-hosted or torrent-backed.



