# khalidnbg/krili architecture

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

- Interactive diagram: https://gitdiagram.com/khalidnbg/krili
- Repository: https://github.com/khalidnbg/krili

## Overview

This is a localized rental-listing marketplace: tenants browse and report properties, landlords create and manage listings, and admins review listings, reports, and users. The graph follows those user-facing stages into server actions and external services. Some feature links are documented only in the README; unsampled implementation details are not inferred.

Main entry points: [`lib/actions/listing.action.ts`](https://github.com/khalidnbg/krili/blob/master/lib/actions/listing.action.ts) (Listing operations), [`app/[locale]/admin/page.tsx`](https://github.com/khalidnbg/krili/blob/master/app/%5Blocale%5D/admin/page.tsx) (Moderation console), [`lib/actions/reports.action.ts`](https://github.com/khalidnbg/krili/blob/master/lib/actions/reports.action.ts) (Submit reports), [`app/[locale]/listings/[id]/page.tsx`](https://github.com/khalidnbg/krili/blob/master/app/%5Blocale%5D/listings/%5Bid%5D/page.tsx) (Listing details)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Tenant discovery"]
  node_browse["Browse listings<br/>[page.tsx]"]
  node_listing_search["Search and filter<br/>[page.tsx]"]
  node_listing_detail["Listing details<br/>[page.tsx]"]
  node_bookmarks["Saved listings<br/>[page.tsx]"]
  node_bookmark_actions["Bookmark actions"]
  node_contact_reveal["Reveal contact<br/>[ContactReveal.tsx]"]
  node_contact_action["Contact action<br/>[contact.action.ts]"]
  node_report_action["Submit reports<br/>[reports.action.ts]"]
end

subgraph group_landlord["Landlord listings"]
  node_listing_form["Listing form<br/>[ListingForm.tsx]"]
  node_listing_management["Listing operations<br/>[listing.action.ts]"]
  node_dashboard["Landlord dashboard<br/>[page.tsx]"]
  node_photo_upload["Photo upload"]
end

subgraph group_moderation["Admin moderation"]
  node_admin_page["Moderation console<br/>[page.tsx]"]
  node_listing_review["Listing review controls"]
  node_report_review["Report review controls"]
  node_user_admin["User administration"]
end

subgraph group_services["Shared services"]
  node_supabase[("Supabase data<br/>[supabase.ts]")]
  node_clerk["Clerk identity"]
  node_cloudinary["Cloudinary photos"]
  node_listing_mapper["Listing mapping<br/>[listing-mapper.ts]"]
  node_email_sender["Status email<br/>[send.ts]"]
end

node_tenant(("Tenant"))
node_landlord_user(("Landlord"))
node_admin_user(("Admin"))

node_tenant -->|"browses"| node_browse
node_tenant -->|"filters"| node_listing_search
node_browse -.->|"opens listings"| node_listing_search
node_listing_search -.->|"opens listing"| node_listing_detail
node_tenant -->|"views"| node_listing_detail
node_listing_detail -->|"offers contact"| node_contact_reveal
node_contact_reveal -->|"requests reveal"| node_contact_action
node_tenant -->|"reports listing"| node_report_action
node_listing_detail -->|"offers reporting"| node_report_action
node_tenant -->|"views saved"| node_bookmarks
node_bookmarks -->|"loads bookmarks"| node_bookmark_actions
node_landlord_user -->|"creates listing"| node_listing_form
node_listing_form -->|"uploads photos"| node_photo_upload
node_photo_upload -->|"stores photos"| node_cloudinary
node_listing_form -->|"submits listing"| node_listing_management
node_landlord_user -->|"manages listings"| node_dashboard
node_dashboard -->|"loads listing data"| node_listing_management
node_listing_management -->|"reads and writes"| node_supabase
node_listing_management -->|"maps rows"| node_listing_mapper
node_listing_management -->|"checks identity"| node_clerk
node_admin_user -->|"reviews marketplace"| node_admin_page
node_admin_page -->|"loads review queue"| node_listing_management
node_admin_page -->|"loads open reports"| node_report_action
node_admin_page -->|"loads users"| node_user_admin
node_admin_page -->|"renders controls"| node_listing_review
node_listing_review -->|"approves or rejects"| node_listing_management
node_admin_page -->|"renders controls"| node_report_review
node_report_review -->|"resolves reports"| node_report_action
node_user_admin -->|"queries users"| node_supabase
node_listing_management -->|"sends status email"| node_email_sender
node_report_action -->|"sends update email"| node_email_sender
node_email_sender -->|"uses client"| node_supabase

click node_browse "https://github.com/khalidnbg/krili/blob/master/app/%5Blocale%5D/(home)/page.tsx"
click node_listing_search "https://github.com/khalidnbg/krili/blob/master/app/%5Blocale%5D/listings/page.tsx"
click node_listing_detail "https://github.com/khalidnbg/krili/blob/master/app/%5Blocale%5D/listings/%5Bid%5D/page.tsx"
click node_bookmarks "https://github.com/khalidnbg/krili/blob/master/app/%5Blocale%5D/bookmarks/page.tsx"
click node_bookmark_actions "https://github.com/khalidnbg/krili/blob/master/lib/actions/bookmarks.action.ts"
click node_contact_reveal "https://github.com/khalidnbg/krili/blob/master/components/ContactReveal.tsx"
click node_contact_action "https://github.com/khalidnbg/krili/blob/master/lib/actions/contact.action.ts"
click node_report_action "https://github.com/khalidnbg/krili/blob/master/lib/actions/reports.action.ts"
click node_listing_form "https://github.com/khalidnbg/krili/blob/master/components/ListingForm.tsx"
click node_listing_management "https://github.com/khalidnbg/krili/blob/master/lib/actions/listing.action.ts"
click node_dashboard "https://github.com/khalidnbg/krili/blob/master/app/%5Blocale%5D/dashboard/page.tsx"
click node_admin_page "https://github.com/khalidnbg/krili/blob/master/app/%5Blocale%5D/admin/page.tsx"
click node_listing_review "https://github.com/khalidnbg/krili/blob/master/components/admin/ListingReviewActions.tsx"
click node_report_review "https://github.com/khalidnbg/krili/blob/master/components/admin/ReportReviewActions.tsx"
click node_user_admin "https://github.com/khalidnbg/krili/blob/master/lib/actions/admin-users.action.ts"
click node_supabase "https://github.com/khalidnbg/krili/blob/master/lib/supabase.ts"
click node_photo_upload "https://github.com/khalidnbg/krili/blob/master/lib/cloudinary-upload.ts"
click node_listing_mapper "https://github.com/khalidnbg/krili/blob/master/lib/listing-mapper.ts"
click node_email_sender "https://github.com/khalidnbg/krili/blob/master/lib/email/send.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_browse,node_listing_search,node_listing_detail,node_bookmarks,node_bookmark_actions,node_contact_reveal,node_contact_action,node_report_action toneBlue
class node_listing_form,node_listing_management,node_dashboard,node_photo_upload toneAmber
class node_admin_page,node_listing_review,node_report_review,node_user_admin toneMint
class node_supabase,node_clerk,node_cloudinary,node_listing_mapper,node_email_sender toneRose
class node_tenant,node_landlord_user,node_admin_user toneIndigo
```

## Components

### Tenant discovery

- [Browse listings](https://github.com/khalidnbg/krili/blob/master/app/%5Blocale%5D/(home)/page.tsx): `app/[locale]/(home)/page.tsx`
- [Search and filter](https://github.com/khalidnbg/krili/blob/master/app/%5Blocale%5D/listings/page.tsx): `app/[locale]/listings/page.tsx`
- [Listing details](https://github.com/khalidnbg/krili/blob/master/app/%5Blocale%5D/listings/%5Bid%5D/page.tsx): `app/[locale]/listings/[id]/page.tsx`
- [Saved listings](https://github.com/khalidnbg/krili/blob/master/app/%5Blocale%5D/bookmarks/page.tsx): `app/[locale]/bookmarks/page.tsx`
- [Bookmark actions](https://github.com/khalidnbg/krili/blob/master/lib/actions/bookmarks.action.ts): `lib/actions/bookmarks.action.ts`
- [Reveal contact](https://github.com/khalidnbg/krili/blob/master/components/ContactReveal.tsx): `components/ContactReveal.tsx`
- [Contact action](https://github.com/khalidnbg/krili/blob/master/lib/actions/contact.action.ts): `lib/actions/contact.action.ts`
- [Submit reports](https://github.com/khalidnbg/krili/blob/master/lib/actions/reports.action.ts): `lib/actions/reports.action.ts`

### Landlord listings

- [Listing form](https://github.com/khalidnbg/krili/blob/master/components/ListingForm.tsx): `components/ListingForm.tsx`
- [Listing operations](https://github.com/khalidnbg/krili/blob/master/lib/actions/listing.action.ts): `lib/actions/listing.action.ts`
- [Landlord dashboard](https://github.com/khalidnbg/krili/blob/master/app/%5Blocale%5D/dashboard/page.tsx): `app/[locale]/dashboard/page.tsx`
- [Photo upload](https://github.com/khalidnbg/krili/blob/master/lib/cloudinary-upload.ts): `lib/cloudinary-upload.ts`

### Admin moderation

- [Moderation console](https://github.com/khalidnbg/krili/blob/master/app/%5Blocale%5D/admin/page.tsx): `app/[locale]/admin/page.tsx`
- [Listing review controls](https://github.com/khalidnbg/krili/blob/master/components/admin/ListingReviewActions.tsx): `components/admin/ListingReviewActions.tsx`
- [Report review controls](https://github.com/khalidnbg/krili/blob/master/components/admin/ReportReviewActions.tsx): `components/admin/ReportReviewActions.tsx`
- [User administration](https://github.com/khalidnbg/krili/blob/master/lib/actions/admin-users.action.ts): `lib/actions/admin-users.action.ts`

### Shared services

- [Supabase data](https://github.com/khalidnbg/krili/blob/master/lib/supabase.ts): `lib/supabase.ts`
- **Clerk identity**
- **Cloudinary photos**
- [Listing mapping](https://github.com/khalidnbg/krili/blob/master/lib/listing-mapper.ts): `lib/listing-mapper.ts`
- [Status email](https://github.com/khalidnbg/krili/blob/master/lib/email/send.ts): `lib/email/send.ts`

### Other components

- **Tenant**
- **Landlord**
- **Admin**

## Connections

- Tenant → Browse listings: browses
- Tenant → Search and filter: filters
- Browse listings → Search and filter: opens listings
- Search and filter → Listing details: opens listing
- Tenant → Listing details: views
- Listing details → Reveal contact: offers contact (evidence: `app/[locale]/listings/[id]/page.tsx`)
- Reveal contact → Contact action: requests reveal (evidence: `components/ContactReveal.tsx`)
- Tenant → Submit reports: reports listing
- Listing details → Submit reports: offers reporting (evidence: `app/[locale]/listings/[id]/page.tsx`)
- Tenant → Saved listings: views saved (evidence: `app/[locale]/bookmarks/page.tsx`)
- Saved listings → Bookmark actions: loads bookmarks (evidence: `app/[locale]/bookmarks/page.tsx`)
- Landlord → Listing form: creates listing
- Listing form → Photo upload: uploads photos (evidence: `components/ListingForm.tsx`)
- Photo upload → Cloudinary photos: stores photos
- Listing form → Listing operations: submits listing (evidence: `components/ListingForm.tsx`)
- Landlord → Landlord dashboard: manages listings
- Landlord dashboard → Listing operations: loads listing data (evidence: `app/[locale]/dashboard/page.tsx`)
- Listing operations → Supabase data: reads and writes (evidence: `lib/actions/listing.action.ts`)
- Listing operations → Listing mapping: maps rows (evidence: `lib/actions/listing.action.ts`)
- Listing operations → Clerk identity: checks identity (evidence: `lib/actions/listing.action.ts`)
- Admin → Moderation console: reviews marketplace
- Moderation console → Listing operations: loads review queue (evidence: `app/[locale]/admin/page.tsx`)
- Moderation console → Submit reports: loads open reports (evidence: `app/[locale]/admin/page.tsx`)
- Moderation console → User administration: loads users (evidence: `app/[locale]/admin/page.tsx`)
- Moderation console → Listing review controls: renders controls (evidence: `app/[locale]/admin/page.tsx`)
- Listing review controls → Listing operations: approves or rejects (evidence: `components/admin/ListingReviewActions.tsx`)
- Moderation console → Report review controls: renders controls (evidence: `app/[locale]/admin/page.tsx`)
- Report review controls → Submit reports: resolves reports (evidence: `components/admin/ReportReviewActions.tsx`)
- User administration → Supabase data: queries users (evidence: `lib/actions/admin-users.action.ts`)
- Listing operations → Status email: sends status email (evidence: `lib/actions/listing.action.ts`)
- Submit reports → Status email: sends update email (evidence: `lib/actions/reports.action.ts`)
- Status email → Supabase data: uses client (evidence: `lib/actions/listing.action.ts`)
