# tux3er-isma/restaurantestarragona architecture

> Architecture diagram of the GitHub repository tux3er-isma/restaurantestarragona, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tux3er-isma/restaurantestarragona
- Repository: https://github.com/tux3er-isma/restaurantestarragona

## Overview

#### Purpose and Runtime
This is an Astro site for restaurant discovery, restaurant detail/reviews, user and restaurant dashboards, administration, and blog content. Astro file-based routes are the primary entry points; `.astro` server-rendered pages compose Astro and React JSX visual effects. Configuration is rooted in `astro.config.mjs`, `auth.config.mjs`, and `src/env.d.ts`.

#### Public Discovery Experience
The landing route builds a marketing/discovery experience with map, featured restaurants, opinion highlights, carousel, leaderboard, and footer. Its composition boundary is `src/pages/index.astro`, `src/components/MainPage/Main/Main.astro`, and `src/components/MainPage/Header/Header-MP.astro`. Static videos, fonts, map data, and restaurant imagery are served from `public/assets/MainPage`, `public/Map/map.json`, and `public/assets/Gallery`.

#### Restaurant Catalog, Search, and Detail Flow
Catalog-like data is exposed as JSON and consumed by dynamic restaurant and search routes. A visitor proceeds from search results to a restaurant-specific page, then sees gallery, details, aggregate opinion statistics, and reviews. Key paths: `src/pages/search/[result].astro`, `src/pages/restaurant/[restaurant].astro`, and `src/components/Restaurant/Main/Main.astro`. Static catalog endpoints are `src/pages/restaurant/restaurants.json` and `src/pages/restaurant/bestRestaurant.json`; image resolution is centralized in `src/lib/restaurant-images.ts`.

#### Identity and Account Boundaries
Separate auth pages support registration, login, password recovery/reset, code verification, Google login, and restaurant login/registration. UI is organized under `src/pages/auth/login.astro`, `src/layouts/AuthLayout.astro`, and `src/components/Auth/BasicAuth.astro`; state-changing actions cross into API routes such as `src/pages/api/login.json.ts`, `src/pages/api/googleLogin.json.ts`, and `src/pages/api/validate-session.json.ts`. `src/lib/supabase.ts` indicates Supabase is the persistence/auth integration boundary, while `src/lib/email.ts` supports email-based account workflows.

#### Dashboards and Role-Specific Workflows
Authenticated users and restaurant operators have distinct dashboard shells and sidebars, allowing profile/data/review management without sharing public-page composition. Core paths are `src/pages/dashboard.astro`, `src/layouts/DashboardLayout.astro`, and `src/layouts/DashboardLayoutRestaurant.astro`. Dashboard components divide general-user and restaurant-specific views under `src/components/Dashboard/User` and `src/components/Dashboard/Sections`.

#### Administration and Moderation
Admin routes provide user, restaurant, review, ranking, and blog-post operations. Administrative screens are rooted at `src/pages/admin/welcomePage.astro`, `src/pages/admin/manage-restaurants.astro`, and `src/pages/admin/manage-reviews.astro`; mutations are isolated behind endpoints in `src/pages/api/admin/manage-restaurant-action.json.ts`, `src/pages/api/admin/manage-review-action.json.ts`, and `src/pages/api/admin/user-level-adjustment.json.ts`. This is the main privileged control boundary.

#### Content, Media, and External Processing
Blog list/detail routes and CRUD endpoints form a separate editorial subsystem: `src/pages/blog/index.astro`, `src/pages/blog/[stamp].astro`, and `src/lib/blog.ts`. Reviews can pass through an AI revision endpoint at `src/pages/api/AIReviewRevision.json.ts`. User/profile and restaurant media upload/access flows use `src/pages/api/uploadProfilePic.json.ts`, `src/pages/api/deleteProfilePic.json.ts`, and `src/pages/api/restaurant-image.ts`; bundled gallery assets provide a fallback/static content layer.

