# captainshark007/spa-sentirsebien architecture

> Architecture diagram of the GitHub repository captainshark007/spa-sentirsebien, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/captainshark007/spa-sentirsebien
- Repository: https://github.com/captainshark007/spa-sentirsebien

## Overview

##### 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

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "SPA Container & Entry"
        A1["public/index.html"]:::frontend
        A2["src/main.tsx"]:::frontend
    end

    subgraph "UI Layer"
        B1["src/App.tsx"]:::frontend
        B2["src/App.css"]:::frontend
        B3["src/components/navbar/NavBar.tsx"]:::frontend
        B4["src/components/navbar/NavBar.css"]:::frontend
    end

    subgraph "State Management"
        C1["src/app/queryClient.ts"]:::state
        C2["src/app/store.ts"]:::state
        C3["src/features/auth/auth.slice.ts"]:::state
    end

    subgraph "React Query Hooks"
        F1["src/features/auth/auth.query.ts"]:::state
        F2["src/features/reserve/reserve.query.ts"]:::state
        F3["src/features/schedule/schedule.query.ts"]:::state
        F4["src/features/spa/spa.query.ts"]:::state
        F5["src/features/user/user.query.ts"]:::state
    end

    subgraph "API Service Layer"
        D1["src/config/axios.config.ts"]:::backend
        subgraph "Business Logic Services"
            D2["src/features/auth/auth.service.ts"]:::backend
            D3["src/features/reserve/reserve.service.ts"]:::backend
            D4["src/features/schedule/schedule.service.ts"]:::backend
            D5["src/features/spa/spa.service.ts"]:::backend
            D6["src/features/user/user.service.ts"]:::backend
        end
        subgraph "Feature API Modules"
            E1["src/features/auth/auth.api.ts"]:::backend
            E2["src/features/reserve/reserve.api.ts"]:::backend
            E3["src/features/schedule/schedule.api.ts"]:::backend
            E4["src/features/spa/spa.api.ts"]:::backend
            E5["src/features/user/user.api.ts"]:::backend
        end
    end

    G["External REST API"]:::external

    subgraph "Build & Deployment"
        H1["Vite Dev Server (HMR)"]:::build
        H2["Production Build → Netlify"]:::build
    end

    A1 --> A2
    A2 --> B1
    B1 --> B2
    B1 --> B3
    B3 --> B4
    B1 --> C1
    B1 --> C2
    C2 --> C3

    C1 --> F1
    C1 --> F2
    C1 --> F3
    C1 --> F4
    C1 --> F5

    F1 --> D2
    F2 --> D3
    F3 --> D4
    F4 --> D5
    F5 --> D6

    D1 --> D2
    D1 --> D3
    D1 --> D4
    D1 --> D5
    D1 --> D6

    D2 --> E1
    D3 --> E2
    D4 --> E3
    D5 --> E4
    D6 --> E5

    E1 --> G
    E2 --> G
    E3 --> G
    E4 --> G
    E5 --> G

    H1 --> A1
    H2 --> A1

    click A1 "https://github.com/captainshark007/spa-sentirsebien/blob/main/public/index.html"
    click A2 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/main.tsx"
    click B1 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/App.tsx"
    click B2 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/App.css"
    click B3 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/components/navbar/NavBar.tsx"
    click B4 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/components/navbar/NavBar.css"
    click C1 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/app/queryClient.ts"
    click C2 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/app/store.ts"
    click C3 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/features/auth/auth.slice.ts"
    click D1 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/config/axios.config.ts"
    click D2 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/features/auth/auth.service.ts"
    click D3 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/features/reserve/reserve.service.ts"
    click D4 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/features/schedule/schedule.service.ts"
    click D5 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/features/spa/spa.service.ts"
    click D6 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/features/user/user.service.ts"
    click E1 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/features/auth/auth.api.ts"
    click E2 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/features/reserve/reserve.api.ts"
    click E3 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/features/schedule/schedule.api.ts"
    click E4 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/features/spa/spa.api.ts"
    click E5 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/features/user/user.api.ts"
    click F1 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/features/auth/auth.query.ts"
    click F2 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/features/reserve/reserve.query.ts"
    click F3 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/features/schedule/schedule.query.ts"
    click F4 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/features/spa/spa.query.ts"
    click F5 "https://github.com/captainshark007/spa-sentirsebien/blob/main/src/features/user/user.query.ts"

    classDef frontend fill:#E3F2FD,stroke:#2196F3
    classDef state fill:#E8F5E9,stroke:#4CAF50
    classDef backend fill:#FFF3E0,stroke:#FF9800
    classDef external fill:#EEEEEE,stroke:#9E9E9E,shape:cylinder
    classDef build fill:#F3E5F5,stroke:#9C27B0
```
