Mike (@mikerb95)CodeByMike
Back
/architectureSystems design

How this is
built.

This site isn't a template: it's a system with a private panel, custom monitoring, and a payment gateway. Here's its anatomy (layer by layer) and the reasoning behind each decision.

Client
Visitor's browser
SSR HTML + islands
Astro ships rendered HTML; JS only where it is actually needed.
RUM web-vitals
Measures real LCP/INP/CLS and sends them via beacon.
Edge
Vercel - Edge & Functions
CDN + cache
Public pages with s-maxage + stale-while-revalidate.
Middleware
Auth, allowlist, security headers (CSP/HSTS), chaos flags.
SSR Functions
Astro server output: dynamic routes and API on Node.
Application
Astro 7 (SSR) + Auth.js
/admin panel
CRM, costs/P&L, encrypted vault, monitors, LAB.
API routes
Typed REST endpoints; server-side validation.
JWT auth
GitHub OAuth + allowlist; revocable per-device sessions.
Data
Turso (libSQL) + Drizzle ORM
Typed schema
Drizzle: versioned migrations in git.
AES-256-GCM secrets
Credentials encrypted at rest; revealed on demand.

External services

cron-job.org
Triggers the check engine every few minutes (the Hobby plan only gives 1 cron/day).
ntfy.sh
Push to my phone: outages, expiring SSL, new admin session.
GitHub Actions
CI: tests + coverage → logs every run and enables rollback.
GitHub OAuth
Sole identity provider for the panel.
Resend
Transactional email for alerts (secondary channel).

Decisions and trade-offs

SSR over pure static

The private panel needs live data and per-request auth. Public pages are cached at the edge, so I pay for SSR only where it pays off and serve the rest almost for free.

Stateless JWT, no DB sessions

Logins without touching the database and zero session infrastructure. The blind spot - revocation - I solved with a signed sid inside the token and a device table, without giving up the JWT.

Turso/libSQL instead of Postgres

SQLite at the edge: minimal latency, replicas, and a simple mental model for a domain that does not need massive concurrency. Drizzle keeps the schema typed and migrations in git.

External cron instead of Vercel’s

The Hobby plan limits you to one daily cron, useless for uptime. An external cron hits a token-authenticated endpoint every few minutes; Vercel's cron becomes a safety net. The platform's constraint was the start of the design, not the end of it.

Fail-open on everything secondary

Telemetry, session logging, and notifications must never take down the main flow. If an observability subsystem fails, it degrades silently instead of breaking the experience.

All the code lives in a public repository as a portfolio. The decisions here are not theory: each one has its commit, its tests, and - where it applies - its security finding documented at /security.