Architecture
Architecture Overview
Section titled “Architecture Overview”CoogCasa is built as a modern, serverless application leveraging Cloudflare’s edge platform and Supabase for backend services.
Tech Stack
Section titled “Tech Stack”| Layer | Technology |
|---|---|
| Frontend | Astro 5, React 19, TypeScript, Tailwind CSS 4 |
| Design | Glass UI, minimal rounded corners, light mode |
| Database | Supabase (PostgreSQL + Auth + Storage + Realtime) |
| Hosting | Cloudflare Pages (auto-deploy on push) |
| Workers | Cloudflare Workers (Sports API, Scholarships API) |
| CDN/Security | Cloudflare (DDoS protection, WAF) |
System Diagram
Section titled “System Diagram”┌─────────────────────────────────────────────────────────────┐│ Cloudflare Edge ││ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ ││ │ Pages │ │ Workers │ │ Rate Limiting │ ││ │ (Website) │ │ (APIs) │ │ (WAF) │ ││ └──────┬──────┘ └──────┬──────┘ └─────────────────────┘ │└─────────┼────────────────┼──────────────────────────────────┘ │ │ │ ▼ │ ┌─────────────────┐ │ │ API Router │ │ │ api.coogcasa.com│ │ └────────┬────────┘ │ │ │ ┌────────────┴────────────┐ │ ▼ ▼ │ ┌──────────────┐ ┌──────────────┐ │ │Sports Backend│ │Scholarships │ │ │ Worker │ │ Backend │ │ └──────┬───────┘ └──────┬───────┘ │ │ │ │ │ ┌─────────────┘ │ │ │ ▼ ▼ ▼ ┌────────────────────────┐ │ Supabase │ │ ┌──────┐ ┌──────────┐ │ │ │Postgres│ │ Storage │ │ │ │ DB │ │ (Images)│ │ │ └──────┘ └──────────┘ │ └────────────────────────┘Component Details
Section titled “Component Details”Website (Cloudflare Pages)
Section titled “Website (Cloudflare Pages)”The main website is built with Astro 5 and React 19:
- Framework: Astro with React islands for interactive components
- Styling: Tailwind CSS 4 with custom Glass UI design system
- Routing: File-based routing with Astro
- Deployment: Automatic via GitHub push to
mainbranch
API Router
Section titled “API Router”Unified API endpoint that routes requests to backend services:
- URL:
https://api.coogcasa.com(orcoog-api-router.coog-planner.workers.dev) - Routes:
/sports/*→ Sports Backend/scholarships/*→ Scholarships Backend/health→ Combined health check
Uses Cloudflare Service Bindings for zero-latency internal routing.
Sports Backend
Section titled “Sports Backend”Cloudflare Worker that fetches and caches UH sports data from ESPN:
- Data Sources: ESPN API
- Caching: KV for schedules, rosters, standings
- Features: Schedule tracking, game polling, image caching
Scholarships Backend
Section titled “Scholarships Backend”Cloudflare Worker that scrapes and indexes UH scholarship sources:
- Data Sources: 10+ UH scholarship pages
- Storage: Supabase for persistence
- Updates: Daily cron job
Database (Supabase)
Section titled “Database (Supabase)”PostgreSQL database with:
- Auth: User authentication (Discord OAuth)
- Tables: Discussions, replies, reactions, profiles
- Storage: User-uploaded images
- Realtime: Live updates for discussions
Environment Configuration
Section titled “Environment Configuration”Frontend (web/.env)
Section titled “Frontend (web/.env)”PUBLIC_SUPABASE_URL=https://[project-id].supabase.coPUBLIC_SUPABASE_ANON_KEY=[anon-key]PUBLIC_SPORTS_API_URL=https://api.coogcasa.com/sportsPUBLIC_SCHOLARSHIPS_API_URL=https://api.coogcasa.com/scholarshipsWorkers
Section titled “Workers”Secrets are configured via wrangler secret put:
wrangler secret put SUPABASE_URLwrangler secret put SUPABASE_SERVICE_KEYSecurity
Section titled “Security”- RLS: Row-Level Security on all Supabase tables
- CORS: Strict origin allowlisting
- Rate Limiting: Cloudflare WAF rules
- Auth: Supabase Auth with Discord OAuth