Build the SvelteKit frontend: calm home with mood modes
- New frontend/ SvelteKit static SPA (Svelte 5), served by FastAPI from frontend/build (falls back to the legacy page if unbuilt). - Calm design system: cream/sage palette, serif headlines, generous space, no urgency colors, gentle motion (respects prefers-reduced-motion). - Home screen: mood-mode nav (Today/Wonder/People Helping/Solutions/Light Only/Grounded), the daily brief as a hero + remaining four, browsable mood lanes, an explicit calm end-state, inline Not today / Less like this / Hide affordances, and device-local Calm Filters mirroring goodnews/filters.py. - Backend: moods.py + GET /api/moods (single source of truth for the modes); FilterPrefs gains max_cortisol/max_ragebait ceilings (for Light Only). - Push categorical filters (include/mute topics+flavors, ceilings) into SQL in queries.feed so low-ranked-but-matching items (e.g. discovery for Wonder) are not truncated by ranking; only avoid-terms stay a Python pass. - PWA manifest + icon (installable; offline deferred per plan). - Multi-stage Dockerfile builds the site then serves it from the API. - Tests: queries.feed categorical filters (63 total). README updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+17
-6
@@ -1,19 +1,30 @@
|
||||
# goodNews web/API image.
|
||||
# goodNews web/API image (multi-stage: build the SvelteKit site, then serve it
|
||||
# from the FastAPI app).
|
||||
#
|
||||
# The SQLite database is NOT baked into the image — mount it at /data so the API
|
||||
# and the ingestion CLI (run separately, e.g. via cron on the host) share one
|
||||
# The SQLite database is NOT baked in — mount it at /data so the API and the
|
||||
# ingestion CLI (run separately, e.g. via cron/systemd on the host) share one
|
||||
# file. Build: docker build -t goodnews .
|
||||
# Run: docker run -p 8000:8000 -v /srv/goodnews/data:/data goodnews
|
||||
FROM python:3.13-slim
|
||||
|
||||
# --- Stage 1: build the static frontend ---
|
||||
FROM node:22-slim AS web
|
||||
WORKDIR /web
|
||||
COPY frontend/package.json frontend/package-lock.json ./
|
||||
RUN npm ci
|
||||
COPY frontend/ ./
|
||||
RUN npm run build
|
||||
|
||||
# --- Stage 2: the Python API, serving the built site ---
|
||||
FROM python:3.13-slim
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies first for better layer caching.
|
||||
COPY pyproject.toml README.md ./
|
||||
COPY goodnews ./goodnews
|
||||
RUN pip install --no-cache-dir ".[web]"
|
||||
|
||||
# API reads the database from here; mount a host dir or named volume.
|
||||
# FastAPI serves this directory (goodnews/api.py: FRONTEND_DIR = ROOT/frontend/build).
|
||||
COPY --from=web /web/build ./frontend/build
|
||||
|
||||
ENV GOODNEWS_DB=/data/goodnews.sqlite3
|
||||
VOLUME ["/data"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user