How ishratjahanesha21/programming_learning_esz works
1. Overall shape
- This is a Next.js 14 App Router application written in TypeScript.
- The repo is organized around three main surfaces: the marketing/home experience, the authenticated learning area (courses, profile, lessons), and a compiler/playground area backed by an API route.
2. Client/server boundary
- Pages under src/app/**/page.tsx are the route entry points and are mostly server components that decide access and compose the page.
- The interactive UI lives in separate *Client.tsx components and CSS Modules, which handle browser-side state, modals, forms, and user interaction.
- This split is important for the diagram: server pages gate access, while client components render the visible experience and handle events.
3. Authentication subsystem
- Auth is implemented with NextAuth.js v5 via src/auth.ts and the route handler at src/app/api/auth/[...nextauth]/route.ts.
- The README indicates the current login model supports Google, GitHub, and a demo credentials account, with a mock user store for development.
- Session typing is extended in src/types/next-auth.d.ts, so authentication affects both runtime behavior and TypeScript types.
4. Route protection
- Protected areas are primarily /courses/[id] and /profile.
- Protection happens in two layers: server-side checks in page components and edge-level enforcement in src/middleware.ts.
- That means access control is not only a UI concern; it is enforced before the page content renders.
5. Home/marketing experience
- The homepage (src/app/page.tsx) is assembled from reusable sections in src/components/home/*.
- These sections cover the landing narrative: hero, marquee, languages, scenarios, featured courses, compiler teaser, testimonials, FAQ, and CTA.
- The layout shell (src/app/layout.tsx) adds shared chrome via Navbar and Footer.
6. Course discovery and auth gating
- Course cards come from src/components/courses/CourseCard.tsx and the course listing/detail pages under src/app/courses.
- The onboarding behavior is intentional: if the user is not signed in, clicking a course opens the auth modal rather than navigating directly.
- The modal state is shared through src/lib/auth-modal-context.tsx, which acts as a cross-cutting UI state boundary between course cards and the auth UI.
7. Course detail and lesson delivery
- /courses/[id] is the entry into a course detail page, and nested lesson routes live under /courses/[id]/lessons/[lessonId].
- Lesson-specific UI is split into LessonClient.tsx and ProGate.tsx, indicating some lesson content is premium or access-controlled.
- In diagram terms, the course tree is the authenticated content hub, with lesson access potentially constrained further by the “Pro” gate component.
8. Compiler subsystem
- There is a dedicated compiler page under src/app/compiler and a server endpoint at src/app/api/compile/route.ts.
- The architecture suggests a browser-based coding experience where user code is sent to the API route for server-side compilation/execution orchestration.
- This keeps compilation off the client and separates the playground flow from the rest of the learning content.
9. Shared data model
- Most course and language content appears to come from src/lib/data.ts.
- That file is likely the single source of truth for home-page modules, course cards, lesson metadata, and language lists.
- For the architecture diagram, this is the repo’s main content/data boundary: content is centralized and then consumed by multiple route trees and sections.
10. Styling and design system
- Styling is handled with CSS Modules per component plus src/styles/globals.css for shared tokens and utilities.
- The README calls out a “Playful Geometric” design system, so visual consistency is achieved through shared tokens rather than a heavy component framework.
- Fonts and iconography are also part of the visual layer: Outfit and Plus Jakarta Sans, plus Devicons via CDN.
11. External services and infrastructure
- The only clearly material external service in the current architecture is NextAuth-backed OAuth providers: Google and GitHub.
- The repo includes src/lib/supabase.ts and src/lib/db.ts, but the README says persistence is still mock/in-memory and real database integration is future work.
- So the current production shape is mostly stateless app-server logic plus auth provider callbacks, not a fully database-driven backend.
12. Operational boundaries
- Public assets live under public/, including the main preview image.
- next.config.js, middleware.ts, and the API routes are the key runtime boundaries to show in a diagram: request routing, auth interception, and server-side execution.
- The app is deployable as a typical Next.js app on Vercel, but the current architecture is still centered on app routes, auth, and static content composition rather than a separate backend service.
Main entry points: auth.ts Auth config · data.ts Content data · page.tsx Profile page · route.ts Auth API
Components 25
App routes
Next.js route entry points and request boundaries
- Root layout · Global app frame with shared navigation and footer
src/app/layout.tsx - Home page · Marketing landing page assembled from reusable sections
src/app/page.tsx - Login page · Entry page for sign-in flows and auth modal handoff
src/app/login/page.tsx - Pricing page · Pricing surface rendered through a client component
src/app/pricing/page.tsx - Profile page · Authenticated user profile area guarded on server and edge
src/app/profile/page.tsx - Courses page · Course listing and discovery entry point
src/app/courses/[id]/page.tsx - Course detail · Interactive course detail experience for signed-in users
src/app/courses/[id]/CourseDetailClient.tsx - Lesson page · Nested lesson route that composes lesson access and content
src/app/courses/[id]/lessons/[lessonId]/page.tsx - Lesson client · Browser-side lesson viewer and interaction layer
src/app/courses/[id]/lessons/[lessonId]/LessonClient.tsx - Pro gate · Premium or restricted lesson access boundary
src/app/courses/[id]/lessons/[lessonId]/ProGate.tsx - Compiler page · Browser coding experience entry point
src/app/compiler/page.tsx - Compiler UI · Interactive compiler and editor experience
src/app/compiler/CompilerPage.tsx - Auth API · NextAuth route handler for sign-in and session callbacks
src/app/api/auth/[...nextauth]/route.ts - Compile API · Server-side compile orchestration endpoint
src/app/api/compile/route.ts
UI components
Reusable interactive and presentational components
- Navbar · Primary site navigation shell
src/components/layout/Navbar.tsx - Footer · Shared site footer
src/components/layout/Footer.tsx - Auth modal · Cross-cutting sign-in modal used from course flows
src/components/auth/AuthModal.tsx - Course card · Clickable course entry that can trigger auth gating
src/components/courses/CourseCard.tsx - Home sections · Hero, marquee, languages, scenarios, testimonials, FAQ, CTA, and compiler teaser
src/components/home/HeroSection.tsx
Core logic
Authentication, shared state, and content sources
- Auth config · NextAuth setup and provider/session wiring
src/auth.ts - Middleware · Edge-level request interception for protected areas
src/middleware.ts - Content data · Central content and metadata source for courses, lessons, and home modules
src/lib/data.ts - Auth state · Shared auth-modal context bridging course cards and login flows
src/lib/auth-modal-context.tsx
External services
Third-party providers and runtime integrations
- Google · OAuth sign-in provider
- GitHub · OAuth sign-in provider
Connections 23
- Root layout → Navbar: includes · Global layout renders shared navigation
- Root layout → Footer: includes · Global layout renders shared footer
- Home page → Home sections: composes · Homepage is assembled from landing sections
- Home sections → Content data: reads · Landing sections consume shared content data
- Courses page → Course card: lists · Course listing renders course cards
- Course card → Auth state: opens auth · Unauthenticated course clicks trigger the auth modal
- Auth state → Auth modal: controls · Shared state drives modal visibility
- Login page → Auth modal: renders · Login surface can present the auth modal experience
- Profile page → Middleware: protected by · Profile route is guarded before render
- Courses page → Middleware: protected by · Course area is intercepted at the edge when needed
- Course detail → Content data: reads · Course detail pulls structured course content
- Lesson page → Lesson client: composes · Lesson route renders the interactive lesson client
- Lesson client → Pro gate: checks · Lesson UI passes through premium access gating
- Lesson page → Content data: reads · Lesson route uses lesson metadata from shared data
- Compiler page → Compiler UI: composes · Compiler route wraps the interactive playground UI
- Compiler UI → Compile API: submits code · Client sends code to the server compile endpoint
- Auth API → Auth config: uses · Auth route is backed by shared NextAuth configuration
- Auth config → Google: provider · Google OAuth is enabled for sign-in
- Auth config → GitHub: provider · GitHub OAuth is enabled for sign-in
- Auth config → Profile page: hydrates session · Session typing and auth state affect protected views
- Middleware → Auth API: delegates auth · Edge guard relies on auth session behavior
- Profile page → Content data: reads · Profile and learning views reuse shared content definitions
- Login page → Auth API: authenticates via · Login flow reaches the NextAuth route handler