# anabrnjasevic/nuxt-maps architecture

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

- Interactive diagram: https://gitdiagram.com/anabrnjasevic/nuxt-maps
- Repository: https://github.com/anabrnjasevic/nuxt-maps

## Overview

##### Project type and purpose
- This is a full-stack single-page application (SPA) built on Nuxt 3 (Vue 3 + SSR/SSG).
- The README calls it a “Nuxt 3 Minimal Starter,” but the file tree shows custom pages, Vue components, composables (business logic hooks), middleware (auth), static assets, and a “server/api” folder with REST-style endpoints (PDF generation, directions, place lookup, data submission).

##### File structure
- Top-level Nuxt config: `nuxt.config.ts`, `tsconfig.json`, `tailwind.config.js`
- Frontend/UI:
- `pages/` – Vue page components (index.vue, signup.vue, basicsearch.vue, etc.)
- `components/` – reusable UI widgets (modals, buttons, date & type pickers, map, location picker)
- `assets/css/main.css` – custom Tailwind/CSS styles
- `public/` – static assets (videos) served as-is
- Frontend logic & state:
- `composables/` – Pinia-style hooks (`useGetPlaces`, `useDownloadPDF`, etc.) encapsulating API calls and reactive state
- `middleware/auth.js` – route guarding for authenticated pages
- Backend/API:
- `server/api/` – serverless endpoints (Nuxt 3’s built-in Nitro server) handling:
- `getPlaces.js` → external Places API
- `getDirections.js` → external Directions API
- `downloadPDF.js` → PDF generation service
- `sendData.js` → data persistence or external integration
- `server/tsconfig.json` – TypeScript config for server code
- Package management: `package.json`, `package-lock.json`

##### README for additional insights
- Standard Nuxt 3 setup instructions, dev/prod scripts, and link to Nuxt deployment docs.

- Client (browser)
- Pages layer (Nuxt router)
- Vue components & composables
- Middleware (auth)
- Nuxt server (Nitro)
- Serverless API routes under `/api/*`
- External services
- Third-party Maps & Directions API
- PDF generation engine
- Data storage or external data receiver (if applicable)
- Static asset store
- CDN or Nuxt `public/` for videos/CSS
b. Relationships & data flow:
1. User → Browser → Nuxt page (SSR/CSR)
2. Page/component invokes a composable (e.g., `useGetPlaces`)
3. Composable calls `/api/getPlaces` (via `$fetch` or `fetch`)
4. Nitro API handler queries external Places API → returns JSON
5. Component renders results; user triggers another action (e.g., generate PDF)
6. Composable calls `/api/downloadPDF` → Nitro endpoint calls PDF service → returns file stream or link
c. Architectural patterns & principles:
- Modular UI (atomic Vue components + composables)
- Clear separation of concerns:
- UI in `components/`
- Business logic in `composables/`
- Routing in `pages/`
- Auth in `middleware/`
- Server/API in `server/api/`
- Serverless functions (Nitro) for back-end without a separate Node.js app
d. Key technologies/frameworks:
- Nuxt 3 (Vue 3, Nitro, SSR/SSG)
- Tailwind CSS (via `tailwind.config.js`)
- TypeScript (configs in root and server)
- Serverless API routes (Nitro)
- External REST APIs (Google Maps, PDF service)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Zone
    subgraph "Client (Browser)" 
        direction TB
        Browser["User / Browser"]:::external
        Pages["Pages & Router"]:::frontend
        Components["Vue Components (UI Widgets)"]:::frontend
        Composables["Composables / State Hooks"]:::frontend
        Middleware["Auth Middleware"]:::frontend
    end

    %% Server Zone
    subgraph "Server (Nuxt Nitro)" 
        direction TB
        API_GetPlaces["GET /api/getPlaces"]:::api
        API_GetDirections["GET /api/getDirections"]:::api
        API_DownloadPDF["POST /api/downloadPDF"]:::api
        API_SendData["POST /api/sendData"]:::api
    end

    %% External Services Zone
    subgraph "External Services" 
        direction TB
        GooglePlaces["Google Places API"]:::external
        GoogleDirections["Google Directions API"]:::external
        PDFService["PDF Generation Service"]:::external
        DataStore["Data Storage / External Receiver"]:::external
        CDN["Static Assets CDN (public/)"]:::assets
    end

    %% Config & Assets Zone
    subgraph "Config & Assets" 
        direction TB
        NuxtConfig["nuxt.config.ts"]:::config
        TailwindConfig["tailwind.config.js"]:::config
        GlobalCSS["assets/css/main.css"]:::assets
        PublicAssets["public/"]:::assets
        RootTS["tsconfig.json"]:::config
        ServerTS["server/tsconfig.json"]:::config
        PackageJSON["package.json & package-lock.json"]:::config
    end

    %% Connections
    Browser -->|navigates to| Pages
    Pages -->|uses| Components
    Pages -->|guarded by| Middleware
    Pages -->|calls| Composables
    Components -->|invokes| Composables
    Composables -->|fetches| API_GetPlaces
    Composables -->|fetches| API_GetDirections
    Composables -->|posts| API_DownloadPDF
    Composables -->|posts| API_SendData

    API_GetPlaces -->|requests| GooglePlaces
    API_GetDirections -->|requests| GoogleDirections
    API_DownloadPDF -->|requests| PDFService
    API_SendData -->|stores to| DataStore

    Browser -->|loads static| CDN

    %% Click Events
    click Pages "https://github.com/anabrnjasevic/nuxt-maps/tree/main/pages/"
    click Components "https://github.com/anabrnjasevic/nuxt-maps/tree/main/components/"
    click Composables "https://github.com/anabrnjasevic/nuxt-maps/tree/main/composables/"
    click Middleware "https://github.com/anabrnjasevic/nuxt-maps/blob/main/middleware/auth.js"
    click API_GetPlaces "https://github.com/anabrnjasevic/nuxt-maps/blob/main/server/api/getPlaces.js"
    click API_GetDirections "https://github.com/anabrnjasevic/nuxt-maps/blob/main/server/api/getDirections.js"
    click API_DownloadPDF "https://github.com/anabrnjasevic/nuxt-maps/blob/main/server/api/downloadPDF.js"
    click API_SendData "https://github.com/anabrnjasevic/nuxt-maps/blob/main/server/api/sendData.js"
    click NuxtConfig "https://github.com/anabrnjasevic/nuxt-maps/blob/main/nuxt.config.ts"
    click TailwindConfig "https://github.com/anabrnjasevic/nuxt-maps/blob/main/tailwind.config.js"
    click GlobalCSS "https://github.com/anabrnjasevic/nuxt-maps/blob/main/assets/css/main.css"
    click PublicAssets "https://github.com/anabrnjasevic/nuxt-maps/tree/main/public/"
    click RootTS "https://github.com/anabrnjasevic/nuxt-maps/blob/main/tsconfig.json"
    click ServerTS "https://github.com/anabrnjasevic/nuxt-maps/blob/main/server/tsconfig.json"
    click PackageJSON "https://github.com/anabrnjasevic/nuxt-maps/blob/main/package.json"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,color:#0366D6;
    classDef api fill:#FFE4B5,stroke:#DD8E2E,color:#DD8E2E;
    classDef external fill:#DFF5E1,stroke:#2E8B57,color:#2E8B57;
    classDef config fill:#F3E1FF,stroke:#8B2EE8,color:#8B2EE8;
    classDef assets fill:#F0F0F0,stroke:#888888,color:#555555;
```
