How ishitzzz/the-dojo works
Project Type and Purpose
• This is a full-stack Next.js application (React + Node.js) that provides an interactive learning platform.
• The frontend is built with Next.js’s App Router (React Server & Client Components) and the backend consists of serverless API routes under src/app/api/*.
File Structure Analysis
• Top Level
• next.config.ts, tsconfig.json, ESLint/PostCSS configs → Next.js build and linting setup
• Frontend (src/app)
• layout.tsx, globals.css → global layout and styles
• page.tsx → landing page
• Subdirectories for pages: dashboard/, reader/, roadmap/ – each with a page.tsx entry point
• API Layer (src/app/api)
• One folder per function (explain-text, generate-analogy, grade-challenge, etc.)
• Each folder contains route.ts exporting a Next.js handler → serverless endpoints
• Shared UI Components (src/components)
• Workspace components (Workspace.tsx, ReaderWorkspace.tsx)
• Onboarding and tool components under components/tools/ (games, analogy maker)
• Utilities & Scripts
• list-models.js, verify-key.js, debug-dojo.mjs → helper scripts for model listing, API key verification, debugging
Insights from README
• Standard Create-Next-App boilerplate with no built-in database or external persistence.
• Deployment target is Vercel (serverless functions for API routes).
Main Components
a. Client Browser (User Agent)
b. Next.js Frontend
– React Server Components & Client Components
– Pages: Dashboard, Reader, Roadmap, Onboarding flows
c. Next.js API Layer (Serverless Functions)
– Endpoints: explain-text, generate-analogy, generate-chapter-content, generate-roadmap, get-video, grade-challenge, upload-syllabus, validate-feynman
d. External Services
– OpenAI (or another LLM) for generation & grading
– Video provider API (for get-video)
e. (Optional) Static Asset Store
– Vercel public folder or CDN for fonts, images
Relationships & Data Flow
1. User loads page in browser → React components rendered (SSR or SSG).
2. User interacts (e.g., uploads syllabus, answers challenge) → frontend issues HTTP POST/GET to corresponding /api/* route.
3. Serverless function receives request → invokes OpenAI or video API → processes and returns JSON.
4. Frontend receives response → updates UI (game arena, roadmap, explanations).
Architectural Patterns & Design Principles
• Separation of Concerns: UI vs. API logic separated into src/app vs. src/app/api.
• Serverless Micro-endpoints: Each route is a single-purpose function.
• React Server Components for initial HTML + CSS delivery, Client Components for interactive tooling.
• API-first design: Frontend treats backend as a set of well-defined HTTP services.
• Page.tsx (Landing)
• Dashboard, Reader, Roadmap pages
• Shared Components (Workspace, Tools)