Skip to content

Backend Services

Three services run on Cloudflare's edge network, close to users worldwide. Each deploys independently.

The Three Services

ServiceIconWhat It Does
API Gateway🛡️Verifies user identity, looks up their organization, and routes requests to the right place
Data ServiceDelivers teams, schedules, scores, stats, chat, and everything the mobile app needs
User Sync📨When someone signs up or updates their profile, keeps our database in sync automatically

What the Data Service Provides

CategoryWhat It Delivers
TeamsTeam lists, rosters, player details
ScheduleUpcoming games and practices with locations
ScoresLive scoring, per-game stats, season totals
StandingsLeague standings by age group
ChatTeam messaging (send, receive, history)
ParentsLink to your child's player profile
CoachesTeam confirmation, management tools
PushNotification token registration
AdminInvite code management, membership approvals

How They Work Together

  1. Your phone sends a request to the Gateway (e.g., "show me my teams")
  2. The Gateway checks your identity with Clerk, then looks up your org in the Core Database
  3. The Gateway forwards the request to the Data Service along with which database to use
  4. The Data Service queries the organization's database and returns the data
  5. Your phone displays the teams

All of this happens in under 200 milliseconds.

Project Structure

g2-elite-backend/
├── src/workers/
│   ├── gateway/       → API Gateway
│   ├── mobile-bff/    → Data Service
│   └── webhook/       → User Sync
├── src/db/core/       → Core database schema
├── src/middleware/     → Authentication logic
└── wrangler.*.toml    → Deployment configs (one per service)

Internal Documentation — Do Not Share