How captainshark007/spa-sentirsebien works
Project type and purpose
• This is a front-end single-page application (SPA) built with React, TypeScript, and Vite.
• It provides user-facing features for authentication, reservations, scheduling, spa information, and user management.
• It interacts with a remote REST API via Axios, uses React Query for data fetching/caching, and employs a central store for cross-feature state.
File structure
• Top level:
• public / index.html / assets (static files)
• src/
– app/ (React Query client + global store)
– config/ (Axios configuration)
– features/ (feature-oriented modules: auth, reserve, schedule, spa, user)
· Each feature has .api.ts (HTTP calls), .query.ts (React Query hooks), .service.ts (business logic), .types.ts
– components/ (reusable UI pieces, e.g. NavBar)
– utils/ (helpers, e.g. delay)
– main.tsx + App.tsx (root)
• Build & deployment files: vite.config.ts, netlify.toml, package.json, ESLint/Prettier configs
Main components
a. User’s Browser / SPA Container
b. UI Layer (React components under src/components & App.tsx)
c. State Management
• React Query client (src/app/queryClient.ts)
• Global store (src/app/store.ts)
d. API Service Layer (feature-specific .api.ts modules using Axios configured in src/config/axios.config.ts)
e. External Backend REST API (the server endpoints for auth, reservations, schedules, etc.)
f. Build & Deployment
• Vite development server (HMR)
• Production build pipeline (Vite → Netlify)
Relationships and interactions
• User actions → UI Layer (components)
• UI invokes React Query hooks (.query.ts) or dispatches to store
• React Query / store call service layer (.service.ts)
• Service layer calls API layer (.api.ts) → Axios → External REST API
• API responses flow back through Query/Store → UI re-renders
• During development: Vite dev server provides HMR to the browser
• For production: Vite produces static assets deployed via Netlify
Architectural patterns & design principles
• Feature-oriented modularization: each feature folder is self-contained
• Layered architecture: UI → state → services → API → external systems
• Clear separation of concerns: .api.ts for HTTP, .service.ts for business logic, .query.ts for data caching hooks
• Centralized configuration: Axios and QueryClient defined once for all features