# darkamui/seaview-penthouse architecture

> Architecture diagram of the GitHub repository darkamui/seaview-penthouse, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-02-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/darkamui/seaview-penthouse
- Repository: https://github.com/darkamui/seaview-penthouse

## Overview

##### Project Type & Purpose
- This is a full-stack, production-ready vacation-rental website built on Next.js (App Router) with static generation (SSG) and PWA capabilities, backed by a Sanity headless CMS. It also includes a standalone Sanity Studio for content management, plus integrations with external services (Google Analytics, CDN, etc.).

##### File-Structure–Based Architecture Analysis
- **Next.js “app” directory** – the public-facing frontend. File-based, locale-prefixed routes under `app/[locale]`, PWA manifest, global layout and CSS.
- **components/** – UI building blocks (shadcn/ui wrappers, image carousel, modals, hero sections, forms, etc.).
- **lib/** – data-fetching and utility functions (Sanity client, structured data/SEO, scroll-animation hooks).
- **i18n/** + **messages/** – next-intl configuration and JSON translation files for 3 locales (he, en, fr) with RTL/LTR handling.
- **sanity-studio/** – separate admin panel code (custom schemas, actions, scripts, styles) that connects to the same Sanity dataset.
- **CI/CD** – GitHub Actions workflow for deploy, Dockerfile for containerized production.

##### Key README Insights
- SSG for all routes + lazy client components.
- PWA via `public/manifest.ts` + custom `sw.js`.
- SEO via JSON-LD, Open Graph, hreflang, manual sitemap.
- Deployable as Docker container (standalone output) or on platforms like Vercel.

##### Main Components & Relationships
a. **Client (Browser & PWA Service Worker)**
- Fetches static or server-rendered pages from Next.js.
- Registers service worker for offline support, caching, “Install App.”
- Loads static assets (images, CSS, JS) via CDN or Next.js static server.
- Sends analytics events to Google Analytics.
b. **Next.js Frontend**
- Routes under `app/[locale]`, uses `getStaticProps`/`getStaticPaths` + dynamic metadata.
- Components consume `lib/sanity.client.ts` to fetch data at build time or runtime.
- Integrates next-intl for translations + automatic RTL/LTR switches.
- Exposes API routes (if any) or uses direct Sanity HTTP calls.
c. **Sanity Headless CMS (Content API)**
- Stores all content (events, gallery images, amenities, translations).
- Queried by the Next.js app via Sanity client.
- Driven by custom GROQ queries in `lib/sanity.queries.ts`.
d. **Sanity Studio (Admin UI)**
- Separate React/TypeScript app under `sanity-studio/`.
- Deploys to its own URL.
- Reads/writes from the same Sanity dataset; includes custom actions & scripts for bulk upload, auto-tagging.
e. **External Services**
- Google Analytics for usage metrics.
- CDN or static file hosting for images, video, fonts.
- DNS/SSL provider, Docker registry (if containerized).
f. **CI/CD Pipeline**
- GitHub Actions → Build & Deploy Docker image → Production environment.

##### Architectural Patterns & Principles
- **File-based routing & SSG** – clear separation of pages per locale.
- **Headless CMS** – content–presentation decoupling.
- **Client/Server Component Split** – interactive bits lazy-loaded as client components.
- **Progressive Enhancement** – PWA, offline service worker, manifest.
- **i18n** – next-intl config, locale subpaths, JSON translation files.
- **SEO best practices** – structured data, dynamic meta, sitemap, robots.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Public Site Layer
    subgraph "Public Site"
        direction TB
        Browser["Browser (User)"]:::ui
        ServiceWorker["Service Worker"]:::ui
        CDN["CDN / Static Server"]:::infra
        NextApp["Next.js App (App Router & SSG)"]:::ui
        i18n["Internationalization (next-intl & JSON)"]:::ui
        Components["UI Components"]:::ui
        Lib["Data Fetching & Utilities"]:::ui
    end

    %% Content Management Layer
    subgraph "Content Management"
        direction TB
        Studio["Sanity Studio (Admin UI)"]:::ui
    end

    %% Central Data Service
    Sanity["Sanity Dataset / API"]:::data

    %% CI/CD & Deployment Layer
    subgraph "CI/CD & Deployment"
        direction TB
        GH["GitHub Actions"]:::infra
        DockerReg["Docker Registry"]:::infra
        Prod["Production Server (Vercel/Docker)"]:::infra
    end

    %% External Services
    subgraph "External Services"
        direction TB
        GA["Google Analytics"]:::external
        DNS["DNS / SSL"]:::external
    end

    %% Data Flows
    Browser -->|"Request pages"| NextApp
    NextApp -->|"Build-time & Runtime fetch"| Sanity
    NextApp --> CDN
    Browser --> CDN
    Browser --> ServiceWorker
    ServiceWorker -->|"Intercept & cache"| CDN
    ServiceWorker -->|"Serve cached assets"| Browser
    Browser --> GA
    Studio -->|"CRUD operations"| Sanity
    Lib -->|"GROQ Queries"| Sanity
    i18n -->|"Load locale JSON"| Components
    GH -->|"Build & Deploy"| DockerReg
    GH --> Prod
    DockerReg --> Prod
    Prod --> NextApp
    DNS --> Prod

    %% Supporting dependencies
    NextApp --> i18n
    NextApp --> Components
    NextApp --> Lib

    %% Click Events
    click NextApp "https://github.com/darkamui/seaview-penthouse/tree/master/app/"
    click Components "https://github.com/darkamui/seaview-penthouse/tree/master/components/"
    click Lib "https://github.com/darkamui/seaview-penthouse/tree/master/lib/"
    click i18n "https://github.com/darkamui/seaview-penthouse/tree/master/i18n/"
    click Studio "https://github.com/darkamui/seaview-penthouse/tree/master/sanity-studio/"
    click ServiceWorker "https://github.com/darkamui/seaview-penthouse/blob/master/public/sw.js"
    click CDN "https://github.com/darkamui/seaview-penthouse/tree/master/public/"
    click GH "https://github.com/darkamui/seaview-penthouse/blob/master/.github/workflows/deploy.yml"
    click DockerReg "https://github.com/darkamui/seaview-penthouse/tree/master/Dockerfile"
    click Prod "https://github.com/darkamui/seaview-penthouse/blob/master/.env.local.example"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0366D6,stroke-width:1px;
    classDef data fill:#DFFFE0,stroke:#22863A,stroke-width:1px,shape:cylinder;
    classDef infra fill:#FFE4B5,stroke:#DB6D28,stroke-width:1px,shape:hexagon;
    classDef external fill:#E0E0E0,stroke:#606060,stroke-width:1px;
    class Browser,ServiceWorker,NextApp,i18n,Components,Lib,Studio ui
    class Sanity data
    class GH,DockerReg,Prod,CDN infra
    class GA,DNS external
```
