Frontend application for the hierarchical educational management platform with 5 user levels and strict data isolation.
- Framework: React 18 with TypeScript
- Build Tool: Vite 6
- Styling: Tailwind CSS v4 + shadcn/ui components
- State Management: Zustand (global), React Context (auth)
- Routing: React Router v7
- Internationalization: react-i18next
- Testing: Vitest (unit), Playwright (E2E)
- UI Components: shadcn/ui + Material Icons
- Node.js >= 18.0.0
- npm >= 9.0.0
cd frontend
npm install# Start development server (port 5173)
npm run dev
# Start on specific port (for Playwright tests)
npm run dev -- --port 5174# Type checking
npm run typecheck
# Production build
npm run build
# Preview production build
npm run preview# Run unit tests (Vitest)
npm run test
# Run E2E tests (Playwright)
npm test
# Install Playwright browsers
npm run install:playwright
# View test report
npm run test:report# Run ESLint
npm run lint
# Auto-fix ESLint issues
npm run lint:fix
# Format code with Prettier
npm run formatfrontend/
├── public/ # Static assets
│ └── locales/ # i18n translation files
├── src/
│ ├── components/ # React components
│ │ ├── admin/ # SuperAdmin components
│ │ ├── auth/ # Authentication components
│ │ ├── common/ # Shared components
│ │ │ ├── sidebar/ # Sidebar navigation
│ │ │ └── ProtectedRoute/ # Route protection
│ │ ├── dashboard/ # Dashboard layouts
│ │ ├── instructor/ # Instructor components
│ │ ├── layouts/ # Role-specific layouts
│ │ ├── region-admin/ # Regional admin components
│ │ ├── center-manager/ # Center manager components
│ │ └── student/ # Student components
│ ├── contexts/ # React contexts
│ ├── hooks/ # Custom React hooks
│ ├── i18n/ # i18n configuration
│ ├── services/ # API service layer
│ ├── stores/ # Zustand stores
│ └── ui/ # UI components (shadcn/ui)
├── index.html # Entry HTML
├── package.json # Dependencies
├── tsconfig.json # TypeScript config
├── vite.config.ts # Vite configuration
└── playwright.config.ts # Playwright E2E test config
Located in src/stores/:
- useAuthStore: Authentication state (user, tokens, loading)
- useUIStore: Global UI state (sidebar, theme, language)
- AuthProvider: Authentication with JWT/OAuth2
- LoadingContext: Loading bar management
- DialogContext: Modal/dialog management
The application uses role-based routing with middleware protection:
// Protected route example
<Route path="/admin/*" element={
<ProtectedRoute allowedRoles={['superadmin', 'admin']}>
<SuperAdminLayout />
</ProtectedRoute>
} />| Role | Base Path | Layout | Main Routes |
|---|---|---|---|
| SuperAdmin | /admin/* |
SuperAdminLayout | Dashboard, Regions, Admins, Logs, Settings |
| Region Admin | /region-admin/* |
RegionAdminLayout | Dashboard, Centers, Managers, Reports |
| Center Manager | /center-manager/* |
CenterLayout | Dashboard, Teachers, Students, Courses, Reports |
| Instructor | /instructor/* |
InstructorLayout | Dashboard, Courses, Create Course, Students |
| Student | /student/* |
StudentLayout | Dashboard, Courses, Browse, Progress |
All layouts use DashboardLayout which includes:
- Sidebar: Navigation menu, profile link, language selector, logout
- Header: Page title, welcome message
- Main Content: Page-specific content
Located in src/components/common/:
- SidebarLayout: Main navigation sidebar with profile and settings
- ProtectedRoute: Route protection middleware
- RoleGuard: Component-level role checking
- Dialog: Modal/dialog system
- ToastTest: Toast notification testing
All API calls go through the centralized service layer in src/services/:
- api.ts: Main API client with JWT handling
- toast.service.ts: Toast notification system
interface ApiResponse<T> {
success: boolean;
data?: T;
error?: {
code: string;
message: string;
details?: string;
};
}- Library: react-i18next
- Languages: ES, EN, FR, GL, PT, DE, EU, CA
- Translation Files:
public/locales/{lang}/common.json - Usage:
t('menu.superadmin.dashboard')
- Edit
public/locales/es/common.json - Edit
public/locales/en/common.json - Use in components:
t('key.path')
Uses the CARGOFFER/Trascend color palette:
- Primary Blue:
#1A2942(trascend-blue) - Teal:
#00B4D8(trascend-teal) - Orange:
#FF7A00(trascend-orange)
See COLOR_SCHEME.md for complete palette.
| Role | Password | |
|---|---|---|
| SuperAdmin | superadmin@test.com |
Test1234 |
| Regional Admin | admin_aragon@test.com |
Test1234 |
| Center Manager | director@ies-example.com |
Test1234 |
| Instructor | profesor.mates@ies-example.com |
Test1234 |
| Student | alumno1@ies-example.com |
Test1234 |
See ../AGENTS.md for detailed conventions:
- Imports: Node built-ins → third-party → internal (alphabetical)
- Formatting: Prettier with 2 spaces, single quotes
- TypeScript: Strict mode, explicit return types
- Naming: kebab-case files, camelCase variables, PascalCase components
- State: Zustand for global state, React hooks for local state
- Interfaces: External files (
interfaces.ts) for complex types - Component Limit: Max 400 lines - refactor if exceeded
- API Calls: Always through services layer
- Error Handling: Guard clauses, default values, no nulls
- i18n: All user-facing text must use i18n keys
- No Hardcoded Values: Use env vars or constants
Each role has its own screening directory:
components/
├── superadmin/ # SuperAdmin-only components
│ ├── index.ts # Main export
│ ├── interfaces.ts # Type definitions
│ └── ...
├── region-admin/ # Regional admin components
├── center-manager/ # Center manager components
├── instructor/ # Instructor components
└── student/ # Student components
Create .env file in frontend root:
VITE_API_BASE_URL=http://localhost:3000# Build for production
npm run build
# Output directory: dist/
# Deploy dist/ to your web server- Module not found: Run
npm installin project root - Type errors: Run
npm run typecheck - Lint errors: Run
npm run lint:fix - i18n keys missing: Check
public/locales/{lang}/common.json
If port 5173 is in use:
npm run dev -- --port 5174- Main README - Project overview
- Backend README - API documentation
- AGENTS.md - Coding conventions
- COLOR_SCHEME.md - Color system
- ROADMAP.md - Development milestones
- TEST_PLAN.md - Testing strategy
- PRD - Product Requirements Document
- Constitution - Project governance
- Quality Gates - Quality standards