How dscubed/dscubed-website works
Project type and purpose
• This is a full-stack web application built with Next.js (React) that serves both static and server-rendered pages.
• It includes an admin interface for creating, editing, and deleting content, public pages for events, competitions, committee listings, sponsors, and integration with Supabase for authentication and data storage.
File structure
• Top-level entry points:
– next.config.js, middleware.ts, package.json – core Next.js configuration
– app/ folder – Next.js 13+ App Router with file-based routing and server/client components
– public/ – static assets (images, PDFs, logos) served via CDN
– utils/supabase/ – Supabase client, server, and middleware wrappers
• Core directories in app/:
– app/page.tsx – home page
– app/[feature]/page.tsx – feature pages (events, competitions, sponsors, map, study, QR, committee)
– app/admin/ – authenticated admin UI routes (login, create, edit)
– app/auth/ – OAuth redirect route
– app/components/ – React UI components organized by domain (home, events, competitions, committee, admin, sponsors, etc.)
• API/Backend footprints:
– app/auth/callback/route.ts – Next.js API route for OAuth callbacks
– utils/supabase/server.ts – server-side Supabase client
– utils/supabase/client.ts – client-side Supabase instance
– middleware.ts – route protection and session handling via Supabase middleware
README for additional insights
• Uses Supabase for authentication (including Google OAuth) and likely for data persistence (events, competitions, committee members, sponsors, etc.).
• Requires environment variables (.env.local) and callback URL configuration in Supabase.
• Supports local dev over HTTP/HTTPS.
a. Main components
1. Next.js Application
• App Router server (Node.js)
• React components (app/components/)
• API routes (e.g., auth callbacks)
2. Supabase
• Authentication service (OAuth, session management)
• Database (tables for events, competitions, members, sponsors)
3. User’s Browser
• Static assets from public/
• SSR or SSG pages delivered by Next.js
4. External services
• Google OAuth
• (Optional) CDN or hosting platform (e.g., Vercel)
b. Relationships and data flows
• Browser → Next.js server: requests pages or API endpoints
• Next.js server → Supabase server:
– Reads/writes database via server.ts
– Verifies/authenticates sessions via middleware
• Next.js client components → Supabase client: real-time data or client-side calls (if used)
• OAuth callback flow:
1. User clicks “Sign in” → redirect to Google
2. Google → Next.js auth/callback/route → Supabase session creation → redirect back to admin UI
c. Architectural patterns and design principles
• File-based routing (Next.js App Router) separates pages and API routes
• Server-side rendering (SSR) and static site generation (SSG) for public pages
• Component modularization by feature/domain (atomic/component grouping)
• Middleware for cross-cutting concerns (auth, redirects)
• Clear separation of client vs server code (client.ts vs server.ts in util/supabase)
d. Key technologies/frameworks
• Next.js 13+ App Router
• React with TypeScript
• Tailwind CSS (tailwind.config.js, postcss.config.js)
• Supabase (Auth + Postgres)
• Node.js for server runtime
• Vercel (implied) or similar for deployment
Detail without overthinking
• Break the system into at least these components:
– Client (Browser + React components)
– Next.js Server (routing layer, SSR/SSG pages, API routes)
– Authentication (middleware, OAuth callback)
– Database (Supabase)
– External (Google OAuth, Hosting/CDN)
• Critical data paths (page requests, API calls, auth flows).