adamfandClaude Opus 5.5 bb83c6bb03
Test and deploy / test (push) Successful in 21s
Test and deploy / deploy (push) Successful in 13s
Move gitea/ to its own repo, adamf/stpgit
The Gitea LXC's compose file, entrypoint, app.ini template and env example
now live in adamf/stpgit, which the LXC checks out instead of this repo.
What stays here is stpvm's side: the haproxy forwarder, renamed to
gitea-forwarder/haproxy.cfg, and a copy of the entrypoint in
.deprecated/gitea/ so the stpvm rollback does not depend on the new repo.
Renovate now also covers adamf/stpgit, and the docs point there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 16:52:55 +00:00
2026-11-24 15:10:50 +00:00

Gay bal;;s

My Web

screenshot

Welcome to the source code for my website! Please contact me if you would like to collaborate and thank you for visiting.

This website is self-hosted on my Raspberry Pi. Any interference or hax and the killswitch will activate and stop the UK national grid power system so please don't tamper with my domain :).

The use of AI

This has been created with a heavy amount of AI. Initially, I began with articles from medium informing me of how to use Nginx to host static sites and reverse proxy to other services. They were incredible helpful and I wish I were able to give credit them, but sadly they were read too long ago.

After hearing all the hype on LinkedIn and feeling the pressure to keep up a high output without AI, I eventually caved in. There is an immense advantage not having to scan though documentation to find relevant functions, asking how other developers implement their infrastructure and finding what command will achieve your outcome quickly. Sure, it would be good to have that already cached in your own human memory. But my reasoning is that you will have cached it after being reminded by AI enough times, similar to how flashcards work. I may not be an expert in the specific tool, though I've been able to get good enough at it for my own purposes.

Architecture

All services run in Docker containers orchestrated by Docker Compose behind Caddy as a reverse proxy on a single bridge network. (nginx and certbot did that job until 2026-11-17.)

vue              ── Frontend build (outputs dist to shared volume)
caddy (80, 443)  ── Frontend SPA + Reverse Proxy + TLS certificates
backend (8080)   ── Go API (GraphQL + REST)
db (5432)        ── PostgreSQL 16
icecast2 (8000)  ── Audio Streaming (Icecast2 + Liquidsoap)
gitea (3000)     ── Self-Hosted Git
silverbullet (3000) ── Obsidian Notes Editor (SilverBullet 2.11.0)
silverbullet-public (3000) ── Public read-only notes site (same image, SB_READ_ONLY)
silverbullet-git ── Commits/pushes notes edits to the notes repo
python (8000)    ── Python API (FastAPI)

Tech Stack

Frontend - Vue 3, Vite, Tailwind CSS v4, Pinia, Vue Router, markdown-it (wikilinks + KaTeX)

Backend - Go (Gin), gqlgen (GraphQL), GORM, PostgreSQL, JWT auth, WebSockets

Integrations - Spotify API, Steam API, Anthropic Claude API, Icecast2

Infrastructure - Docker Compose, Caddy, Let's Encrypt (DNS-01 via Cloudflare), Cloudflare Tunnel, Gitea + Act Runner

Features

  • Spotify integration (currently playing, recently played)
  • Steam integration (online status, recent games)
  • Public Obsidian notes site via a read-only SilverBullet, editable from any browser via a second, admin-only SilverBullet
  • Live radio streaming via Icecast2 + Liquidsoap
  • Real-time chat over WebSockets with image/video uploads
  • Blog with admin panel (CRUD)
  • Activity and rowing session tracking
  • AI image processing integration to extract rowing data from images (will be superseeded by openCV scanning)
  • Fan shrines (GTO, Evangelion, Demoman, Skip Skip Benben)
  • Self-hosted Git (Gitea) with CI/CD and commit feed on homepage
  • Printable CV with role-specific sections
  • Job application tracker with status workflow and CSV export (admin-only, /cv/jobs)
  • Database-backed bookmarks grouped by category, managed via GraphQL (admin-only)
  • Admin-gated routes: /sb, /jobs, /tracker, /dozzle, /garage and more require the admin session, checked by Caddy's forward_auth against the backend
  • Landing page with animated stamps section
  • Route transitions (slide/fade) and performance optimizations (gzip, WOFF2 fonts, lazy loading)
  • Backend healthcheck (reported in docker ps; nothing restarts on it)

