How dsc-darmstadt/dscdarmstadt works
Project Type and Purpose
• This is a full-stack web application built on Next.js (App Router).
• It serves a multi-language, SEO-optimized, PWA-enabled marketing and information site for the Developer Student Club Darmstadt.
• It delivers both static and dynamic content (SSR/SSG) and exposes a small API surface (Next.js API routes) backed by Supabase.
File-Structure Analysis
• Top-Level Config & Scripts
• ESLint, TypeScript, Tailwind, PostCSS, Wrangler, Cloudflare-Pages deployment files.
• scripts/populate-db.js for seeding Supabase.
• Public Assets
• Locale Messages
• messages/: JSON for en & de.
• Application Code (src/)
• src/app/: Next.js App Router – localized folder per [locale], containing page routes under /about, /events, /projects, etc.
• src/app/api/: Next.js API routes mirroring pages (e.g., GET /api/events, POST /api/contact).
• src/components/: UI primitives (shadcn/ui), layout components (Navbar, Footer), feature-specific components.
• src/i18n/: next-intl setup & middleware for locale detection.
• src/lib/: environment variables, Supabase client, static fallback data, type definitions, utility converters.
• src/middleware.ts: enforces locale routing.
Key Insights from README
• Tech Stack: Next.js 14, TypeScript, Tailwind CSS, shadcn/ui, Framer Motion, next-intl.
• Deployment: Cloudflare Pages via @cloudflare/next-on-pages + Wrangler for preview.
• Data Persistence: Supabase (Postgres) accessed directly from API routes and client via src/lib/supabase.ts.
• Patterns:
• App Router with nested, localized layouts.
• Server vs. Client components.
• API layer co-located with frontend.
Diagramming the System
a. Main Components
• Browser / PWA Client
• CDN / Edge (Cloudflare Pages)
• Next.js App (App Router)
• SSR/SSG engine at edge
• Static asset server (public/)
• API Routes
• Supabase
• Localization Service (next-intl + JSON messages)
• External Services (optional: Analytics, Google Verification)
b. Relationships & Data Flows
1. User’s browser requests https://{branch}.dscdarmstadt.pages.dev/{locale}/….
2. Cloudflare Pages CDN routes to Next.js edge functions.
3. Next.js App Router:
• For page requests:
• Checks for static prerendered HTML → caches or renders via SSR/SSG.
• Loads localized messages from messages/{locale}.json.
• For API requests (/api/*):
• Runs Node route handlers (e.g., events, projects, contact).
• These handlers call Supabase client in src/lib/supabase.ts.
4. Supabase responds with data (Postgres).
5. Next.js returns JSON (API) or HTML/JSON payload (SSR) to the client.
6. Browser renders components (client components for interactivity, lazy-loaded), or stores as PWA.
c. Architectural Patterns & Principles
• Monolithic Next.js application with co-located API routes (“Backend for Frontend” pattern).
• Separation of concerns:
• Presentation (components/)
• Routing & middleware (app/, middleware.ts)
• Data access (lib/supabase.ts, lib/data/*.ts)
• SSG/SSR hybrid model for performance & SEO.
• PWA support via manifest + service worker (implicit in Next.js).
• i18n at routing layer, JSON-based translation.
d. Key Technologies
• Next.js App Router (SSR/SSG, dynamic routes)
• Cloudflare Pages + Wrangler + next-on-pages
• Supabase (Postgres, REST/JS client)
• Tailwind CSS, shadcn/ui, Framer Motion
• next-intl for localization