How g-ohara/curlarc-web works
Project type and purpose
• CurlARC‑Web is the frontend of a full‑stack, web‑based curling match recording and management system.
• Built with Next.js and React, it handles user authentication, dynamic routing for teams and match records, and communicates with a separate backend service (dyoshyy/CurlARC‑Service).
File structure
• Top‑level “app” directory: Next.js App Router with dynamic routes ([teamId], [recordId])
• page.tsx files define layouts and page entrypoints
• components under each route folder (e.g., sheet buttons, scoreBoard) implement UI
• serverActions.tsx for Next.js 13 Server Actions
• “app/api/auth/[...nextauth]/route.ts”: NextAuth API route for OAuth/session management
• “lib/api” and “utils/api”: client wrappers for calling the backend service (REST)
• “components” and “app/components”: reusable UI elements and global layout (header, footer, UI primitives)
• Configuration: next.config.mjs, tailwind.config.ts, tsconfig.json
• “firebaseConfig.js”: Firebase setup (if used for analytics or real‑time features)
• Public/static assets and global styles (globals.css)
Key insights from README
• Frontend: Next.js, React, Tailwind CSS (with CSS Modules/Styled Components)
• Authentication: NextAuth (OAuth flows)
• Hosting: Vercel for frontend; backend is Node.js serverless on Fly.io
• Real‑time match recording, team collaboration, REST API integration with backend
Main components & their interactions
a. User’s Browser (Client)
• Interacts with Next.js pages (SSR, SSG, or CSR)
• Executes client components for UI and fetches data via Next.js server actions or REST calls
• Manages session cookies/JWT via NextAuth
b. Next.js Frontend (Vercel Host)
• App Router handles routing: / (landing), /profile, /[teamId], /[teamId]/[recordId]
• NextAuth API route (/api/auth) for login/logout/session
• Server Actions (serverActions.tsx) & client APIs in lib/api
• Static assets served from /public
c. CurlARC Backend Service (Fly.io)
• Exposes REST endpoints: /teams, /records, /users, /auth (if delegated)
• Business logic for match storage, team management
• Database (e.g., PostgreSQL, MongoDB)
d. External Services
• OAuth Providers (Google, etc.) via NextAuth
• Potential Firebase services (from firebaseConfig.js)
Architectural patterns & design principles
• Separation of Concerns: UI components vs. data‑fetching wrappers vs. authentication
• Dynamic Routing: Next.js App Router for nested routes and layouts
• Server‑Side & Client‑Side Blend: Server Actions for secure ops, client components for interactivity
• API Layer Abstraction: lib/api and utils/api modules decouple HTTP calls from UI logic