Pages

Route Description
/ Landing page
/stp Home dashboard with grid layout
/admin Admin login + panel (authenticated)
/cv Curriculum Vitae (printable)
/cv/jobs Job application tracker (admin-only, hidden print)
/bookmarks Bookmarks (database-backed, grouped by category)
/notes/:path Obsidian notes (read-only SilverBullet, public; private/ excluded)
/sb/ Obsidian note editor (via SilverBullet, admin-only)
/shrines Fan shrine index + individual shrines

API

GraphQL

Endpoint: POST /api/graphql Playground: GET /api/graphql (when GQL_PLAYGROUND=true)

Operation Type Description
users Query Get all users
user(id) Query Get user by ID
me Query Get authenticated user
posts Query Get all posts
post(id) Query Get post by ID
activities Query Get all activities
favorites Query Get all favorites
rowingSessions Query Get all rowing sessions
post(id) Query Get post by ID
activities Query Get all activities
favorites Query Get all favorites
rowingSessions Query Get all rowing sessions
messages Query Get all messages
spotifyListening Query Currently playing track
spotifyRecent Query Recently played tracks
giteaFeed Query Latest Gitea activity
steamStatus Query Steam online status
login Mutation Authenticate user
logout Mutation Logout
refreshToken Mutation Refresh auth token
createPost / updatePost / deletePost Mutation Post CRUD (admin)
createUser / deleteUser Mutation User management (admin)
setUserAdmin Mutation Toggle admin status
createFavorite Mutation Add favorite (admin)
createActivity Mutation Add activity (admin)
bookmarks Query Get all bookmarks
createBookmark / deleteBookmark Mutation Bookmark CRUD (admin)
jobApplications Query Get all job applications (admin)
createJobApplication / updateJobApplication / deleteJobApplication Mutation Job application CRUD (admin)

REST Endpoints

Auth

