# hackclub/haven architecture

> Architecture diagram of the GitHub repository hackclub/haven, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hackclub/haven
- Repository: https://github.com/hackclub/haven

## Overview

Haven is a global teen game-jam website and organizer platform. Visitors explore event information and city pages or find events on a map; organizers authenticate with Hack Club Auth, then complete a prefilled Fillout form. Airtable supplies event data that the server syncs into PostgreSQL for pages and map views. Separate Slack workflows handle help-channel tickets, signup leaderboards, and signup notifications. The graph preserves these documented product branches; unsampled route internals are represented at their exact paths, and links rely on README statements where source calls were not shown.

Main entry points: [`src/lib/server/services/events.ts`](https://github.com/hackclub/haven/blob/main/src/lib/server/services/events.ts) (Event synchronization), [`src/lib/server/db/index.ts`](https://github.com/hackclub/haven/blob/main/src/lib/server/db/index.ts) (Database access), [`src/lib/slack.ts`](https://github.com/hackclub/haven/blob/main/src/lib/slack.ts) (Tickets and signup bot), [`src/routes/(cities)/[slug]/+page.server.ts`](https://github.com/hackclub/haven/blob/main/src/routes/(cities)/%5Bslug%5D/%2Bpage.server.ts) (City pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Public website"]
  node_landing["Landing experience<br/>[+page.svelte]"]
  node_hero["Hero and signup<br/>[Hero.svelte]"]
  node_signupform["Email signup form<br/>[SignupForm.svelte]"]
  node_citypages["City pages<br/>[+page.server.ts]"]
  node_mapview["Events map<br/>[+page.svelte]"]
  node_mapcomponent["Map renderer<br/>[Map.svelte]"]
  node_sitecontent["Site content defaults<br/>[content.ts]"]
  node_siteconfig["Resolved site data<br/>[site.ts]"]
  node_sitevalidation["Site data validation<br/>[types.ts]"]
end

subgraph group_organizer["Organizer signup"]
  node_auth["HCA authentication<br/>[+server.ts]"]
  node_authcallback["Auth callback<br/>[+server.ts]"]
  node_fillout["Organizer form handoff<br/>[+server.ts]"]
  node_filloutsubmit["Form submission<br/>[+server.ts]"]
end

subgraph group_events["Event data"]
  node_sync["Event synchronization<br/>[events.ts]"]
  node_airtableservice["Airtable client<br/>[airtable.ts]"]
  node_postgres[("PostgreSQL<br/>[schema.ts]")]
  node_dbaccess["Database access<br/>[index.ts]"]
  node_crypto["Encrypted columns<br/>[columns.ts]"]
  node_ticketdb[("Ticket and signup state<br/>[schema.ts]")]
end

subgraph group_community["Slack operations"]
  node_slackendpoint["Slack event endpoint<br/>[+server.ts]"]
  node_slackbot["Tickets and signup bot<br/>[slack.ts]"]
  node_signupendpoint["Signup notification endpoint<br/>[+server.ts]"]
end

node_visitor(("Visitor"))
node_organizer(("Event organizer"))
node_airtable[("Airtable API")]
node_slackuser(("Slack users and automations"))
node_slackservice{{"Slack platform"}}

node_visitor -->|"visits"| node_landing
node_visitor -->|"opens event"| node_citypages
node_visitor -->|"explores events"| node_mapview
node_hero -->|"renders"| node_signupform
node_hero -->|"renders"| node_mapcomponent
node_landing -.->|"uses defaults"| node_sitecontent
node_citypages -->|"resolves customization"| node_siteconfig
node_siteconfig -->|"validates data"| node_sitevalidation
node_organizer -->|"starts sign-in"| node_auth
node_auth -->|"redirects"| node_authcallback
node_authcallback -->|"continues signup"| node_fillout
node_fillout -.->|"submits form"| node_filloutsubmit
node_fillout -->|"prefills form"| node_organizer
node_sync -->|"lists records"| node_airtableservice
node_airtableservice -->|"fetches events"| node_airtable
node_sync -->|"writes and queries"| node_dbaccess
node_dbaccess -->|"queries"| node_postgres
node_citypages -->|"uses synced events"| node_sync
node_mapview -->|"shows synced events"| node_sync
node_crypto -->|"encrypts columns"| node_postgres
node_slackuser -->|"sends events"| node_slackendpoint
node_slackendpoint -->|"routes events"| node_slackbot
node_slackuser -->|"triggers signup notice"| node_signupendpoint
node_signupendpoint -->|"announces signup"| node_slackbot
node_slackbot -->|"posts messages"| node_slackservice
node_slackbot -->|"reads and writes"| node_dbaccess
node_dbaccess -->|"stores state"| node_ticketdb

click node_landing "https://github.com/hackclub/haven/blob/main/src/routes/%2Bpage.svelte"
click node_hero "https://github.com/hackclub/haven/blob/main/src/lib/components/Hero.svelte"
click node_signupform "https://github.com/hackclub/haven/blob/main/src/lib/components/SignupForm.svelte"
click node_citypages "https://github.com/hackclub/haven/blob/main/src/routes/(cities)/%5Bslug%5D/%2Bpage.server.ts"
click node_mapview "https://github.com/hackclub/haven/blob/main/src/routes/map/%2Bpage.svelte"
click node_mapcomponent "https://github.com/hackclub/haven/blob/main/src/lib/components/Map.svelte"
click node_sitecontent "https://github.com/hackclub/haven/blob/main/src/lib/data/content.ts"
click node_siteconfig "https://github.com/hackclub/haven/blob/main/src/lib/data/site.ts"
click node_sitevalidation "https://github.com/hackclub/haven/blob/main/src/lib/data/types.ts"
click node_auth "https://github.com/hackclub/haven/blob/main/src/routes/api/auth/redirect/%2Bserver.ts"
click node_authcallback "https://github.com/hackclub/haven/blob/main/src/routes/api/auth/callback/%2Bserver.ts"
click node_fillout "https://github.com/hackclub/haven/blob/main/src/routes/api/fillout/poc-auth/%2Bserver.ts"
click node_filloutsubmit "https://github.com/hackclub/haven/blob/main/src/routes/api/fillout/poc-submit/%2Bserver.ts"
click node_sync "https://github.com/hackclub/haven/blob/main/src/lib/server/services/events.ts"
click node_airtableservice "https://github.com/hackclub/haven/blob/main/src/lib/server/services/airtable.ts"
click node_postgres "https://github.com/hackclub/haven/blob/main/src/lib/server/db/schema.ts"
click node_dbaccess "https://github.com/hackclub/haven/blob/main/src/lib/server/db/index.ts"
click node_crypto "https://github.com/hackclub/haven/blob/main/src/lib/server/db/columns.ts"
click node_slackendpoint "https://github.com/hackclub/haven/blob/main/src/routes/api/slack/events/%2Bserver.ts"
click node_slackbot "https://github.com/hackclub/haven/blob/main/src/lib/slack.ts"
click node_signupendpoint "https://github.com/hackclub/haven/blob/main/src/routes/api/airtable/signup/%2Bserver.ts"
click node_ticketdb "https://github.com/hackclub/haven/blob/main/src/lib/server/db/schema.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_landing,node_hero,node_signupform,node_citypages,node_mapview,node_mapcomponent,node_sitecontent,node_siteconfig,node_sitevalidation,node_slackuser toneBlue
class node_auth,node_authcallback,node_fillout,node_filloutsubmit,node_airtable toneAmber
class node_sync,node_airtableservice,node_postgres,node_dbaccess,node_crypto,node_ticketdb toneMint
class node_slackendpoint,node_slackbot,node_signupendpoint toneRose
class node_visitor,node_organizer,node_slackservice toneIndigo
```

## Components

### Public website

- [Landing experience](https://github.com/hackclub/haven/blob/main/src/routes/%2Bpage.svelte): `src/routes/+page.svelte`
- [Hero and signup](https://github.com/hackclub/haven/blob/main/src/lib/components/Hero.svelte): `src/lib/components/Hero.svelte`
- [Email signup form](https://github.com/hackclub/haven/blob/main/src/lib/components/SignupForm.svelte): `src/lib/components/SignupForm.svelte`
- [City pages](https://github.com/hackclub/haven/blob/main/src/routes/(cities)/%5Bslug%5D/%2Bpage.server.ts): `src/routes/(cities)/[slug]/+page.server.ts`
- [Events map](https://github.com/hackclub/haven/blob/main/src/routes/map/%2Bpage.svelte): `src/routes/map/+page.svelte`
- [Map renderer](https://github.com/hackclub/haven/blob/main/src/lib/components/Map.svelte): `src/lib/components/Map.svelte`
- [Site content defaults](https://github.com/hackclub/haven/blob/main/src/lib/data/content.ts): `src/lib/data/content.ts`
- [Resolved site data](https://github.com/hackclub/haven/blob/main/src/lib/data/site.ts): `src/lib/data/site.ts`
- [Site data validation](https://github.com/hackclub/haven/blob/main/src/lib/data/types.ts): `src/lib/data/types.ts`

### Organizer signup

- [HCA authentication](https://github.com/hackclub/haven/blob/main/src/routes/api/auth/redirect/%2Bserver.ts): `src/routes/api/auth/redirect/+server.ts`
- [Auth callback](https://github.com/hackclub/haven/blob/main/src/routes/api/auth/callback/%2Bserver.ts): `src/routes/api/auth/callback/+server.ts`
- [Organizer form handoff](https://github.com/hackclub/haven/blob/main/src/routes/api/fillout/poc-auth/%2Bserver.ts): `src/routes/api/fillout/poc-auth/+server.ts`
- [Form submission](https://github.com/hackclub/haven/blob/main/src/routes/api/fillout/poc-submit/%2Bserver.ts): `src/routes/api/fillout/poc-submit/+server.ts`

### Event data

- [Event synchronization](https://github.com/hackclub/haven/blob/main/src/lib/server/services/events.ts): `src/lib/server/services/events.ts`
- [Airtable client](https://github.com/hackclub/haven/blob/main/src/lib/server/services/airtable.ts): `src/lib/server/services/airtable.ts`
- [PostgreSQL](https://github.com/hackclub/haven/blob/main/src/lib/server/db/schema.ts): `src/lib/server/db/schema.ts`
- [Database access](https://github.com/hackclub/haven/blob/main/src/lib/server/db/index.ts): `src/lib/server/db/index.ts`
- [Encrypted columns](https://github.com/hackclub/haven/blob/main/src/lib/server/db/columns.ts): `src/lib/server/db/columns.ts`
- [Ticket and signup state](https://github.com/hackclub/haven/blob/main/src/lib/server/db/schema.ts): `src/lib/server/db/schema.ts`

### Slack operations

- [Slack event endpoint](https://github.com/hackclub/haven/blob/main/src/routes/api/slack/events/%2Bserver.ts): `src/routes/api/slack/events/+server.ts`
- [Tickets and signup bot](https://github.com/hackclub/haven/blob/main/src/lib/slack.ts): `src/lib/slack.ts`
- [Signup notification endpoint](https://github.com/hackclub/haven/blob/main/src/routes/api/airtable/signup/%2Bserver.ts): `src/routes/api/airtable/signup/+server.ts`

### Other components

- **Visitor**
- **Event organizer**
- **Airtable API**
- **Slack users and automations**
- **Slack platform**

## Connections

- Visitor → Landing experience: visits (evidence: `README.md`)
- Visitor → City pages: opens event (evidence: `README.md`)
- Visitor → Events map: explores events (evidence: `README.md`)
- Hero and signup → Email signup form: renders (evidence: `src/lib/components/Hero.svelte`)
- Hero and signup → Map renderer: renders (evidence: `src/lib/components/Hero.svelte`)
- Landing experience → Site content defaults: uses defaults
- City pages → Resolved site data: resolves customization (evidence: `README.md`)
- Resolved site data → Site data validation: validates data (evidence: `src/lib/data/site.ts`)
- Event organizer → HCA authentication: starts sign-in (evidence: `README.md`)
- HCA authentication → Auth callback: redirects (evidence: `README.md`)
- Auth callback → Organizer form handoff: continues signup (evidence: `README.md`)
- Organizer form handoff → Form submission: submits form
- Organizer form handoff → Event organizer: prefills form (evidence: `README.md`)
- Event synchronization → Airtable client: lists records (evidence: `src/lib/server/services/events.ts`)
- Airtable client → Airtable API: fetches events (evidence: `src/lib/server/services/airtable.ts`)
- Event synchronization → Database access: writes and queries (evidence: `src/lib/server/services/events.ts`)
- Database access → PostgreSQL: queries (evidence: `README.md`)
- City pages → Event synchronization: uses synced events (evidence: `README.md`)
- Events map → Event synchronization: shows synced events (evidence: `README.md`)
- Encrypted columns → PostgreSQL: encrypts columns (evidence: `src/lib/server/db/columns.ts`)
- Slack users and automations → Slack event endpoint: sends events (evidence: `README.md`)
- Slack event endpoint → Tickets and signup bot: routes events (evidence: `README.md`)
- Slack users and automations → Signup notification endpoint: triggers signup notice (evidence: `README.md`)
- Signup notification endpoint → Tickets and signup bot: announces signup (evidence: `README.md`)
- Tickets and signup bot → Slack platform: posts messages (evidence: `README.md`)
- Tickets and signup bot → Database access: reads and writes (evidence: `src/lib/slack.ts`)
- Database access → Ticket and signup state: stores state (evidence: `src/lib/server/db/schema.ts`)
