# malasadongegg/lapagkainan architecture

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

- Interactive diagram: https://gitdiagram.com/malasadongegg/lapagkainan
- Repository: https://github.com/malasadongegg/lapagkainan

## Overview

LapagKainan is a community-powered Filipino food discovery map backed by a REST API. A user searches or browses spots, opens a spot’s community details, and can contribute a discovery, visit, review, or other activity; the app sends those actions to the API, which applies domain rules and persists data. The map, discovery feeds, profiles, saved spots, and admin moderation are distinct product branches. The README and source index establish the broad API capabilities; some server routes and frontend screens were not excerpted, so those relationships are shown only where documented.

Main entry points: [`web/src/lib/api.ts`](https://github.com/malasadongegg/lapagkainan/blob/main/web/src/lib/api.ts) (API client), [`server/index.js`](https://github.com/malasadongegg/lapagkainan/blob/main/server/index.js) (REST API), [`web/src/App.tsx`](https://github.com/malasadongegg/lapagkainan/blob/main/web/src/App.tsx) (App shell), [`web/src/screens/MapScreen.tsx`](https://github.com/malasadongegg/lapagkainan/blob/main/web/src/screens/MapScreen.tsx) (Map search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Discovery client"]
  node_app["App shell<br/>[App.tsx]"]
  node_mapsearch["Map search<br/>[MapScreen.tsx]"]
  node_mapview["Interactive map<br/>[MapView.tsx]"]
  node_discovery["Discover and profiles<br/>[Screens.tsx]"]
  node_spotdetail["Spot details<br/>[SpotDetail.tsx]"]
  node_stories["Community stories<br/>[stories.tsx]"]
  node_geo["Location and geocoding<br/>[geo.ts]"]
  node_maptiles["Map tiles<br/>[mapTiles.ts]"]
  node_format["Display formatting<br/>[format.ts]"]
end

subgraph group_contrib["Community contributions"]
  node_flows["Contribution flows<br/>[flows.tsx]"]
  node_dialogs["Auth and dialogs<br/>[dialogs.tsx]"]
  node_presentation["Shared UI and icons<br/>[ui.tsx]"]
end

subgraph group_api["API and domain"]
  node_api_client["API client<br/>[api.ts]"]
  node_types["Product data types<br/>[types.ts]"]
  node_rest["REST API<br/>[index.js]"]
  node_spot_domain["Spot search and lifecycle<br/>[spots.js]"]
  node_security["Auth and request utilities<br/>[util.js]"]
end

subgraph group_ops["Operations and data"]
  node_admin_api["Admin and moderation<br/>[admin.js]"]
  node_admin_ui["Admin dashboard<br/>[admin.html]"]
  node_sqlite[("SQLite data store<br/>[db.js]")]
end

node_diner(("Diner"))
node_carto["CARTO tile service"]
node_nominatim["Nominatim geocoder"]

node_diner -->|"uses"| node_app
node_app -->|"shows map"| node_mapsearch
node_app -->|"shows feeds"| node_discovery
node_app -->|"opens auth"| node_dialogs
node_app -->|"starts discovery"| node_flows
node_mapsearch -->|"fetches spots"| node_api_client
node_mapsearch -->|"renders map"| node_mapview
node_mapsearch -->|"gets location"| node_geo
node_mapview -->|"loads map data"| node_api_client
node_mapview -->|"uses tiles"| node_maptiles
node_mapsearch -->|"opens spot"| node_spotdetail
node_spotdetail -->|"loads interactions"| node_api_client
node_spotdetail -->|"starts review"| node_flows
node_spotdetail -->|"shows stories"| node_stories
node_discovery -->|"requests feeds"| node_api_client
node_flows -->|"posts contributions"| node_api_client
node_flows -->|"verifies location"| node_geo
node_dialogs -->|"authenticates"| node_api_client
node_presentation -->|"loads photos"| node_api_client
node_api_client -->|"calls REST"| node_rest
node_geo -->|"geocodes places"| node_nominatim
node_maptiles -->|"loads basemap"| node_carto
node_rest -->|"queries spots"| node_spot_domain
node_rest -->|"routes admin"| node_admin_api
node_rest -->|"checks requests"| node_security
node_rest -->|"reads and writes"| node_sqlite
node_spot_domain -->|"queries lifecycle"| node_sqlite
node_spot_domain -->|"uses geo helpers"| node_security
node_admin_api -->|"manages records"| node_sqlite
node_admin_api -->|"manages spot state"| node_spot_domain
node_admin_api -->|"uses utilities"| node_security
node_admin_ui -->|"uses admin API"| node_rest

click node_app "https://github.com/malasadongegg/lapagkainan/blob/main/web/src/App.tsx"
click node_mapsearch "https://github.com/malasadongegg/lapagkainan/blob/main/web/src/screens/MapScreen.tsx"
click node_mapview "https://github.com/malasadongegg/lapagkainan/blob/main/web/src/components/MapView.tsx"
click node_discovery "https://github.com/malasadongegg/lapagkainan/blob/main/web/src/screens/Screens.tsx"
click node_spotdetail "https://github.com/malasadongegg/lapagkainan/blob/main/web/src/components/SpotDetail.tsx"
click node_stories "https://github.com/malasadongegg/lapagkainan/blob/main/web/src/components/stories.tsx"
click node_flows "https://github.com/malasadongegg/lapagkainan/blob/main/web/src/components/flows.tsx"
click node_dialogs "https://github.com/malasadongegg/lapagkainan/blob/main/web/src/components/dialogs.tsx"
click node_presentation "https://github.com/malasadongegg/lapagkainan/blob/main/web/src/components/ui.tsx"
click node_api_client "https://github.com/malasadongegg/lapagkainan/blob/main/web/src/lib/api.ts"
click node_geo "https://github.com/malasadongegg/lapagkainan/blob/main/web/src/lib/geo.ts"
click node_maptiles "https://github.com/malasadongegg/lapagkainan/blob/main/web/src/lib/mapTiles.ts"
click node_format "https://github.com/malasadongegg/lapagkainan/blob/main/web/src/lib/format.ts"
click node_types "https://github.com/malasadongegg/lapagkainan/blob/main/web/src/lib/types.ts"
click node_rest "https://github.com/malasadongegg/lapagkainan/blob/main/server/index.js"
click node_spot_domain "https://github.com/malasadongegg/lapagkainan/blob/main/server/spots.js"
click node_security "https://github.com/malasadongegg/lapagkainan/blob/main/server/util.js"
click node_admin_api "https://github.com/malasadongegg/lapagkainan/blob/main/server/admin.js"
click node_admin_ui "https://github.com/malasadongegg/lapagkainan/blob/main/web/public/admin.html"
click node_sqlite "https://github.com/malasadongegg/lapagkainan/blob/main/server/db.js"

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_app,node_mapsearch,node_mapview,node_discovery,node_spotdetail,node_stories,node_geo,node_maptiles,node_format toneBlue
class node_flows,node_dialogs,node_presentation toneAmber
class node_api_client,node_types,node_rest,node_spot_domain,node_security toneMint
class node_admin_api,node_admin_ui,node_sqlite toneRose
class node_diner,node_carto,node_nominatim toneIndigo
```

## Components

### Discovery client

- [App shell](https://github.com/malasadongegg/lapagkainan/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Map search](https://github.com/malasadongegg/lapagkainan/blob/main/web/src/screens/MapScreen.tsx): `web/src/screens/MapScreen.tsx`
- [Interactive map](https://github.com/malasadongegg/lapagkainan/blob/main/web/src/components/MapView.tsx): `web/src/components/MapView.tsx`
- [Discover and profiles](https://github.com/malasadongegg/lapagkainan/blob/main/web/src/screens/Screens.tsx): `web/src/screens/Screens.tsx`
- [Spot details](https://github.com/malasadongegg/lapagkainan/blob/main/web/src/components/SpotDetail.tsx): `web/src/components/SpotDetail.tsx`
- [Community stories](https://github.com/malasadongegg/lapagkainan/blob/main/web/src/components/stories.tsx): `web/src/components/stories.tsx`
- [Location and geocoding](https://github.com/malasadongegg/lapagkainan/blob/main/web/src/lib/geo.ts): `web/src/lib/geo.ts`
- [Map tiles](https://github.com/malasadongegg/lapagkainan/blob/main/web/src/lib/mapTiles.ts): `web/src/lib/mapTiles.ts`
- [Display formatting](https://github.com/malasadongegg/lapagkainan/blob/main/web/src/lib/format.ts): `web/src/lib/format.ts`

### Community contributions

- [Contribution flows](https://github.com/malasadongegg/lapagkainan/blob/main/web/src/components/flows.tsx): `web/src/components/flows.tsx`
- [Auth and dialogs](https://github.com/malasadongegg/lapagkainan/blob/main/web/src/components/dialogs.tsx): `web/src/components/dialogs.tsx`
- [Shared UI and icons](https://github.com/malasadongegg/lapagkainan/blob/main/web/src/components/ui.tsx): `web/src/components/ui.tsx`

### API and domain

- [API client](https://github.com/malasadongegg/lapagkainan/blob/main/web/src/lib/api.ts): `web/src/lib/api.ts`
- [Product data types](https://github.com/malasadongegg/lapagkainan/blob/main/web/src/lib/types.ts): `web/src/lib/types.ts`
- [REST API](https://github.com/malasadongegg/lapagkainan/blob/main/server/index.js): `server/index.js`
- [Spot search and lifecycle](https://github.com/malasadongegg/lapagkainan/blob/main/server/spots.js): `server/spots.js`
- [Auth and request utilities](https://github.com/malasadongegg/lapagkainan/blob/main/server/util.js): `server/util.js`

### Operations and data

- [Admin and moderation](https://github.com/malasadongegg/lapagkainan/blob/main/server/admin.js): `server/admin.js`
- [Admin dashboard](https://github.com/malasadongegg/lapagkainan/blob/main/web/public/admin.html): `web/public/admin.html`
- [SQLite data store](https://github.com/malasadongegg/lapagkainan/blob/main/server/db.js): `server/db.js`

### Other components

- **Diner**
- **CARTO tile service**
- **Nominatim geocoder**

## Connections

- Diner → App shell: uses (evidence: `README.md`)
- App shell → Map search: shows map (evidence: `web/src/App.tsx`)
- App shell → Discover and profiles: shows feeds (evidence: `web/src/App.tsx`)
- App shell → Auth and dialogs: opens auth (evidence: `web/src/App.tsx`)
- App shell → Contribution flows: starts discovery (evidence: `web/src/App.tsx`)
- Map search → API client: fetches spots (evidence: `web/src/screens/MapScreen.tsx`)
- Map search → Interactive map: renders map (evidence: `web/src/screens/MapScreen.tsx`)
- Map search → Location and geocoding: gets location (evidence: `web/src/screens/MapScreen.tsx`)
- Interactive map → API client: loads map data (evidence: `web/src/components/MapView.tsx`)
- Interactive map → Map tiles: uses tiles (evidence: `web/src/components/MapView.tsx`)
- Map search → Spot details: opens spot (evidence: `web/src/screens/MapScreen.tsx`)
- Spot details → API client: loads interactions (evidence: `web/src/components/SpotDetail.tsx`)
- Spot details → Contribution flows: starts review (evidence: `web/src/components/SpotDetail.tsx`)
- Spot details → Community stories: shows stories (evidence: `web/src/components/SpotDetail.tsx`)
- Discover and profiles → API client: requests feeds (evidence: `web/src/screens/Screens.tsx`)
- Contribution flows → API client: posts contributions (evidence: `web/src/components/flows.tsx`)
- Contribution flows → Location and geocoding: verifies location (evidence: `web/src/components/flows.tsx`)
- Auth and dialogs → API client: authenticates (evidence: `web/src/components/dialogs.tsx`)
- Shared UI and icons → API client: loads photos (evidence: `web/src/components/ui.tsx`)
- API client → REST API: calls REST (evidence: `README.md`)
- Location and geocoding → Nominatim geocoder: geocodes places (evidence: `web/src/lib/geo.ts`)
- Map tiles → CARTO tile service: loads basemap (evidence: `README.md`)
- REST API → Spot search and lifecycle: queries spots (evidence: `server/index.js`)
- REST API → Admin and moderation: routes admin (evidence: `server/index.js`)
- REST API → Auth and request utilities: checks requests (evidence: `server/index.js`)
- REST API → SQLite data store: reads and writes (evidence: `server/index.js`)
- Spot search and lifecycle → SQLite data store: queries lifecycle (evidence: `server/spots.js`)
- Spot search and lifecycle → Auth and request utilities: uses geo helpers (evidence: `server/spots.js`)
- Admin and moderation → SQLite data store: manages records (evidence: `server/admin.js`)
- Admin and moderation → Spot search and lifecycle: manages spot state (evidence: `server/admin.js`)
- Admin and moderation → Auth and request utilities: uses utilities (evidence: `server/admin.js`)
- Admin dashboard → REST API: uses admin API (evidence: `README.md`)
