How uoawdcc/esports-club works
Project Type and Purpose
• This is a full‑stack Next.js application (“src/app”, “next.config.ts”) for club membership and tournament management.
• It uses React on the frontend, Next API routes on the backend, and a Postgres database hosted via Supabase.
• Auth is handled by NextAuth (see “src/app/api/auth/[...nextauth]”) with possible Google OAuth.
• Deployment runs on Fly.io with GitHub Actions CI/CD.
File Structure to Extract Main Components
• Frontend UI (client‑side React):
– src/app/(frontend) for pages & layouts
– src/components/ui for shared UI elements
– Tailwind CSS in globals.css & postcss.config.mjs
• API Layer (serverless functions):
– src/app/api/auth for NextAuth routes
– src/server for any custom server logic (mockCreateUser)
• Data Access Layer:
– src/libs/db (Drizzle config & schema) connecting to Supabase Postgres
– src/libs/env for environment variables
– potentially Prisma if in use (badged in README)
• State / Data Fetching:
– src/components/providers/query (TanStack Query)
– src/hooks/api for custom hooks
• Authentication:
– next-auth integration in src/auth.ts & API routes
• Infrastructure & DevOps:
– Dockerfile, fly.toml / fly.staging.toml for container & Fly.io
– GitHub Actions workflows for build & deploy (build.yml, fly-deploy*.yml)
a. Frontend Browser (clients)
– Connects over HTTPS to Next.js server
– Houses React UI, interacts with Query Client Provider
b. Next.js Server (Node.js on Fly.io)
– Serves SSR/SSG pages from src/app
– Exposes API routes under /api/auth
– Hosts middleware.ts for request handling (auth guard, routing)
c. Authentication Service
– NextAuth engine, using Google OAuth (external)
– Reads/writes user sessions to Supabase Auth or your own DB
d. Database Layer (Supabase Postgres)
– Accessed via Drizzle ORM (drizzle.config.ts → src/libs/db)
– Stores users, memberships, tournaments, profiles
e. External Services
– Google OAuth for sign‑in
– Fly.io platform for deployment
– GitHub Actions for CI/CD
Architectural Patterns & Design Principles
• Client‑Server separation: React SPA vs. Next API routes
• Serverless Functions (API routes) handling auth & data endpoints
• Single Source of Truth in Postgres DB via ORM
• Modular directory structure: “app” for routing, “components” for UI, “libs” for shared logic
• CI/CD pipeline defined in GitHub Actions, Docker container for uniform env