2.0 KiB
2.0 KiB
Plumber — follow-ups
From the project review. Priority order within each section.
Fix soon
- Persist sessions — Sessions live in the app DB (
sessionstable) viapostgresstore. Opaque cookie unchanged; unusedSESSION_SECRETremoved from config /.env.example. - Drop Dockerfile — Deploying on DigitalOcean App Platform (buildpack from
go.mod); no container image needed. - Rune-safe truncation —
title[:120],body[:8000],city[:80], answer body, etc. can split multi-byte UTF-8. Truncate by runes (or safely). - Admin bootstrap —
ADMIN_USERNAMEseeds the first admin on register only when no admin exists. Promote/demote via/admin/users(admins only); roles stay inusers.role.
Docs & ops
- README — How to run locally, env vars (from
.env.example), admin bootstrap, PlanetScaleDATABASE_URL, App Platform notes (PORT,SECURE_COOKIE=1). - Migrations story — Schema is applied on boot from
schema.sql(+ sessions DDL). OK for v1; plan real migrations before schema drifts. - App Platform listen port — Prefers
PORT, thenLISTEN, then:8080. - Prod DB = PlanetScale Postgres — App opens Postgres via required
DATABASE_URL; DSN cleanup strips PlanetScale/libpq-only params (sslrootcert=system,sslnegotiation). Use dashboard URI on 5432 for boot schema create; 6432 (PgBouncer) later if you need pooling.
Smaller / later
- Rate-limit login/register (bcrypt helps; still open to brute-force).
- Graceful shutdown instead of bare
ListenAndServe. - More tests: vote HTMX paths, admin answer/hide, archive redirects; optional Postgres integration test.
Suggested order of attack
Persist sessionsdone.Drop Dockerfiledone (App Platform).Wiredone.PORTAdmin roles pagedone.- Short README (run, env, admin, App Platform + PlanetScale).
- Rune-safe truncation + a couple of handler tests (vote, admin hide).