Appearance
Core Database
The core database is the platform's central directory. It answers three questions:
- Who is this user? (mapped from their Clerk sign-in)
- What organizations do they belong to? (and what role do they have in each)
- Where is that organization's data? (points to the right database)
Tables at a Glance
| Table | What It Stores | Key Relationships |
|---|---|---|
| Users | Name, email, phone — synced from Clerk | → has Memberships |
| Organizations | League name, code, branding, database pointer | → has Members, Invite Codes, Config |
| Memberships | Who belongs to which org, with what role | → links Users to Organizations |
| Invite Codes | Join codes like FARM-PARENT-2026 | → belongs to an Organization |
| Config | Per-org plan tier and feature flags | → one per Organization |
| Audit Log | Who did what, when, and why | → tracks admin actions |
Key Concepts
One user, many orgs. A parent can belong to multiple leagues.
One user, many roles. A coach can also be a parent in the same org. Each role is a separate membership record.
Invite codes control access. Each code specifies the org and role. Umpire and staff codes require admin approval before the user gets access.
Database credentials are secrets. The org's database address is never stored in this database — only a reference name (like ORG_DB_FARM) that maps to a secure Cloudflare secret. It can't be read back.
Database Details
| Property | Value |
|---|---|
| Type | Cloudflare D1 (SQLite) |
| Location | US East (co-located with our services) |
| Tables | 6 |
| Purpose | Routing and identity — lightweight by design |