How fu-self-learning/fu-self-learning-ui works
Project Type and Purpose
• This is a full-stack frontend application (Next.js + React) that provides the UI for the FU Self Learning platform.
• It handles authentication, user profiles, social content, and demo/private routes; it does not include its own data store but interacts with backend APIs (e.g., authentication and content services).
Main Architectural Components
A. Client Layer (Browser)
• Next.js-rendered pages & components (src/app, src/components)
• Static assets (public/images, public/svgs, CSS via Tailwind, Ant Design styles)
B. Frontend Application Server
• Next.js server (SSR/CSR) running on Node.js
• Custom routing under src/app using the Next.js App Router
C. State & Data-Fetching Layer
• Redux Toolkit (authSlice, store)
• React Query (QueryClientProvider)
• React Context providers (AuthHydration, Theme, ReduxProvider)
D. API Layer
• Shared API clients (src/shared/api/auth.api.ts, index.ts)
• Hooks that call API (useLogin, useRegister, useProfile)
E. External Backend Services
• Authentication API
• Content / Social API endpoints
F. Infrastructure & Deployment
• Docker container running Next.js + Node
• Nginx reverse-proxy (nginx.conf)
• docker-compose orchestration
• CI/CD workflow (GitHub Actions .github/workflows/deploy.yml)
Relationships & Data Flow
1. User opens browser → requests a page (e.g., /login)
2. Request hits Nginx → forwarded to Next.js container
3. Next.js composes the page:
• Executes server-side code (if SSR)
• Hydrates context providers (AuthHydration checks existing token)
• Renders React components, applying global CSS (Tailwind) and Ant Design styling
4. Client code calls data-fetch layer:
• React Query hooks fetch data via shared API clients
• Redux Toolkit stores authentication state, user profile, etc.
5. API calls traverse to external backend services over HTTP
6. Responses flow back to React Query / Redux, update UI
Architectural Patterns & Design Principles
• Component-Based Architecture (reusable UI components organized under src/components)
• Separation of Concerns:
• Presentation (components) vs. State (Redux) vs. Data Fetching (React Query) vs. Routing (Next.js App Router)
• Context-Driven Configuration (AuthHydration, Theme toggling via custom hooks)
• Containerization & Infrastructure as Code (Dockerfile, docker-compose.yml, Nginx config)
Key Technologies & Frameworks
• Next.js 15.3.1 & React 19 (App Router, server/client boundaries)
• TypeScript (tsconfig.json)
• Redux Toolkit (src/providers/auth)
• React Query (src/context/QueryClientProvider.tsx)
• TailwindCSS (tailwind.config.js), Ant Design
• Docker, Docker Compose, Nginx
• GitHub Actions for CI/CD