visitor@semih-os:~$cat /projects/mvk.md

0x01in progress

mvk.org.tr

nextjspostgresqltypescriptdockersecurity

live demo

progress

updated:

6 / 7 stages done
  1. infrastructure, authentication and roles — done
  2. events, registration, waitlist, tickets and attendance — done
  3. Vision Points, badges and verifiable certificate — done
  4. board application — done
  5. content surfaces — done
  6. launch preparation — done
  7. wrap-up: security audit and new server← now

What it does

The club’s operating system: membership and email verification, event registration and waitlist, QR-ticket entry at the door, automatic points from attendance, badges, verifiable participation certificates, board applications and news/gallery content. It was written custom instead of using an off-the-shelf CMS, because the core of the system — points, attendance, certificates — rests on rules that no ready-made plugin could satisfy.

The immutable points ledger

The points balance isn’t stored as a number anywhere; it’s always the sum of the transactions (SUM(miktar)). A BEFORE UPDATE OR DELETE trigger on the transactions table raises an exception — so even if the application has a bug, history can’t be rewritten. Correcting wrongly awarded points is also a new row, with the opposite sign.

The step from attendance to points is idempotent: a partial unique index on (uye_id, kaynak_tur, kaynak_id) and a single insert … on conflict do nothing mean the same attendance can’t produce points twice. The no-show penalty follows a two-gate rule: absence of data is not absence of attendance — an event where attendance wasn’t taken penalizes no one.

Verifiable certificate

The authority is the verification page, not the PDF. The PDF is never stored; it’s regenerated on every request, and the QR code on it leads to the /dogrula/{kod} page. The code is 16 characters drawn from a 32-letter alphabet with look-alike letters removed — 80 bits, yet still readable off the paper and typeable by hand. Lookups are rate-limited and KVKK (Turkey’s data protection law) consent is checked live on every request: a member who withdraws consent no longer has their certificate verified.

Capacity and tickets

Event capacity is protected with a FOR UPDATE lock on the event row; doing “count first, then insert” as two separate queries is forbidden by rule. QR tickets are HMAC-signed and single-use; at a door with no internet, check-ins are queued in IndexedDB and synced through a single path.

Deployment pipeline

next build never runs on the server. The image is built in GitHub Actions once the tests pass and pushed to a private GHCR; the server only pulls it. There are no publicly exposed ports — traffic comes in through Cloudflare Tunnel. The weekly update script takes a backup first, then runs a health check through the public address; if that fails, it rolls itself back. Updates that include database migrations are not applied automatically.

Layer Technology
Application Next.js 16 (App Router, Server Actions), React 19, TypeScript
Data PostgreSQL 17, Drizzle ORM — every migration has a hand-written rollback
Auth Hand-written: argon2id, only a token hash in the sessions table, magic link, TOTP
Testing Vitest (unit + integration against a real Postgres), Playwright + axe
Infrastructure Docker, GHCR, Cloudflare Tunnel, systemd timers, encrypted backups with age

Where I am now

All six phases are done. I’m in the wrap-up stage: a full security and “unattended operation” audit, dependency updates and the move to a new server. In the meantime, the site is on a maintenance page.