as

Projects / Buzz

Buzz

The SASE at Georgia Tech site and member portal. I built it as a Bun and Turborepo monorepo: a public site that can render with an empty environment, and a portal that owns the session, the points, and the elections.

Why

The chapter needs a public site (about, programs, events, board, sponsors) and a member portal (RSVP, QR check-in, points, committees, mentorship groups, officer elections). The public pages should stay up when the database is asleep, and they should not ship the portal’s client. The portal should not be able to rewrite history when an officer changes an event’s point value, and a photographed check-in slide should be revocable.

Query splits club and hackathon inside one portal, and puts the yearly marketing site in a second deploy. Buzz makes a sharper cut inside one Next.js app: public routes and /portal/** do not share a layout, a session read, or a client bundle.

Architecture

sites/web is Next.js 16 and Tailwind v4. Packages ship TypeScript and the app transpiles them: @buzz/db (Drizzle), @buzz/auth (NextAuth, Google only), @buzz/api (tRPC). sites/discord-bot is its own Vercel project. Its functions are bundled with bun build, and its tables live in a discord_bot schema in the same Postgres. packages/mcp is an MCP server that reads the source at call time: procedures, schema, migrations, routes.

Two halves. The public layout mounts no client providers. The portal layout mounts the tRPC client.
visitor app/(marketing) Prerendered. No session read. / and /events use a cached calendar query and render an empty calendar when DATABASE_URL is unset.
member app/portal Dynamic. Session and database on the request. Left out of the index by robots.ts and the layout metadata.

Portal calls route handlers. Marketing does not.

auth @buzz/auth Google OAuth. Other origins bounce through the production callback.
api @buzz/api tRPC. Officer procedures are a separate gate from member procedures.
data @buzz/db Drizzle. Web tables and the discord_bot schema.

Uptime stays off this path

every 10 minutes GitHub Actions Fetches prerendered /about and /portal/signin. Writes uptime.json on the uptime-data branch.
browser /status Reads that file. No function and no database.

The public site builds with an empty environment. Production fails the build when a portal secret is missing, rather than shipping a sign-in button that cannot complete. Google has one registered callback, on production. AUTH_REDIRECT_PROXY_URL sends localhost and preview origins through it. AUTH_SECRET has to match on the machine that starts sign-in and on production, or the bounce back fails.

Diagrams

A solid outline is the path in the repo. A dashed outline is the alternative that shape is refusing.

Marketing routes prerender with no session read. /portal is dynamic and calls tRPC. The uptime workflow fetches two prerendered URLs and writes uptime.json. /status reads that file and does not open Postgres.

flowchart TD
  visitor[Visitor]
  marketing["Marketing routes, no session"]
  portal["/portal, session and tRPC"]
  db["Drizzle Postgres"]
  bot["Discord bot, its own Vercel project"]
  actions["GitHub Actions, every 10 minutes"]
  status["/status reads uptime.json"]
  visitor --> marketing
  visitor --> portal
  portal --> db
  bot -->|"discord_bot schema"| db
  actions -->|"GET /about and /portal/signin"| status
  class marketing,portal,db,bot,actions,status chosen
          

Public pages and the portal do not share a layout, so a session read cannot pull the portal client onto the CDN pages. Points are copied onto the attendance row. Changing pointsValue later does not rewrite them.

flowchart TD
  layout{Public pages and the portal}
  layout -->|"no shared session read"| split["Two layouts, two bundles"]
  layout -->|"one session read in the root layout"| one["Shared layout"]
  points{An officer changes the point value}
  points -->|"stamp pointsEarned and leave it"| stamp["Old totals stay"]
  points -->|"recompute every check-in"| live["Rewrite the ledger"]
  class split,stamp chosen
  class one,live rejected
          

The timer hits /about and /portal/signin because both are prerendered. /api/health does talk to the database. Putting it on the timer would wake Postgres to answer whether the site is up.

flowchart TD
  probe{What the 10 minute check fetches}
  probe -->|"prerendered, no database"| cdn["/about and /portal/signin"]
  probe -->|"wakes Postgres every run"| health["/api/health on the timer"]
  class cdn chosen
  class health rejected
          

Why this shape

Points are stamped, then left alone

An event has a pointsValue. Check-in copies that number onto the attendance row as pointsEarned and never recomputes it. Officers and members earn the same amount. Changing the event later changes what a future check-in is worth. Existing totals stay. A member’s total is one aggregate over their own check-ins. Tiers are derived at render time from a table in the app, so changing a tier does not need a migration.

Archived events drop out at read time: totals, the leaderboard, the roster, voting eligibility. Restoring the event brings those points back. Rows written while it was archived are not recomputed. Archive is a filter, not a ledger rewrite.

The check-in code is a bearer token

Each event gets an 8-character code from an alphabet with no I, L, O, U, 0, or 1. Members do not type it. /portal/check-in reads the QR off the projector. The plain code is what the slide encodes, and what rotation replaces. Anyone holding it can check in, so member-facing queries do not select it. Rotating it revokes a photographed slide on the next scan. A blocked camera can open the page from the phone’s own camera, which puts the code in the URL, or an officer can add the member by hand.

One vote per position, in the primary key

Officer elections move by hand through nominating, voting, closed, and published. A member can vote with at least one check-in this school year at an event that is not archived. One vote per position is the table’s primary key, so a second insert fails in Postgres even if a procedure forgets the check. No endpoint returns who voted for whom. Closed shows counts to officers. Published shows counts to members.

CSV export has one writer

The roster and the per-event attendance export go through src/app/portal/_lib/csv.ts. A leading =, +, -, @, tab, or carriage return in a display name is neutralized, so a name cannot become a formula when an officer opens the file. The roster export is its own procedure. It is not a loop over the page of 25.

Status checks must not wake the database

/status shows 24-hour timings and 90 days of uptime from uptime.json, which the browser fetches. The workflow probes /about and /portal/signin because both are prerendered and served from the CDN. /api/health does talk to the database, and so do the home page and /events when a calendar query is configured. Pointing the probe at those would wake Postgres every ten minutes to answer “is the site up.” A failed probe fails the workflow, which GitHub mails to watchers. GET /api/health is still there for a human: 200 when the database answers, 503 when it does not, and nothing else.

Failure modes

A session read in the marketing layout

The public pages stay free of React Query and the tRPC client because the root layout mounts no providers and those routes never call auth(). One session read in a shared layout pulls the portal client onto every public page and makes the CDN page depend on a session cookie. The split is a directory boundary, app/(marketing) versus app/portal. It is not a runtime check.

Archive and reprice do not agree with intuition

Repricing does not change points already earned. Archiving hides them until the event is restored. A check-in recorded while the event was archived keeps the stamp from that moment. An officer who archives, reprices, and restores will see the old stamps, not the new price. That is the ledger working. It looks like a bug if the UI only shows the current pointsValue.

The QR code is whoever holds the string

Rotation revokes the previous code. Until someone rotates it, a photo, a forwarded URL, or a slide left on a laptop checks people in. The alphabet and the 8-character length make it easy to read off a projector. They do not make it a secret with a per-member signature. Hand-added attendance is the audit path for people who never scanned.

The uptime file can be green while the portal is down

The probe measures time to first byte on two prerendered URLs. A broken DATABASE_URL, a failing migration, or a tRPC error on an officer procedure will not change /about. /status will stay green. /api/health is the check that would catch the database, and it is deliberately not on the timer. Runtime logs are the other half: every thrown tRPC error is one JSON line, warning when the API refused on purpose, error with a stack when it did not.

The OAuth proxy shares a secret

Preview and localhost sign-in work because they borrow production’s callback. That only holds while AUTH_SECRET matches on both sides. A rotated production secret with a stale local .env fails the bounce back, and Google still looks correctly configured, because Google only ever sees the production URI.

Where to read it

The split, the points rules, elections, and the uptime workflow are in the Buzz README. Schema changes go through Drizzle Kit: generate SQL, commit it, migrate. The discord bot has its own README under sites/discord-bot.

The club platform with the other shape of this problem is Query.