1.5 KiB
1.5 KiB
SnapAPI Session Log
Session 1 — 2026-02-18
Goal: Build core SnapAPI from scratch and deploy to cluster.
What Was Done
- Studied DocFast patterns — reviewed all key files (index.ts, db.ts, keys.ts, browser.ts, auth.ts, usage.ts, Dockerfile, CI/CD workflows)
- Built complete SnapAPI application:
- Express + TypeScript + Puppeteer screenshot service
- SSRF protection (blocks private IPs, metadata endpoints, K8s DNS)
- Browser pool (configurable count × pages, auto-recycling)
- PostgreSQL integration (api_keys + usage tables, retry logic)
- Auth middleware (Bearer token or X-API-Key)
- Usage tracking with per-key monthly limits
- Free signup endpoint
- Landing page with docs, features, pricing
- CI/CD workflow files (deploy.yml + promote.yml)
- Docker image built on k3s-mgr (ARM64, ~1.2GB with Chromium)
- Deployed to staging (snapapi-staging namespace, 1 replica)
- Verified working:
- Health check: ✅
- Free signup: ✅ (returns API key)
- Screenshot: ✅ (200, 18KB PNG of example.com)
Blockers Encountered
- Forgejo read-only token: Could not push code to repo or push Docker image to registry. Had to build image directly on k3s-mgr and import via containerd (docker save | k3s ctr images import)
- No domain: Can't set up Traefik IngressRoute or production deployment
Image on workers
- Imported manually via
docker save | ssh | k3s ctr images importto both k3s-w1 and k3s-w2 - Uses
imagePullPolicy: IfNotPresentsince image is pre-loaded