feat: scaffold newsfeed — user-controlled news feed
Some checks failed
deploy / build (push) Failing after 7s
deploy / deploy-api (push) Has been skipped
deploy / deploy-web (push) Has been skipped

A self-hosted feed where the user owns the ranking: per-source and signed
per-interest weights, decayed by recency, via a transparent deterministic
scorer. Content is sourced algorithmically (worker RSS/Atom polling) and
agentically (per-user API tokens POSTing candidates to the ingest endpoint).
Single-user today, multi-user by construction (every row keyed on user_id).

Rust cargo workspace + Vite/React/SWC/TS SPA:
- newsfeed-entities: DTOs (ts-rs bindings -> web/src/api/bindings)
- newsfeed-core: ranking, auth primitives, ingest, data-access ports
- newsfeed-data: SQLite adapters (sqlx, runtime queries)
- newsfeed-api: axum REST/JSON daemon
- newsfeed-worker: RSS polling + rescoring loop
- web: responsive, mobile-first SPA (React Query, generated types)

Deploy (Gitea Actions, build static musl + SPA, rsync as gitea_ci):
api+worker -> slartibartfast, SPA -> oolon (nginx serves + proxies /v1).

Deliberate deviations from house conventions (documented in CLAUDE.md/readme):
- SQLite instead of Postgres; api+worker co-locate sharing one DB file.
- Runtime sqlx queries instead of query! macros (SQLite dynamic typing;
  keeps CI database-free).

Verified end-to-end: auth, token ingest, interest-weighted ranking, signals,
pagination (curl + browser); cargo fmt/clippy -D/test and pnpm build/lint pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016fKZzDpvjiJ9eYbPGgJvUP
This commit is contained in:
2026-07-08 11:36:57 +03:00
commit 5ce52fff4d
104 changed files with 10963 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
# newsfeed-api configuration (production). Rendered to /etc/newsfeed/config.toml.
#
# This file contains no secrets — newsfeed uses SQLite (no DB password), and session
# cookies / API tokens are random values hashed at rest (no signing key). It is therefore
# committed as concrete values, not {{PLACEHOLDER}} templates. Env (NEWSFEED_*) still
# overrides any value at runtime.
# Bind the mesh-routable address so the oolon proxy can reach it. firewalld
# (newsfeed-api service) bounds who may connect; TLS terminates at oolon.
bind = "0.0.0.0:8081"
database_path = "/var/lib/newsfeed/newsfeed.db"
session_ttl_days = 30
max_db_connections = 5
# Same-origin in production (oolon serves the SPA and proxies the API), so no CORS.
cors_origins = []
# Cookies are only sent over HTTPS (the browser talks to oolon over TLS).
cookie_secure = true

View File

@@ -0,0 +1,16 @@
# newsfeed-worker configuration (production). Rendered to /etc/newsfeed/worker.toml.
# No secrets (see config.toml.tmpl).
database_path = "/var/lib/newsfeed/newsfeed.db"
max_db_connections = 2
# Poll cadence.
tick_secs = 60
# Don't re-poll the same RSS source more often than this.
source_min_interval_secs = 900
# Sources polled per cycle, and items rescored per user per cycle.
batch = 20
rescore_limit = 500
http_timeout_secs = 20
user_agent = "newsfeed-worker (+https://git.lair.cafe/grenade/newsfeed)"