Method Path Description
POST /api/auth/login Login (rate limited: 5/min)
POST /api/auth/refresh Refresh token
GET /api/auth/check Check token validity
POST /api/auth/logout Logout
GET /api/auth/validate-admin Validate admin JWT (used by Caddy's forward_auth admin gate)

Access tokens are valid for 7 days; refresh tokens for 365 days. ValidateAdmin also refreshes the access token if it is within 24 hours of expiry.

Spotify

Method Path Description
GET /api/spotify/callback OAuth callback
GET /api/spotify/listening Currently playing
GET /api/spotify/recent Recently played

Public

Method Path Description
GET /api/favorites Get all favorites
GET /api/rowing Get all rowing sessions
GET /api/activity Get all activities
GET /api/posts Get all posts
GET /api/posts/:id Get post by ID
GET /api/user Get all users
GET /api/user/:id Get user by ID

Protected (auth required)

Method Path Description
POST /api/messages/upload Upload a file for a chat message or a canvas box (rate limited: 30/min, burst 20)

Admin (auth + admin required)

Method Path Description
POST /api/favorites Create favorite
POST /api/rowing Create rowing session
POST /api/activity Create activity
POST /api/posts Create post
PUT /api/posts/:id Update post
DELETE /api/posts/:id Delete post
POST /api/user Create user
PUT /api/user/:id Update user
DELETE /api/user/:id Delete user
PATCH /api/user/:id/admin Set/unset admin
POST /api/radio/upload Upload radio song
GET /api/radio/songs List radio songs
DELETE /api/radio/songs/:filename Delete radio song
PATCH /api/radio/songs/:filename/disable Disable radio song
PATCH /api/radio/songs/:filename/enable Enable radio song

WebSocket

Method Path Description
GET /api/ws WebSocket chat (10s ping keepalive)

Proxy Routes (Caddy)

Route Target Notes
/api backend:8080 API (rate limited: 30r/s)
/radio icecast:8000 Audio streaming
/gitea gitea:3000 Git service
/notes silverbullet-public:3000 Obsidian notes (public, read-only)
/sb silverbullet:3000 Obsidian notes editor (admin-only)
/py python:8000 Python API (FastAPI; docs at /py/docs)
/uploads local alias User-uploaded files

/sb is protected by forward_auth to the backend's /auth/validate-admin. Requests without a valid admin session are redirected to /admin/login. The full table is caddy/routes.caddy; DEPLOYMENT.md §1 explains it.

Deprecated Endpoints

Backend note API (GET /api/notes/*path) - The backend has a REST endpoint that serves note files directly from the mounted Obsidian vault. This is superseded by the public SilverBullet instance which now handles note rendering at /notes/. The backend endpoint still exists in code but is no longer the primary note serving path.

Setup

.env

Create a .env file in the project root. All services read from this file.

Variable Description
POSTGRES_USER PostgreSQL username
POSTGRES_PASSWORD PostgreSQL password
POSTGRES_DB Main app database name
POSTGRES_PORT PostgreSQL port (typically 5432)
POSTGRES_HOST PostgreSQL hostname (use db for Docker)
GITEA_HOST Gitea hostname (use gitea for Docker)
GITEA_PORT Gitea HTTP port (typically 3000)
GITEA_INTERNAL_TOKEN Gitea internal API token (generate with gitea generate secret INTERNAL_TOKEN)
GITEA_LFS_JWT_SECRET Gitea LFS JWT secret (generate with gitea generate secret LFS_JWT_SECRET)
GITEA_OAUTH2_JWT_SECRET Gitea OAuth2 JWT secret (generate with gitea generate secret JWT_SECRET)
POSTGRES_GITEA_DB Gitea database name
UPTIMEKUMA_HOST Uptime Kuma hostname (planned)
UPTIMEKUMA_PORT Uptime Kuma port (planned)
WALLABAG_HOST Wallabag hostname (planned)
WALLABAG_PORT Wallabag port (planned)
SILVERBULLET_HOST SilverBullet hostname (defaults to silverbullet)
SILVERBULLET_PORT SilverBullet port (defaults to 3000)
SILVERBULLET_PUBLIC_HOST Public notes SilverBullet hostname (defaults to silverbullet-public)
SILVERBULLET_PUBLIC_PORT Public notes SilverBullet port (defaults to 3000)
SILVERBULLET_GIT_INTERVAL Seconds between notes commit/push cycles (defaults to 300)
GITEA_RUNNER_HOST Gitea runner hostname
GITEA_RUNNER_NAME Gitea runner display name
GITEA_RUNNER_REGISTRATION_TOKEN Token to register Gitea Actions runner
BACKEND_PORT Backend port (typically 8080)
BACKEND_HOST Backend hostname (use backend for Docker)
BACKEND_SECRET JWT signing secret
BACKEND_ENDPOINT API path prefix (typically /api)
OBSIDIAN_DIR Absolute path to Obsidian vault on host machine
SPOTIFY_CLIENT_ID Spotify app client ID
SPOTIFY_CLIENT_SECRET Spotify app client secret
SPOTIFY_REDIRECT_URI Spotify OAuth redirect (e.g. https://www.<DOMAIN>/api/spotify/callback)
SPOTIFY_AUTH_STATE Arbitrary state string for Spotify OAuth
ICECAST_SOURCE_PASSWORD Icecast source connection password
ICECAST_RELAY_PASSWORD Icecast relay password
ICECAST_ADMIN_USER Icecast admin username
ICECAST_ADMIN_PASSWORD Icecast admin password
ICECAST_HOST Icecast hostname (use icecast for Docker)
ICECAST_PORT Icecast port (typically 8000)
ICECAST_MOUNT Icecast mount point (e.g. /stream)
LIQUIDSOAP_HARBOR_MOUNT Liquidsoap live input mount (e.g. /live)
LIQUIDSOAP_HARBOR_PORT Liquidsoap harbor port (e.g. 8005)
DOMAIN Production domain name
EMAIL Email for Let's Encrypt registration
CLAUDE_API_KEY Anthropic Claude API key (read by the Python service, which makes every Claude call)
STEAM_API_KEY Steam Web API key
STEAM_ID Steam user ID
PYTHON_HOST Python API hostname (defaults to python)
PYTHON_PORT Python API port (defaults to 8000)
SEED_DB Set to true to seed test data on startup

Gitea Config

Gitea is not part of this stack. It runs in its own LXC from the adamf/stpgit repo, whose README covers its config; this stack only runs a forwarder to it (gitea-forwarder/haproxy.cfg).

Spotify Token Setup

  1. After authorization, Spotify redirects to the callback endpoint which stores tokens at /backend/token/spotify_token.json
  2. Tokens are refreshed automatically; the file persists across container restarts via volume mount

Obsidian Notes Setup

  1. Set OBSIDIAN_DIR in .env to the absolute path of your Obsidian vault on the host machine
  2. The vault is mounted read-write into silverbullet at /data, which serves it as an editor at /sb/, and read-only into silverbullet-public, which serves it publicly at /notes/ with SB_READ_ONLY
  3. private/ and templates/ (at any depth), and dot-folders such as .git, are kept off /notes/ by SB_SPACE_IGNORE and Caddy deny rules — the Caddy rules are the ones that actually enforce it. See DEPLOYMENT.md ("Public notes privacy boundary")
  4. The backend also mounts the vault at /backend/notes (legacy, see deprecated endpoints above)

TLS certificates

Caddy obtains and renews them itself, over DNS-01 through the Cloudflare API, so no port has to be reachable from the internet:

  1. Set DOMAIN and CLOUDFLARE_DNS_API_TOKEN in .env (the token needs Zone → Zone → Read and Zone → DNS → Edit on the zone)
  2. docker compose up -d. Caddy serves immediately and fetches both certificates (apex and www) into ./caddy/data within seconds
  3. Renewal is automatic and needs no restart

Dev mode: Caddy issues a certificate for localhost from its own local CA.

Icecast Radio

Place at least one .mp3 file in icecast2/fallback_music/. Liquidsoap plays these as fallback when no live source is connected. Connect a live source to port 8001 on the LIQUIDSOAP_HARBOR_MOUNT.

Gitea Runner

  1. Download the act_runner binary from Gitea releases and place in gitea-runner/
  2. Set GITEA_RUNNER_REGISTRATION_TOKEN in .env
  3. The runner registers automatically on first startup

Dev Mode

Run the full stack over plain HTTP without SSL certificates:

cp .env.dev .env   # committed, dummy values only
docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build

This:

  • Loads Caddy's dev sites (caddy/sites/dev.caddy): all the same routing (SPA via Vite, backend proxy, radio, gitea, etc.) on both http and https, with no redirects or security headers
  • Uses a localhost certificate from Caddy's local CA
  • Disables the Cloudflare tunnel
  • Seeds the database with test data (SEED_DB=true)
  • Enables GraphQL playground and introspection

Visit http://localhost to test.

Frontend only (hot reload)

cd vue && npm run dev

Vite dev server proxies /api, /gitea, /py and /radio. The targets default to localhost:8080, :3000, :8000 and :8000; override them with VITE_PROXY_API, VITE_PROXY_GITEA, VITE_PROXY_PY and VITE_PROXY_RADIO (see the comment in vue/vite.config.js — compose does not publish the backend, Python or Icecast ports to the host).

Checks

make check

Runs the backend's go vet and tests, the Python tests (in a virtualenv created from python/requirements-dev.txt), a Vite build, docker compose config validation and the Caddy image build, which validates the edge config. make help lists the individual targets, plus make generate (regenerate the GraphQL code after a schema edit) and make dev.

The same backend and Python checks run in containers on the Pi on every push; a push to main is only deployed if they pass.

Untracked Files

These files are git-ignored and must be created manually:

File Notes
.env See setup section above
caddy/data/ Created automatically by Caddy (certificates and their keys)
backend/token/ Created automatically by Docker volume mount
icecast2/fallback_music/*.mp3 Place at least one MP3 file
gitea-runner/act_runner Download from Gitea releases
gitea-runner/.runner Generated on first runner startup

Future Ideas

  • ML for chatboards
  • Cache requests
  • Design more webpages
  • Calendar to show radio times
  • Nice smooth function background and transitions
  • Design shrines
  • Redis (not really but practical experience)
S
Description
A web server hosted locally on my rasberry pi
Readme
128 MiB
Languages
Vue 51.1%
Go 18.4%
Python 12.6%
JavaScript 10.2%
Shell 3.8%
Other 3.8%