Appearance
Backend Services
Three services run on Cloudflare's edge network, close to users worldwide. Each deploys independently.
The Three Services
| Service | Icon | What It Does |
|---|---|---|
| API Gateway | 🛡️ | Verifies user identity, looks up their organization, and routes requests to the right place |
| Data Service | ⚡ | Delivers 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
| Category | What It Delivers |
|---|---|
| Teams | Team lists, rosters, player details |
| Schedule | Upcoming games and practices with locations |
| Scores | Live scoring, per-game stats, season totals |
| Standings | League standings by age group |
| Chat | Team messaging (send, receive, history) |
| Parents | Link to your child's player profile |
| Coaches | Team confirmation, management tools |
| Push | Notification token registration |
| Admin | Invite code management, membership approvals |
How They Work Together
- Your phone sends a request to the Gateway (e.g., "show me my teams")
- The Gateway checks your identity with Clerk, then looks up your org in the Core Database
- The Gateway forwards the request to the Data Service along with which database to use
- The Data Service queries the organization's database and returns the data
- 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)