How etereo-io/vite-react-ts-scaffolding works
Project type and purpose
• This is a front-end single-page application (SPA) scaffold built with React, TypeScript, Vite, Tailwind, React Query, i18next, Zustand, and MSW.
• It provides a ready-made architecture for routing, state management, data fetching, internationalization, theming, feature modules, testing, linting, and mock APIs.
File structure
• Top-level:
– public/: Static assets, mockServiceWorker, robots.txt
– src/: Source code
– config/: YAML config for dev, local, prod
– .husky, .github, tasks.md, etc. for tooling and CI/CD
• src/app/: Core app bootstrap—App.tsx, AppRoutes.tsx, providers
• src/app/features/: Cross-cutting features—auth, config loader, i18n, mock-server
• src/features/: Domain features—dashboard, orders, etc.
• src/lib/: Reusable low-level libraries—metrics, notifications, queryparams helpers
• src/shared/: Shared UI components and layouts
• src/main.tsx: Entrypoint that mounts App into the DOM
Extract architecture insights from README
• Core stack: React + Vite + TS
• Routing: React Router DOM
• State Mgmt: Zustand & React Query
• i18n: i18next
• Mock API: MSW (mockServiceWorker)
• Build & Dev: Vite dev server, npm scripts for build/test/lint/coverage
Main components
A. Development & Build Tools
• Vite Dev Server
• npm scripts (start, build, lint, test)
• Husky, lint-staged, Biome for pre-commit
B. Runtime Environment
• Browser (Client)
• React SPA (bundle served by Vite/production static files)
C. React Application Layers
1. Entrypoint (main.tsx)
2. Core App Component (App.tsx)
3. Providers Layer
– ConfigProvider (loads config.dev.yml, etc.)
– I18nProvider (i18next initialization, locale loader)
– QueryClientProvider (React Query client)
– AuthProvider (Zustand or custom auth context)
– MockProvider (MSW integration in development)
4. Routing (AppRoutes.tsx using React Router)
5. Feature Modules (folder-per-feature)
– Dashboard (UI components: Chart, Deposits; pages: DashboardPage)
– Orders (hooks: useOrders, services: orders.services.ts, pages: OrdersPage)
– Shared & Lib usage (metrics, notifications, queryparams)
D. External Dependencies & Services
• Real APIs (fetched via src/app/features/api/api.ts)
• Mock API (MSW) in dev mode intercepting requests
• Third-party libraries (React Router, Tailwind, i18next, Zustand, React Query)
Relationships & data flows
• Browser → Vite Dev Server (during dev) → serves bundle → mounts React SPA
• React SPA → ConfigProvider (reads config) → supplies settings
• React SPA → I18nProvider → loads locale JSON → renders UI in correct language
• React SPA → MockProvider in dev (intercepts fetch/XHR) → returns mock data
• React SPA → QueryClient → executes hooks (useOrders, useMetrics) → fetches from real or mock APIs
• Feature Component → Shared UI Components (e.g., AdminLayout, Title)
• Hooks & Services → Business logic & network calls → feed into components
• Build pipeline (npm run build) → Vite bundles → outputs static assets in dist/
Architectural patterns & design principles
• Feature-driven folder structure (“module per folder”)
• Provider pattern (React Context for config, auth, i18n, mock)
• Separation of concerns: UI components, hooks/services, types/constants, assets
• Dependency injection via Providers
• Mock-first development using MSW
• Single source of truth for config, types, constants
• Reusable “lib” for cross-feature utilities
• Strict typing with TypeScript types in @types and src/@types
Details
• Every provider and its role.
• Both mock and real API endpoints, and how MSW swaps in development.
• Flow of configuration (config/*.yml) into the ConfigProvider and into the app.
• How shared/lib folders feed into features to highlight reuse.