No description
- Rust 53.7%
- HTML 38.7%
- Shell 4.4%
- Dockerfile 1.8%
- JavaScript 1.4%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| api-gateway-service | ||
| deploy | ||
| docker | ||
| fmd | ||
| frontend | ||
| scripts | ||
| .dockerignore | ||
| .gitignore | ||
| .semgrepignore | ||
| .trivyignore | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| docker-compose.website.yml | ||
| env.website.example | ||
| LICENSE | ||
| README.md | ||
| renovate.json | ||
My Stupid Website
A small DevOps playground for experimenting with infra, routing, and Rust services. It is now a static vanilla frontend (frontend/) served by Nginx, with Rust services behind /api.
What’s inside
- Frontend (
frontend/): static HTML/CSS/JS terminal-style site. - API gateway (
api-gateway-service/): Rust Axum gateway handling sessions/CSRF and proxying downstream routes. - FMD service (
fmd/): Rust fetch -> HTML -> Markdown service used by the tools page via the gateway. - Docker and deployment config (
docker/,docker-compose.website.yml,deploy/,charts/).
Quick start
- Copy env template and fill required values:
cp env.website.example .env- set
SESSION_SECRET,FMD_TOKEN, and image tag values.
- Start the stack:
docker compose -p website-dev -f docker-compose.website.yml --env-file .env up -d
- Open frontend on
http://localhost:${FRONTEND_PORT}(default8091). - API flows through
/api/*to the gateway. Public docs routes were removed. - Useful runtime checks:
docker compose -p website-dev -f docker-compose.website.yml psdocker compose -p website-dev -f docker-compose.website.yml logs -f api-gateway
How to use web-to-markdown via CURL
The Web → Markdown tool is exposed via the gateway at POST /api/fmd/v1/fetch-md. It requires a gateway session cookie plus CSRF headers.
#!/usr/bin/env bash
set -euo pipefail
BASE="https://gitgud.zip"
COOKIE_JAR="/tmp/gw.cookies"
SESSION_JSON="/tmp/gw.session.json"
# 1) Create a session (stores cookie, returns CSRF tokens)
curl -fsS -c "$COOKIE_JAR" -X POST "$BASE/api/session" > "$SESSION_JSON"
# 2) Extract CSRF fields
CSRF_TOKEN=$(sed -n 's/.*"csrfToken":"\\([^"]*\\)".*/\\1/p' "$SESSION_JSON" | head -n1)
CSRF_PROOF=$(sed -n 's/.*"csrfProof":"\\([^"]*\\)".*/\\1/p' "$SESSION_JSON" | head -n1)
# 3) Fetch markdown
curl -fsS -b "$COOKIE_JAR" \
-H "Content-Type: application/json" \
-H "x-gateway-csrf: $CSRF_TOKEN" \
-H "x-gateway-csrf-proof: $CSRF_PROOF" \
-d '{"url":"https://example.com/"}' \
"$BASE/api/fmd/v1/fetch-md" > page.md
Frontend cache busting
Static assets under /css and /js are cached aggressively by browsers/CDN, so every frontend asset change should rotate the cache-bust token used in frontend/**/*.html query params.
Use a random token each time, then replace all existing cb-... tokens:
export TOKEN="cb-$(openssl rand -hex 6)"
python - <<'PY'
from pathlib import Path
import os, re
token = os.environ["TOKEN"]
for p in Path("frontend").rglob("*.html"):
s = p.read_text()
s2 = re.sub(r"cb-[0-9a-f]{12}", token, s)
if s != s2:
p.write_text(s2)
PY
Do this whenever you change frontend-delivered assets (for example frontend/css/style.css or frontend/js/howto.js).
Why
- I like building my own toys when I’m bored, so this is where I tinker without any production pressure.
- It lets me try random ideas just because I can.