Main entry points: [`src/lib/supabase.ts`](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/lib/supabase.ts) (Supabase), [`src/pages/api/login.json.ts`](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/api/login.json.ts) (Session & login API), [`src/pages/dashboard.astro`](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/dashboard.astro) (User dashboard), [`src/layouts/DashboardLayoutRestaurant.astro`](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/layouts/DashboardLayoutRestaurant.astro) (Restaurant dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public experience"]
  node_landing["Landing discovery<br/>Astro route<br/>[index.astro]"]
  node_landing_main["Landing main<br/>Astro component<br/>[Main.astro]"]
  node_landing_header["Landing header<br/>Astro component<br/>[Header-MP.astro]"]
  node_static_assets[("Maps &amp; gallery assets<br/>static media")]
  node_search["Restaurant search<br/>dynamic Astro route<br/>[&#91;result&#93;.astro]"]
  node_restaurant_detail["Restaurant detail<br/>dynamic Astro route<br/>[&#91;restaurant&#93;.astro]"]
  node_restaurant_main["Restaurant view<br/>Astro component<br/>[Main.astro]"]
  node_catalog[("Restaurant catalog<br/>JSON endpoint<br/>[restaurants.json]")]
  node_image_resolution["Restaurant images<br/>image resolver"]
end

subgraph group_identity["Identity &amp; accounts"]
  node_auth_ui["Authentication UI<br/>auth route/layout<br/>[login.astro]"]
  node_auth_api{{"Session &amp; login API<br/>API route<br/>[login.json.ts]"}}
  node_supabase[("Supabase<br/>auth &amp; persistence<br/>[supabase.ts]")]
  node_email["Email workflows<br/>email integration<br/>[email.ts]"]
end

subgraph group_dashboards["Role dashboards"]
  node_user_dashboard["User dashboard<br/>Astro route/layout<br/>[dashboard.astro]"]
  node_restaurant_dashboard["Restaurant dashboard<br/>dashboard layout"]
end

subgraph group_admin["Administration"]
  node_admin_ui["Admin screens<br/>Astro routes"]
  node_admin_api{{"Admin mutation API<br/>API route"}}
end

subgraph group_content["Content &amp; media"]
  node_blog["Blog subsystem<br/>routes &amp; data library<br/>[index.astro]"]
  node_ai_review{{"AI review revision<br/>API route"}}
  node_profile_media{{"Profile media API<br/>API route"}}
end

node_landing -->|"composes"| node_landing_header
node_landing -->|"composes"| node_landing_main
node_landing_main -->|"loads"| node_static_assets
node_search -->|"queries"| node_catalog
node_search -->|"navigates to"| node_restaurant_detail
node_restaurant_detail -->|"composes"| node_restaurant_main
node_restaurant_detail -->|"reads"| node_catalog
node_restaurant_main -->|"resolves images"| node_image_resolution
node_image_resolution -->|"uses gallery"| node_static_assets
node_auth_ui -->|"submits to"| node_auth_api
node_auth_api -->|"authenticates"| node_supabase
node_auth_api -->|"triggers recovery mail"| node_email
node_user_dashboard -.->|"validates session"| node_auth_api
node_restaurant_dashboard -.->|"validates session"| node_auth_api
node_user_dashboard -->|"manages account data"| node_supabase
node_restaurant_dashboard -->|"manages restaurant data"| node_supabase
node_admin_ui -->|"mutates"| node_admin_api
node_admin_api -->|"updates privileged data"| node_supabase
node_blog -->|"persists posts"| node_supabase
node_ai_review -.->|"reads review context"| node_supabase
node_user_dashboard -->|"uploads media"| node_profile_media
node_restaurant_dashboard -->|"uploads media"| node_profile_media
node_profile_media -->|"stores media references"| node_supabase

click node_landing "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/index.astro"
click node_landing_main "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/components/MainPage/Main/Main.astro"
click node_landing_header "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/components/MainPage/Header/Header-MP.astro"
click node_static_assets "https://github.com/tux3er-isma/restaurantestarragona/tree/main/public/assets/MainPage"
click node_search "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/search/%5Bresult%5D.astro"
click node_restaurant_detail "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/restaurant/%5Brestaurant%5D.astro"
click node_restaurant_main "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/components/Restaurant/Main/Main.astro"
click node_catalog "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/restaurant/restaurants.json"
click node_image_resolution "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/lib/restaurant-images.ts"
click node_auth_ui "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/auth/login.astro"
click node_auth_api "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/api/login.json.ts"
click node_supabase "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/lib/supabase.ts"
click node_email "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/lib/email.ts"
click node_user_dashboard "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/dashboard.astro"
click node_restaurant_dashboard "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/layouts/DashboardLayoutRestaurant.astro"
click node_admin_ui "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/admin/manage-restaurants.astro"
click node_admin_api "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/api/admin/manage-restaurant-action.json.ts"
click node_blog "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/blog/index.astro"
click node_ai_review "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/api/AIReviewRevision.json.ts"
click node_profile_media "https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/api/uploadProfilePic.json.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_landing,node_landing_main,node_landing_header,node_static_assets,node_search,node_restaurant_detail,node_restaurant_main,node_catalog,node_image_resolution toneBlue
class node_auth_ui,node_auth_api,node_supabase,node_email toneAmber
class node_user_dashboard,node_restaurant_dashboard toneMint
class node_admin_ui,node_admin_api toneRose
class node_blog,node_ai_review,node_profile_media toneIndigo
```

## Components

### Public experience

- [Landing discovery](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/index.astro): Astro route · Marketing, map, featured restaurant, and leaderboard composition. · `src/pages/index.astro`
- [Landing main](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/components/MainPage/Main/Main.astro): Astro component · `src/components/MainPage/Main/Main.astro`
- [Landing header](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/components/MainPage/Header/Header-MP.astro): Astro component · `src/components/MainPage/Header/Header-MP.astro`
- [Maps & gallery assets](https://github.com/tux3er-isma/restaurantestarragona/tree/main/public/assets/MainPage): static media · Videos, fonts, map data, and restaurant imagery. · `public/assets/MainPage`
- [Restaurant search](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/search/%5Bresult%5D.astro): dynamic Astro route · `src/pages/search/[result].astro`
- [Restaurant detail](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/restaurant/%5Brestaurant%5D.astro): dynamic Astro route · Gallery, details, opinion statistics, and reviews. · `src/pages/restaurant/[restaurant].astro`
- [Restaurant view](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/components/Restaurant/Main/Main.astro): Astro component · `src/components/Restaurant/Main/Main.astro`
- [Restaurant catalog](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/restaurant/restaurants.json): JSON endpoint · `src/pages/restaurant/restaurants.json`
- [Restaurant images](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/lib/restaurant-images.ts): image resolver · `src/lib/restaurant-images.ts`

### Identity & accounts

- [Authentication UI](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/auth/login.astro): auth route/layout · Registration, login, recovery, verification, and restaurant access. · `src/pages/auth/login.astro`
- [Session & login API](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/api/login.json.ts): API route · State-changing account and session operations. · `src/pages/api/login.json.ts`
- [Supabase](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/lib/supabase.ts): auth & persistence · External authentication and persistence boundary. · `src/lib/supabase.ts`
- [Email workflows](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/lib/email.ts): email integration · `src/lib/email.ts`

### Role dashboards

- [User dashboard](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/dashboard.astro): Astro route/layout · Authenticated profile, data, and review management. · `src/pages/dashboard.astro`
- [Restaurant dashboard](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/layouts/DashboardLayoutRestaurant.astro): dashboard layout · Operator-specific management shell. · `src/layouts/DashboardLayoutRestaurant.astro`

### Administration

- [Admin screens](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/admin/manage-restaurants.astro): Astro routes · Privileged user, restaurant, review, ranking, and blog operations. · `src/pages/admin/manage-restaurants.astro`
- [Admin mutation API](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/api/admin/manage-restaurant-action.json.ts): API route · Privileged restaurant, review, and user-level mutations. · `src/pages/api/admin/manage-restaurant-action.json.ts`

### Content & media

- [Blog subsystem](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/blog/index.astro): routes & data library · Editorial list, detail, and CRUD flow. · `src/pages/blog/index.astro`
- [AI review revision](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/api/AIReviewRevision.json.ts): API route · `src/pages/api/AIReviewRevision.json.ts`
- [Profile media API](https://github.com/tux3er-isma/restaurantestarragona/blob/main/src/pages/api/uploadProfilePic.json.ts): API route · User and restaurant media upload, deletion, and access. · `src/pages/api/uploadProfilePic.json.ts`

## Connections

- Landing discovery → Landing header: composes
- Landing discovery → Landing main: composes
- Landing main → Maps & gallery assets: loads
- Restaurant search → Restaurant catalog: queries
- Restaurant search → Restaurant detail: navigates to
- Restaurant detail → Restaurant view: composes
- Restaurant detail → Restaurant catalog: reads
- Restaurant view → Restaurant images: resolves images
- Restaurant images → Maps & gallery assets: uses gallery
- Authentication UI → Session & login API: submits to
- Session & login API → Supabase: authenticates
- Session & login API → Email workflows: triggers recovery mail
- User dashboard → Session & login API: validates session
- Restaurant dashboard → Session & login API: validates session
- User dashboard → Supabase: manages account data
- Restaurant dashboard → Supabase: manages restaurant data
- Admin screens → Admin mutation API: mutates
- Admin mutation API → Supabase: updates privileged data
- Blog subsystem → Supabase: persists posts
- AI review revision → Supabase: reads review context
- User dashboard → Profile media API: uploads media
- Restaurant dashboard → Profile media API: uploads media
- Profile media API → Supabase: stores media references
