How mouhamed-git/slash-admin works
Project type and purpose
• Slash Admin is a frontend single-page application (SPA) template / admin dashboard built with React 18, Vite, Ant Design, TypeScript.
• It provides a ready-made admin UI, mock data (MSW + Faker), routing, state management (Zustand), data fetching (React-Query), theming, i18n, and a Dockerized build/deploy pipeline.
File structure analysis
• Top-level config: Dockerfile, docker-compose.yaml, CI (/.github/workflows/ci.yml), Vite config, TypeScript config, lint/prettier/husky, .env files.
• Public: index.html, static assets, service worker.
• src:
• App entry: main.tsx, App.tsx
• API layer: src/api/apiClient.ts, services/*.ts
• Mock layer: src/_mock + public/mockServiceWorker.js
• Layouts: dashboard and simple wrappers, nav, headers
• Pages: organized by feature (components demos, dashboard, functions, management, sys, menu-level)
• Router: route definitions, auth guards, hooks
• State: Zustand stores in src/store
• Theme & styles: AntD theme overrides, Tailwind, global CSS
• Utilities & types
README insights
• Emphasizes React hooks, Vite, AntD, TypeScript, HMR, responsive design, nested routing, access control, i18n, mocking, state mgmt, data fetching, Docker support, GitHub Actions.
Main components
a. Developer / CI/CD layer
• GitHub repository → CI workflow → Docker image → Docker Compose → Production container.
b. Build pipeline
• Vite dev server (HMR) for development
• Vite production build → static assets
c. Browser / Client
• React SPA
• Router (react-router or custom)
• UI components (AntD + custom)
• Pages & Layouts
• State stores (Zustand)
• Data fetching (React-Query)
• API client (axios/fetch wrapper)
• Mock Service Worker (MSW + Faker) in development
• Static assets & images
• i18n engine
• Theming engine (AntD overrides + Tailwind)
d. External services
• Real backend API (user/org/demo endpoints)
• Authentication / Authorization service (role-based)
• CDN / Static file host
Relationships and interactions
• Developer pushes code → CI builds + lints/tests → docker image → container deploy → serves static files.
• In development: Browser ← Vite dev server (HMR) → React App ← Mock Service Worker simulating API.
• In production: Browser ← CDN / Docker container serving static bundle → React App → API client calls real backend.
• UI components dispatch React-Query hooks → API client → backend or mock → state updates in cache/Zustand → UI re-renders.
• Router handles navigation, auth-guard checks userStore → redirects to login if unauthorized.
• i18n module loads language resources, toggled via locale-picker.
Architectural patterns & design principles
• SPA with client-side routing
• Container-presentational (pages vs components)
• Service layer for API abstraction
• Hook-based composition (React hooks for events, theming, locale)
• Atomic design for UI components (small, reusable)
• Mocking abstraction decoupled from production code (MSW)
• Unidirectional data flow (React-Query + Zustand)
• Theming via CSS-in-JS and global styles