# l145dev/airbnb-for-campers architecture

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

- Interactive diagram: https://gitdiagram.com/l145dev/airbnb-for-campers
- Repository: https://github.com/l145dev/airbnb-for-campers

## Overview

##### Project type and purpose
- This is a full-stack web application (“Airbnb for campers”) in active development.
- The frontend is a React + TypeScript single-page app scaffolded with Vite.
- The backend is a Node.js/Express server using Prisma ORM to a relational database (SQL scripts provided).

##### File structure
- Top-level directories:
- /backend – Express server, routes, middleware, Prisma schema
- /frontend – React SPA, components, pages, assets, UI library, utilities
- Config files:
- /backend/package.json, prisma/schema.prisma
- /frontend/package.json, tsconfig.json, vite.config.ts
- Database scripts: airbnb_for_campers.sql, dummy data SQL, prisma_setup.md
- API structure doc: api_structure.md

##### README for additional insights
- Phases show database and backend are complete; frontend is in progress.

##### Elements
- Clear labels: “React SPA”, “Express API”, “Prisma Client”, “PostgreSQL DB”, “Email Service”, etc.
- Browser → Static Host (GET index.html, JS bundles)
- Browser → Express API (POST /login, GET /listings)
- Express → Prisma → Database
- Express → External Email API
- Rectangles for services/components

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Tier
    subgraph "Presentation Tier"
        direction TB
        subgraph "React SPA"
            direction TB
            IndexHTML["index.html"]:::frontend
            MainTSX["main.tsx"]:::frontend
            AppTSX["App.tsx"]:::frontend
        end
        subgraph "Frontend Component Library"
            direction TB
            UIPrimitives["ui/"]:::frontend
        end
        subgraph "Frontend Pages"
            direction TB
            HomePage["Home.tsx"]:::frontend
            ListPage["List.tsx"]:::frontend
            ListingsPage["Listings.tsx"]:::frontend
            BookPage["Book.tsx"]:::frontend
            LoginPage["Login.tsx"]:::frontend
            RegisterPage["Register.tsx"]:::frontend
            ResetPasswordPage["ResetPassword.tsx"]:::frontend
            HostPage["Host.tsx"]:::frontend
            HostDashboardPage["HostDashboard.tsx"]:::frontend
            NotificationsPage["Notifications.tsx"]:::frontend
            SavedPage["Saved.tsx"]:::frontend
            SettingsPage["Settings.tsx"]:::frontend
            SupportPage["Support.tsx"]:::frontend
            TripsPage["Trips.tsx"]:::frontend
            PropertyPage["Property.tsx"]:::frontend
            NotFoundPage["NotFound.tsx"]:::frontend
        end
        subgraph "Frontend Utilities"
            direction TB
            FrontUtils["utils.ts / ratingDistribution.ts"]:::frontend
        end
        subgraph "Static Asset Server"
            direction TB
            ViteConfig["vite.config.ts"]:::frontend
            FEPackage["package.json"]:::frontend
        end
    end

    %% Application Tier
    subgraph "Application/Data Tier"
        direction TB
        ExpressAPI["Express API"]:::backend
        subgraph "API Layer (Routes)"
            direction TB
            AuthRoute["auth.js"]:::backend
            LoginRoute["login.js"]:::backend
            LogoutRoute["logout.js"]:::backend
            RegisterRoute["register.js"]:::backend
            ResetPasswordRoute["resetpassword.js"]:::backend
            ListingsRoute["listings.js"]:::backend
            BookingRoute["booking.js"]:::backend
            TripsRoute["trips.js"]:::backend
            HostRoute["host.js"]:::backend
            HostDashboardRoute["hostdashboard.js"]:::backend
            NotificationsRoute["notifications.js"]:::backend
            AutocompleteRoute["autocomplete.js"]:::backend
            PropertyRoute["property.js"]:::backend
            SettingsRoute["settings.js"]:::backend
            SupportRoute["support.js"]:::backend
            IndexRoute["index.js"]:::backend
        end
        subgraph "Authentication Subsystem"
            direction TB
            AuthMiddleware["auth.js"]:::backend
            IsHostUtil["isHost.js"]:::backend
        end
        subgraph "Utility Modules"
            direction TB
            AvailabilityUtil["availability.js"]:::backend
            NotificationUtil["createNotification.js"]:::backend
        end
        subgraph "Prisma ORM"
            direction TB
            PrismaSchema["schema.prisma"]:::backend
            BEPackage["package.json"]:::backend
            PrismaClient["Prisma Client"]:::backend
        end
        DB["Relational Database"]:::db
        subgraph "External Services"
            direction TB
            EmailService["Email Service"]:::external
            GeocodeService["Geocoding API"]:::external
        end
    end

    %% Connections
    IndexHTML -->|loads| ReactSPA
    MainTSX --> ReactSPA
    AppTSX --> ReactSPA
    ReactSPA -->|uses| UIPrimitives
    ReactSPA -->|renders pages| HomePage
    ReactSPA -->|renders pages| ListPage
    ReactSPA -->|renders pages| ListingsPage
    ReactSPA -->|renders pages| BookPage
    ReactSPA -->|renders pages| LoginPage
    ReactSPA -->|renders pages| RegisterPage
    ReactSPA -->|renders pages| ResetPasswordPage
    ReactSPA -->|renders pages| HostPage
    ReactSPA -->|renders pages| HostDashboardPage
    ReactSPA -->|renders pages| NotificationsPage
    ReactSPA -->|renders pages| SavedPage
    ReactSPA -->|renders pages| SettingsPage
    ReactSPA -->|renders pages| SupportPage
    ReactSPA -->|renders pages| TripsPage
    ReactSPA -->|renders pages| PropertyPage
    ReactSPA -->|renders pages| NotFoundPage
    ReactSPA -->|util| FrontUtils
    ReactSPA -->|served by| ViteConfig
    ReactSPA -->|served by| FEPackage

    ReactSPA -->|HTTPS| ExpressAPI
    ExpressAPI -->|routes| AuthRoute
    ExpressAPI -->|routes| LoginRoute
    ExpressAPI -->|routes| LogoutRoute
    ExpressAPI -->|routes| RegisterRoute
    ExpressAPI -->|routes| ResetPasswordRoute
    ExpressAPI -->|routes| ListingsRoute
    ExpressAPI -->|routes| BookingRoute
    ExpressAPI -->|routes| TripsRoute
    ExpressAPI -->|routes| HostRoute
    ExpressAPI -->|routes| HostDashboardRoute
    ExpressAPI -->|routes| NotificationsRoute
    ExpressAPI -->|routes| AutocompleteRoute
    ExpressAPI -->|routes| PropertyRoute
    ExpressAPI -->|routes| SettingsRoute
    ExpressAPI -->|routes| SupportRoute
    ExpressAPI -->|routes| IndexRoute

    ExpressAPI -->|middleware| AuthMiddleware
    ExpressAPI -->|middleware| IsHostUtil
    ExpressAPI -->|calls| AvailabilityUtil
    ExpressAPI -->|calls| NotificationUtil
    ExpressAPI -->|uses| PrismaClient
    PrismaClient -->|queries| DB
    ExpressAPI -->|calls| EmailService
    AutocompleteRoute -->|calls| GeocodeService

    %% Click Events
    click IndexHTML "https://github.com/l145dev/airbnb-for-campers/blob/main/frontend/index.html"
    click MainTSX "https://github.com/l145dev/airbnb-for-campers/blob/main/frontend/src/main.tsx"
    click AppTSX "https://github.com/l145dev/airbnb-for-campers/blob/main/frontend/src/App.tsx"
    click ViteConfig "https://github.com/l145dev/airbnb-for-campers/blob/main/frontend/vite.config.ts"
    click FEPackage "https://github.com/l145dev/airbnb-for-campers/blob/main/frontend/package.json"
    click AuthRoute "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/routes/auth.js"
    click LoginRoute "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/routes/login.js"
    click LogoutRoute "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/routes/logout.js"
    click RegisterRoute "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/routes/register.js"
    click ResetPasswordRoute "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/routes/resetpassword.js"
    click ListingsRoute "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/routes/listings.js"
    click BookingRoute "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/routes/booking.js"
    click TripsRoute "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/routes/trips.js"
    click HostRoute "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/routes/host.js"
    click HostDashboardRoute "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/routes/hostdashboard.js"
    click NotificationsRoute "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/routes/notifications.js"
    click AutocompleteRoute "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/routes/autocomplete.js"
    click PropertyRoute "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/routes/property.js"
    click SettingsRoute "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/routes/settings.js"
    click SupportRoute "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/routes/support.js"
    click IndexRoute "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/routes/index.js"
    click AuthMiddleware "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/middleware/auth.js"
    click IsHostUtil "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/utils/isHost.js"
    click AvailabilityUtil "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/utils/availability.js"
    click NotificationUtil "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/utils/createNotification.js"
    click PrismaSchema "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/prisma/schema.prisma"
    click BEPackage "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/package.json"
    click DB "https://github.com/l145dev/airbnb-for-campers/blob/main/airbnb_for_campers.sql"
    click EmailService "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/utils/createNotification.js"
    click GeocodeService "https://github.com/l145dev/airbnb-for-campers/blob/main/backend/routes/autocomplete.js"

    %% Styles
    classDef frontend fill:#E8F1FF,stroke:#0366d6,color:#0366d6;
    classDef backend fill:#F0F0F0,stroke:#000000,color:#000000;
    classDef db fill:#FFF3CD,stroke:#856404,color:#856404;
    classDef external fill:#E2FFE2,stroke:#228B22,color:#228B22;
```
