# djapedjape123/canti architecture

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

- Interactive diagram: https://gitdiagram.com/djapedjape123/canti
- Repository: https://github.com/djapedjape123/canti

## Overview

This is a bilingual apartment-rental website with guest booking and an owner admin panel. Guests browse localized listings, inspect availability and prices, then submit a reservation request; the server validates it, checks availability, recalculates the quote, and persists the reservation. The owner manages reservations, calendar blocks, and prices through protected admin pages and APIs. Edges are limited to relationships shown in excerpts or the SOURCE INDEX; several UI and integration details are unsampled, so their uncertain links are omitted.

Main entry points: [`app/api/reservations/route.ts`](https://github.com/djapedjape123/canti/blob/main/app/api/reservations/route.ts) (Reservation API), [`app/[lang]/apartmani/[slug]/page.tsx`](https://github.com/djapedjape123/canti/blob/main/app/%5Blang%5D/apartmani/%5Bslug%5D/page.tsx) (Apartment Page), [`lib/supabase/admin.ts`](https://github.com/djapedjape123/canti/blob/main/lib/supabase/admin.ts) (Server Database Client), [`lib/dates.ts`](https://github.com/djapedjape123/canti/blob/main/lib/dates.ts) (Date Utilities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_guest["Guest Website"]
  node_home["Home Page<br/>[page.tsx]"]
  node_listing["Apartment Page<br/>[page.tsx]"]
  node_home_sections["Home Sections"]
  node_booking_ui["Booking UI<br/>[BookingCard.tsx]"]
  node_localization["Localization<br/>[i18n.ts]"]
end

subgraph group_booking["Booking Domain"]
  node_apartments["Apartment Catalog<br/>[apartments.ts]"]
  node_availability["Availability<br/>[availability.ts]"]
  node_pricing["Pricing<br/>[pricing.ts]"]
  node_reservation_api["Reservation API<br/>[route.ts]"]
  node_validation["Input Validation<br/>[validation.ts]"]
  node_reservations["Reservations<br/>[reservations.ts]"]
  node_ical["Booking Calendar Sync<br/>[booking-ical.ts]"]
  node_email["Guest Email<br/>[email.ts]"]
end

subgraph group_admin["Owner Admin"]
  node_admin_pages["Admin Pages<br/>[page.tsx]"]
  node_admin_ui["Admin Components"]
  node_admin_auth["Admin Authorization<br/>[admin-auth.ts]"]
  node_admin_calendar["Calendar Management<br/>[admin-calendar.ts]"]
  node_admin_reservations["Reservation Management"]
  node_admin_api["Admin APIs<br/>[route.ts]"]
  node_admin_blocks["Block Operations<br/>[admin-blocks.ts]"]
end

subgraph group_infra["Data and Services"]
  node_supabase_admin["Server Database Client<br/>[admin.ts]"]
  node_database[("Supabase Database")]
  node_dates["Date Utilities<br/>[dates.ts]"]
  node_format["Formatting<br/>[format.ts]"]
  node_plural["Plural Rules<br/>[plural.ts]"]
end

node_guest(("Guest"))
node_owner(("Owner"))
node_mail_service["Email Provider"]

node_guest -->|"browses"| node_home
node_home -->|"renders"| node_home_sections
node_home -->|"loads listings"| node_apartments
node_home -->|"loads language"| node_localization
node_guest -->|"opens listing"| node_listing
node_listing -->|"loads apartment"| node_apartments
node_listing -->|"loads availability"| node_availability
node_listing -->|"loads prices"| node_pricing
node_listing -->|"renders"| node_booking_ui
node_booking_ui -.->|"submits request"| node_reservation_api
node_reservation_api -->|"validates input"| node_validation
node_reservation_api -->|"loads apartment"| node_apartments
node_reservation_api -->|"checks dates"| node_availability
node_reservation_api -->|"calculates quote"| node_pricing
node_reservation_api -.->|"creates reservation"| node_reservations
node_reservation_api -->|"sends notice"| node_email
node_availability -->|"reads calendar"| node_ical
node_availability -->|"checks bookings"| node_reservations
node_pricing -->|"uses dates"| node_dates
node_validation -->|"checks dates"| node_dates
node_reservation_api -->|"uses database client"| node_supabase_admin
node_apartments -->|"queries catalog"| node_supabase_admin
node_supabase_admin -->|"queries data"| node_database
node_admin_pages -->|"checks owner"| node_admin_auth
node_admin_pages -->|"renders lists"| node_admin_ui
node_admin_pages -->|"loads records"| node_admin_reservations
node_owner -.->|"manages rentals"| node_admin_pages
node_admin_auth -->|"verifies session"| node_supabase_admin
node_admin_api -->|"checks owner"| node_admin_auth
node_admin_api -->|"delegates blocks"| node_admin_blocks
node_admin_api -->|"validates changes"| node_validation
node_admin_api -->|"uses database client"| node_supabase_admin
node_admin_calendar -->|"uses dates"| node_dates
node_admin_calendar -->|"uses prices"| node_pricing
node_admin_reservations -->|"uses dates"| node_dates
node_admin_reservations -->|"uses plural rules"| node_plural
node_email -.->|"sends email"| node_mail_service
node_format -->|"formats dates"| node_dates
node_format -->|"uses locale"| node_localization

click node_home "https://github.com/djapedjape123/canti/blob/main/app/%5Blang%5D/page.tsx"
click node_listing "https://github.com/djapedjape123/canti/blob/main/app/%5Blang%5D/apartmani/%5Bslug%5D/page.tsx"
click node_home_sections "https://github.com/djapedjape123/canti/tree/main/components/home"
click node_booking_ui "https://github.com/djapedjape123/canti/blob/main/components/booking/BookingCard.tsx"
click node_localization "https://github.com/djapedjape123/canti/blob/main/lib/i18n.ts"
click node_apartments "https://github.com/djapedjape123/canti/blob/main/lib/apartments.ts"
click node_availability "https://github.com/djapedjape123/canti/blob/main/lib/availability.ts"
click node_pricing "https://github.com/djapedjape123/canti/blob/main/lib/pricing.ts"
click node_reservation_api "https://github.com/djapedjape123/canti/blob/main/app/api/reservations/route.ts"
click node_validation "https://github.com/djapedjape123/canti/blob/main/lib/validation.ts"
click node_reservations "https://github.com/djapedjape123/canti/blob/main/lib/reservations.ts"
click node_ical "https://github.com/djapedjape123/canti/blob/main/lib/booking-ical.ts"
click node_email "https://github.com/djapedjape123/canti/blob/main/lib/email.ts"
click node_admin_pages "https://github.com/djapedjape123/canti/blob/main/app/admin/(panel)/rezervacije/page.tsx"
click node_admin_ui "https://github.com/djapedjape123/canti/tree/main/components/admin"
click node_admin_auth "https://github.com/djapedjape123/canti/blob/main/lib/admin-auth.ts"
click node_admin_calendar "https://github.com/djapedjape123/canti/blob/main/lib/admin-calendar.ts"
click node_admin_reservations "https://github.com/djapedjape123/canti/blob/main/lib/admin-reservations.ts"
click node_admin_api "https://github.com/djapedjape123/canti/blob/main/app/api/admin/blocks/route.ts"
click node_admin_blocks "https://github.com/djapedjape123/canti/blob/main/lib/admin-blocks.ts"
click node_supabase_admin "https://github.com/djapedjape123/canti/blob/main/lib/supabase/admin.ts"
click node_dates "https://github.com/djapedjape123/canti/blob/main/lib/dates.ts"
click node_format "https://github.com/djapedjape123/canti/blob/main/lib/format.ts"
click node_plural "https://github.com/djapedjape123/canti/blob/main/lib/plural.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_home,node_listing,node_home_sections,node_booking_ui,node_localization toneBlue
class node_apartments,node_availability,node_pricing,node_reservation_api,node_validation,node_reservations,node_ical,node_email toneAmber
class node_admin_pages,node_admin_ui,node_admin_auth,node_admin_calendar,node_admin_reservations,node_admin_api,node_admin_blocks toneMint
class node_supabase_admin,node_database,node_dates,node_format,node_plural toneRose
class node_guest,node_owner,node_mail_service toneIndigo
```

## Components

### Guest Website

- [Home Page](https://github.com/djapedjape123/canti/blob/main/app/%5Blang%5D/page.tsx): `app/[lang]/page.tsx`
- [Apartment Page](https://github.com/djapedjape123/canti/blob/main/app/%5Blang%5D/apartmani/%5Bslug%5D/page.tsx): `app/[lang]/apartmani/[slug]/page.tsx`
- [Home Sections](https://github.com/djapedjape123/canti/tree/main/components/home): `components/home`
- [Booking UI](https://github.com/djapedjape123/canti/blob/main/components/booking/BookingCard.tsx): `components/booking/BookingCard.tsx`
- [Localization](https://github.com/djapedjape123/canti/blob/main/lib/i18n.ts): `lib/i18n.ts`

### Booking Domain

- [Apartment Catalog](https://github.com/djapedjape123/canti/blob/main/lib/apartments.ts): `lib/apartments.ts`
- [Availability](https://github.com/djapedjape123/canti/blob/main/lib/availability.ts): `lib/availability.ts`
- [Pricing](https://github.com/djapedjape123/canti/blob/main/lib/pricing.ts): `lib/pricing.ts`
- [Reservation API](https://github.com/djapedjape123/canti/blob/main/app/api/reservations/route.ts): `app/api/reservations/route.ts`
- [Input Validation](https://github.com/djapedjape123/canti/blob/main/lib/validation.ts): `lib/validation.ts`
- [Reservations](https://github.com/djapedjape123/canti/blob/main/lib/reservations.ts): `lib/reservations.ts`
- [Booking Calendar Sync](https://github.com/djapedjape123/canti/blob/main/lib/booking-ical.ts): `lib/booking-ical.ts`
- [Guest Email](https://github.com/djapedjape123/canti/blob/main/lib/email.ts): `lib/email.ts`

### Owner Admin

- [Admin Pages](https://github.com/djapedjape123/canti/blob/main/app/admin/(panel)/rezervacije/page.tsx): `app/admin/(panel)/rezervacije/page.tsx`
- [Admin Components](https://github.com/djapedjape123/canti/tree/main/components/admin): `components/admin`
- [Admin Authorization](https://github.com/djapedjape123/canti/blob/main/lib/admin-auth.ts): `lib/admin-auth.ts`
- [Calendar Management](https://github.com/djapedjape123/canti/blob/main/lib/admin-calendar.ts): `lib/admin-calendar.ts`
- [Reservation Management](https://github.com/djapedjape123/canti/blob/main/lib/admin-reservations.ts): `lib/admin-reservations.ts`
- [Admin APIs](https://github.com/djapedjape123/canti/blob/main/app/api/admin/blocks/route.ts): `app/api/admin/blocks/route.ts`
- [Block Operations](https://github.com/djapedjape123/canti/blob/main/lib/admin-blocks.ts): `lib/admin-blocks.ts`

### Data and Services

- [Server Database Client](https://github.com/djapedjape123/canti/blob/main/lib/supabase/admin.ts): `lib/supabase/admin.ts`
- **Supabase Database**
- [Date Utilities](https://github.com/djapedjape123/canti/blob/main/lib/dates.ts): `lib/dates.ts`
- [Formatting](https://github.com/djapedjape123/canti/blob/main/lib/format.ts): `lib/format.ts`
- [Plural Rules](https://github.com/djapedjape123/canti/blob/main/lib/plural.ts): `lib/plural.ts`

### Other components

- **Guest**
- **Owner**
- **Email Provider**

## Connections

- Guest → Home Page: browses (evidence: `app/[lang]/page.tsx`)
- Home Page → Home Sections: renders (evidence: `app/[lang]/page.tsx`)
- Home Page → Apartment Catalog: loads listings (evidence: `app/[lang]/page.tsx`)
- Home Page → Localization: loads language (evidence: `app/[lang]/page.tsx`)
- Guest → Apartment Page: opens listing (evidence: `app/[lang]/apartmani/[slug]/page.tsx`)
- Apartment Page → Apartment Catalog: loads apartment (evidence: `app/[lang]/apartmani/[slug]/page.tsx`)
- Apartment Page → Availability: loads availability (evidence: `app/[lang]/apartmani/[slug]/page.tsx`)
- Apartment Page → Pricing: loads prices (evidence: `app/[lang]/apartmani/[slug]/page.tsx`)
- Apartment Page → Booking UI: renders (evidence: `app/[lang]/apartmani/[slug]/page.tsx`)
- Booking UI → Reservation API: submits request
- Reservation API → Input Validation: validates input (evidence: `app/api/reservations/route.ts`)
- Reservation API → Apartment Catalog: loads apartment (evidence: `app/api/reservations/route.ts`)
- Reservation API → Availability: checks dates (evidence: `app/api/reservations/route.ts`)
- Reservation API → Pricing: calculates quote (evidence: `app/api/reservations/route.ts`)
- Reservation API → Reservations: creates reservation
- Reservation API → Guest Email: sends notice (evidence: `app/api/reservations/route.ts`)
- Availability → Booking Calendar Sync: reads calendar (evidence: `lib/availability.ts`)
- Availability → Reservations: checks bookings (evidence: `lib/availability.ts`)
- Pricing → Date Utilities: uses dates (evidence: `lib/pricing.ts`)
- Input Validation → Date Utilities: checks dates (evidence: `lib/validation.ts`)
- Reservation API → Server Database Client: uses database client (evidence: `app/api/reservations/route.ts`)
- Apartment Catalog → Server Database Client: queries catalog (evidence: `lib/apartments.ts`)
- Server Database Client → Supabase Database: queries data (evidence: `lib/supabase/admin.ts`)
- Admin Pages → Admin Authorization: checks owner (evidence: `app/admin/(panel)/rezervacije/page.tsx`)
- Admin Pages → Admin Components: renders lists (evidence: `app/admin/(panel)/rezervacije/page.tsx`)
- Admin Pages → Reservation Management: loads records (evidence: `app/admin/(panel)/rezervacije/page.tsx`)
- Owner → Admin Pages: manages rentals
- Admin Authorization → Server Database Client: verifies session (evidence: `lib/admin-auth.ts`)
- Admin APIs → Admin Authorization: checks owner (evidence: `app/api/admin/blocks/route.ts`)
- Admin APIs → Block Operations: delegates blocks (evidence: `app/api/admin/blocks/route.ts`)
- Admin APIs → Input Validation: validates changes (evidence: `app/api/admin/blocks/route.ts`)
- Admin APIs → Server Database Client: uses database client (evidence: `app/api/admin/blocks/route.ts`)
- Calendar Management → Date Utilities: uses dates (evidence: `lib/admin-calendar.ts`)
- Calendar Management → Pricing: uses prices (evidence: `lib/admin-calendar.ts`)
- Reservation Management → Date Utilities: uses dates (evidence: `lib/admin-reservations.ts`)
- Reservation Management → Plural Rules: uses plural rules (evidence: `lib/admin-reservations.ts`)
- Guest Email → Email Provider: sends email
- Formatting → Date Utilities: formats dates (evidence: `lib/format.ts`)
- Formatting → Localization: uses locale (evidence: `lib/format.ts`)
