How airli1507/qsis-3 works
Project Type and Purpose
• This is a full-stack web application built with Next.js (App Router).
• It provides user authentication (login, logout, password reset), and a protected dashboard with several sub-pages (homework, reading, profile, settings, etc.).
• The file tree uses Next.js’s file-based routing for both UI pages (src/app/.../page.tsx) and server API routes (src/app/auth/login.ts, src/app/auth/refresh.ts).
High-Level Architecture Components
a. Client (Browser)
• Loads initial HTML & CSS from Next.js server.
• Hydrates React components for client-side interactivity.
• Calls internal API routes for auth and data fetching.
b. Next.js Server (Node/Vercel Serverless)
• Renders React pages server-side (SSR).
• Hosts API route handlers under src/app/auth/*.ts.
• Serves static assets from public/.
c. UI Layer
• Page components in src/app/**/page.tsx.
• Layout components (layout.tsx) that wrap pages (global and per-segment).
• Shared React components in src/components/ (AuthWrapper, Dashboard sidebar/tab, Brand logo).
d. Business Logic & Utilities
• src/utils/login.ts, logout.ts, refresh.ts encapsulate API-calling and token handling.
• src/i18n/request.ts manages internationalization requests.
e. Data & External Services
• (Implied) Authentication store or third-party identity provider behind login/refresh API.
• Potential database or external API flows (not included in code, plan for placeholder).
Architectural Patterns & Principles
• File-based routing (Next.js App Router) separates UI pages and server APIs by directory.
• Layout composition: global, auth-segment, dashboard-segment layouts provide shared wrappers and protected routing.
• React Context (src/app/context.tsx) centralizes auth state across client & server.
• Separation of concerns: UI components vs. business-logic utilities vs. route handlers.
• Monorepo/Workspace via pnpm (pnpm-workspace.yaml) suggests possible multi-package future extension.
• Use rectangles for “Browser Client,” “Next.js Server (SSR + API),” “UI Components,” “Business Logic Layer,” and “External Services/DB.”
– Frontend (light blue)
– Backend (light green)
– External/DB (gray)
c. Labels & Details
• API route handlers under “Auth API” with filenames.
• Context node feeding auth state into UI Components.
• Blue rectangles for client-side React & layouts.
• Green for server-side route handlers & utilities.