How siraj-hp/bugcode23 works
Project type and purpose
• This is a full‑stack, React‑based code challenge platform built on Next.js (app router).
• Users can browse challenges, solve them in a browser‑embedded code editor, track completion, and administrators can log in, create, and manage challenges.
File structure
• Top‑level:
– app/ – Next.js 13 “app router” pages (React Server and Client Components)
• app/page.tsx – homepage for end users
• app/challenges/page.tsx – list of challenges
• app/completed/page.tsx – completed‑challenges view
• app/login/page.tsx – authentication
• app/admin/... – nested admin dashboard, challenge CRUD routes
– components/ – reusable UI & domain components (admin‑header, code‑editor, timer, etc.)
– hooks/ – custom React hooks (use-event, use-toast, use-mobile)
– lib/ – utility modules (challenge data access, html2canvas wrapper, general utils)
– public/ & styles/ – static assets and global styles (Tailwind, PostCSS)
– next.config.mjs, tsconfig.json, tailwind.config.ts, package.json, etc.
Extract architecture clues from the README
• Hosted & auto‑deployed on Vercel.
• Synced from v0.dev interface (implies an external “v0” deployment/CD pipeline).
• No dedicated “/api” folder, so data access likely lives in lib/challenges.ts (could fetch from a headless CMS, file store, or v0.dev backend).
a. Components
• User Browser (Client) – React Client Components, Code Editor, Timer, UI Library
• Next.js Runtime (Server) – React Server Components, SSR/SSG, Route Handlers
• Data Access Layer – lib/challenges.ts (fetches/stores challenge metadata & submissions)
• Third‑Party Services
– v0.dev Backend (sync & CI/CD)
– Vercel (hosting + serverless function runtime)
– Optional: headless CMS or database (if challenges come from an external store)
b. Relationships & Data Flows
– User ↔️ Browser UI (interacts with code‑editor, timer, challenge list)
– Browser → Next.js Server (page requests, dynamic imports, SSR)
– Next.js Server → lib/challenges.ts (data reads/writes)
– lib/challenges.ts → Data Store or External API (CRUD operations)
– Admin UI ↔️ Next.js Server ↔️ Data Store (create/update challenges)
– Next.js (on push) ←→ v0.dev sync → Git repo → Vercel deploy
c. Architectural Patterns & Principles
– Component‑based UI (atomic design in components/ui/)
– Server‑Side Rendering & static pre‑rendering via Next.js app router
– Mono‑repo with clear separation: app (pages) vs. components vs. lib vs. hooks
– Tailwind utility‑first styling
– Serverless functions implicitly managed by Vercel
d. Key Technologies & Frameworks
– Next.js 13 (App Router, React Server/Client Components)
– React + TypeScript + custom hooks
– Tailwind CSS + PostCSS
– html2canvas for screenshot functionality
– v0.dev for iterative development & Git sync
– Vercel for hosting & CI/CD