Skip to main content
Buildstory uses Neon Postgres with Drizzle ORM. This page documents all tables, fields, enums, and relationships.

Schema Location

The authoritative schema is defined in lib/db/schema.ts.

Enums

experience_level

User’s experience level with building AI projects.
  • getting_started — New to building with AI
  • built_a_few — Some experience shipping AI projects
  • ships_constantly — Regular AI builder/shipper

event_status

Lifecycle status of an event.
  • draft — Event created but not visible to users
  • open — Registration is open
  • active — Event is in progress
  • judging — Event ended, judging in progress
  • complete — Event fully complete

team_preference

User’s team status for an event.
  • solo — Building alone
  • has_team — Already has a team (closed)
  • has_team_open — Has a team but open to more members
  • looking_for_team — Looking for teammates

starting_point

Whether a project is new or continues existing work.
  • new — Brand new project
  • existing — Continuing an existing project

commitment_level

User’s availability commitment for an event.
  • all_in — Full-time commitment
  • daily — Daily progress
  • nights_weekends — Part-time availability
  • not_sure — Uncertain availability

user_role

User’s role in the platform.
  • user — Default user role
  • moderator — Can hide and ban users
  • admin — Full platform access

invite_status

Status of a team invite.
  • pending — Awaiting response
  • accepted — Invite accepted
  • declined — Invite declined
  • revoked — Invite revoked by sender

invite_type

Type of team invite.
  • direct — Direct invite to a specific user (has recipientId)
  • link — Shareable link invite (has token)

mentor_application_status

Status of a mentor application.
  • pending — Awaiting review
  • approved — Application approved
  • declined — Application declined

sponsorship_inquiry_status

Status of a sponsorship inquiry.
  • pending — Awaiting review
  • contacted — Initial contact made
  • accepted — Sponsorship accepted
  • declined — Sponsorship declined

Core Tables

profiles

User profiles linked to Clerk authentication.

events

Hackathons and other building events.

eventRegistrations

Links profiles to events with team preferences.

projects

User-created projects.

eventProjects

Junction table linking projects to events.

teamInvites

Team invitations for projects.

projectMembers

Project team members.

Admin Tables

adminAuditLog

Audit log for admin actions.

mentorApplications

Mentor application submissions.

Additional Tables

sponsorshipInquiries

Sponsorship inquiry submissions.

twitchCategories

Twitch game/category tracking.

prizeDraws

Prize draw results.

users (Legacy)

Legacy user table (retained for compatibility).

Relationships

Profile Relations

  • profiles.eventRegistrations → many eventRegistrations
  • profiles.projects → many projects (owned)
  • profiles.sentInvites → many teamInvites (as sender)
  • profiles.receivedInvites → many teamInvites (as recipient)
  • profiles.projectMemberships → many projectMembers

Event Relations

  • events.eventRegistrations → many eventRegistrations
  • events.eventProjects → many eventProjects

Project Relations

  • projects.profile → one profiles (owner)
  • projects.eventProjects → many eventProjects
  • projects.members → many projectMembers
  • projects.invites → many teamInvites

Admin Relations

  • adminAuditLog.actor → one profiles
  • adminAuditLog.target → one profiles (nullable)
  • mentorApplications.reviewer → one profiles (nullable)

Migration Workflow

  1. Modify schema in lib/db/schema.ts
  2. Generate migration: npm run db:generate
  3. Review generated SQL in drizzle/migrations/
  4. Test against dev branch: npm run db:migrate
  5. Commit migration file
  6. CI automatically runs migrations on production after PR merge
Never use db:push in production. All schema changes must go through migration files.

Build docs developers (and LLMs) love