# jjxd3v/padinig architecture

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

- Interactive diagram: https://gitdiagram.com/jjxd3v/padinig
- Repository: https://github.com/jjxd3v/padinig

## Overview

Padinig is a barangay public-announcement and administration application. Residents browse announcements and receive notifications; administrators manage announcements, schedules, history, residents and emergency broadcasts. The frontend routes those experiences and uses a shared API client to communicate with an Express backend, whose route handlers implement authentication, announcements, users, notifications and BantAI chat. The backend also has shared persistence and response layers. The README identifies only a Vite template, so product capabilities are inferred from the routes, source index and sampled code; several page and service internals were not sampled.

Main entry points: [`src/App.tsx`](https://github.com/jjxd3v/padinig/blob/main/src/App.tsx) (App routing), [`src/lib/api.ts`](https://github.com/jjxd3v/padinig/blob/main/src/lib/api.ts) (API client), [`backend/src/routes/chat.ts`](https://github.com/jjxd3v/padinig/blob/main/backend/src/routes/chat.ts) (Chat endpoint), [`backend/src/app.ts`](https://github.com/jjxd3v/padinig/blob/main/backend/src/app.ts) (Backend API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experiences"]
  node_app_routes["App routing<br/>[App.tsx]"]
  node_public_announcements["Public announcements"]
  node_bant_ai["BantAI chat<br/>[BantAIChat.tsx]"]
  node_dashboard["Admin dashboard<br/>[DashboardPage.tsx]"]
  node_announcement_authoring["Announcement authoring"]
  node_schedule["Announcement scheduling<br/>[SchedulePage.tsx]"]
  node_history["Announcement history<br/>[HistoryPage.tsx]"]
  node_resident_management["Resident management"]
  node_emergency_broadcast["Emergency broadcast"]
  node_account["Account management"]
end

subgraph group_frontend_shared["Frontend shared services"]
  node_notification_context["Notification state"]
  node_auth_session["Auth session<br/>[auth.ts]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_backend_domain["Backend capabilities"]
  node_auth_routes["Authentication<br/>[auth.ts]"]
  node_announcement_routes["Announcement service<br/>[announcements.ts]"]
  node_user_routes["User service<br/>[users.ts]"]
  node_notification_routes["Notification service<br/>[notifications.ts]"]
  node_chat_routes["Chat endpoint<br/>[chat.ts]"]
  node_chat_intent["Intent detection<br/>[chatIntent.ts]"]
  node_chat_data["Chat data fetchers"]
  node_chat_language["Language processing<br/>[chatLanguage.ts]"]
  node_barangay_faq["Barangay FAQ<br/>[barangayFAQ.ts]"]
  node_chat_templates["Chat templates<br/>[chatTemplates.ts]"]
end

subgraph group_backend_core["Backend core"]
  node_backend_api["Backend API<br/>[app.ts]"]
  node_prisma["Prisma access<br/>[prisma.ts]"]
end

node_resident(("Resident"))
node_administrator(("Administrator"))
node_database[("Application database")]

node_resident -->|"browses"| node_app_routes
node_administrator -->|"uses"| node_app_routes
node_app_routes -->|"routes to"| node_public_announcements
node_app_routes -->|"routes to"| node_dashboard
node_app_routes -->|"routes to"| node_announcement_authoring
node_app_routes -->|"routes to"| node_schedule
node_app_routes -->|"routes to"| node_history
node_app_routes -->|"routes to"| node_resident_management
node_app_routes -->|"routes to"| node_emergency_broadcast
node_app_routes -->|"routes to"| node_account
node_public_announcements -->|"fetches announcements"| node_api_client
node_public_announcements -->|"uses notifications"| node_notification_context
node_public_announcements -->|"renders chat"| node_bant_ai
node_bant_ai -->|"uses announcements"| node_api_client
node_dashboard -->|"fetches data"| node_api_client
node_announcement_authoring -->|"submits data"| node_api_client
node_history -->|"fetches history"| node_api_client
node_resident_management -->|"fetches data"| node_api_client
node_notification_context -->|"fetches and updates"| node_api_client
node_notification_context -->|"checks user"| node_auth_session
node_api_client -->|"reads token"| node_auth_session
node_api_client -.->|"sends HTTP requests"| node_backend_api
node_backend_api -->|"mounts routes"| node_auth_routes
node_backend_api -->|"mounts routes"| node_user_routes
node_backend_api -->|"mounts routes"| node_announcement_routes
node_backend_api -->|"mounts routes"| node_notification_routes
node_backend_api -->|"mounts routes"| node_chat_routes
node_auth_routes -->|"uses persistence"| node_prisma
node_user_routes -->|"uses persistence"| node_prisma
node_announcement_routes -->|"uses persistence"| node_prisma
node_notification_routes -->|"uses persistence"| node_prisma
node_prisma -.->|"accesses"| node_database
node_chat_routes -->|"uses"| node_chat_intent
node_chat_routes -->|"uses"| node_chat_data
node_chat_routes -->|"uses"| node_chat_language
node_chat_routes -->|"reads FAQ"| node_barangay_faq
node_chat_routes -->|"uses templates"| node_chat_templates

click node_app_routes "https://github.com/jjxd3v/padinig/blob/main/src/App.tsx"
click node_public_announcements "https://github.com/jjxd3v/padinig/blob/main/src/pages/PublicAnnouncementsPage.tsx"
click node_bant_ai "https://github.com/jjxd3v/padinig/blob/main/src/components/BantAIChat.tsx"
click node_dashboard "https://github.com/jjxd3v/padinig/blob/main/src/pages/DashboardPage.tsx"
click node_announcement_authoring "https://github.com/jjxd3v/padinig/blob/main/src/pages/CreateAnnouncementPage.tsx"
click node_schedule "https://github.com/jjxd3v/padinig/blob/main/src/pages/SchedulePage.tsx"
click node_history "https://github.com/jjxd3v/padinig/blob/main/src/pages/HistoryPage.tsx"
click node_resident_management "https://github.com/jjxd3v/padinig/blob/main/src/pages/ResidentManagementPage.tsx"
click node_emergency_broadcast "https://github.com/jjxd3v/padinig/blob/main/src/pages/EmergencyBroadcastPage.tsx"
click node_account "https://github.com/jjxd3v/padinig/blob/main/src/pages/AccountSettingsPage.tsx"
click node_notification_context "https://github.com/jjxd3v/padinig/blob/main/src/contexts/NotificationContext.tsx"
click node_auth_session "https://github.com/jjxd3v/padinig/blob/main/src/lib/auth.ts"
click node_api_client "https://github.com/jjxd3v/padinig/blob/main/src/lib/api.ts"
click node_backend_api "https://github.com/jjxd3v/padinig/blob/main/backend/src/app.ts"
click node_auth_routes "https://github.com/jjxd3v/padinig/blob/main/backend/src/routes/auth.ts"
click node_announcement_routes "https://github.com/jjxd3v/padinig/blob/main/backend/src/routes/announcements.ts"
click node_user_routes "https://github.com/jjxd3v/padinig/blob/main/backend/src/routes/users.ts"
click node_notification_routes "https://github.com/jjxd3v/padinig/blob/main/backend/src/routes/notifications.ts"
click node_chat_routes "https://github.com/jjxd3v/padinig/blob/main/backend/src/routes/chat.ts"
click node_chat_intent "https://github.com/jjxd3v/padinig/blob/main/backend/src/services/chatIntent.ts"
click node_chat_data "https://github.com/jjxd3v/padinig/blob/main/backend/src/services/chatDataFetchers.ts"
click node_chat_language "https://github.com/jjxd3v/padinig/blob/main/backend/src/services/chatLanguage.ts"
click node_barangay_faq "https://github.com/jjxd3v/padinig/blob/main/backend/src/data/barangayFAQ.ts"
click node_chat_templates "https://github.com/jjxd3v/padinig/blob/main/backend/src/lib/chatTemplates.ts"
click node_prisma "https://github.com/jjxd3v/padinig/blob/main/backend/src/lib/prisma.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_app_routes,node_public_announcements,node_bant_ai,node_dashboard,node_announcement_authoring,node_schedule,node_history,node_resident_management,node_emergency_broadcast,node_account toneBlue
class node_notification_context,node_auth_session,node_api_client,node_database toneAmber
class node_auth_routes,node_announcement_routes,node_user_routes,node_notification_routes,node_chat_routes,node_chat_intent,node_chat_data,node_chat_language,node_barangay_faq,node_chat_templates toneMint
class node_backend_api,node_prisma toneRose
class node_resident,node_administrator toneIndigo
```

## Components

### Frontend experiences

- [App routing](https://github.com/jjxd3v/padinig/blob/main/src/App.tsx): `src/App.tsx`
- [Public announcements](https://github.com/jjxd3v/padinig/blob/main/src/pages/PublicAnnouncementsPage.tsx): `src/pages/PublicAnnouncementsPage.tsx`
- [BantAI chat](https://github.com/jjxd3v/padinig/blob/main/src/components/BantAIChat.tsx): `src/components/BantAIChat.tsx`
- [Admin dashboard](https://github.com/jjxd3v/padinig/blob/main/src/pages/DashboardPage.tsx): `src/pages/DashboardPage.tsx`
- [Announcement authoring](https://github.com/jjxd3v/padinig/blob/main/src/pages/CreateAnnouncementPage.tsx): `src/pages/CreateAnnouncementPage.tsx`
- [Announcement scheduling](https://github.com/jjxd3v/padinig/blob/main/src/pages/SchedulePage.tsx): `src/pages/SchedulePage.tsx`
- [Announcement history](https://github.com/jjxd3v/padinig/blob/main/src/pages/HistoryPage.tsx): `src/pages/HistoryPage.tsx`
- [Resident management](https://github.com/jjxd3v/padinig/blob/main/src/pages/ResidentManagementPage.tsx): `src/pages/ResidentManagementPage.tsx`
- [Emergency broadcast](https://github.com/jjxd3v/padinig/blob/main/src/pages/EmergencyBroadcastPage.tsx): `src/pages/EmergencyBroadcastPage.tsx`
- [Account management](https://github.com/jjxd3v/padinig/blob/main/src/pages/AccountSettingsPage.tsx): `src/pages/AccountSettingsPage.tsx`

### Frontend shared services

- [Notification state](https://github.com/jjxd3v/padinig/blob/main/src/contexts/NotificationContext.tsx): `src/contexts/NotificationContext.tsx`
- [Auth session](https://github.com/jjxd3v/padinig/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [API client](https://github.com/jjxd3v/padinig/blob/main/src/lib/api.ts): `src/lib/api.ts`

### Backend capabilities

- [Authentication](https://github.com/jjxd3v/padinig/blob/main/backend/src/routes/auth.ts): `backend/src/routes/auth.ts`
- [Announcement service](https://github.com/jjxd3v/padinig/blob/main/backend/src/routes/announcements.ts): `backend/src/routes/announcements.ts`
- [User service](https://github.com/jjxd3v/padinig/blob/main/backend/src/routes/users.ts): `backend/src/routes/users.ts`
- [Notification service](https://github.com/jjxd3v/padinig/blob/main/backend/src/routes/notifications.ts): `backend/src/routes/notifications.ts`
- [Chat endpoint](https://github.com/jjxd3v/padinig/blob/main/backend/src/routes/chat.ts): `backend/src/routes/chat.ts`
- [Intent detection](https://github.com/jjxd3v/padinig/blob/main/backend/src/services/chatIntent.ts): `backend/src/services/chatIntent.ts`
- [Chat data fetchers](https://github.com/jjxd3v/padinig/blob/main/backend/src/services/chatDataFetchers.ts): `backend/src/services/chatDataFetchers.ts`
- [Language processing](https://github.com/jjxd3v/padinig/blob/main/backend/src/services/chatLanguage.ts): `backend/src/services/chatLanguage.ts`
- [Barangay FAQ](https://github.com/jjxd3v/padinig/blob/main/backend/src/data/barangayFAQ.ts): `backend/src/data/barangayFAQ.ts`
- [Chat templates](https://github.com/jjxd3v/padinig/blob/main/backend/src/lib/chatTemplates.ts): `backend/src/lib/chatTemplates.ts`

### Backend core

- [Backend API](https://github.com/jjxd3v/padinig/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Prisma access](https://github.com/jjxd3v/padinig/blob/main/backend/src/lib/prisma.ts): `backend/src/lib/prisma.ts`

### Other components

- **Resident**
- **Administrator**
- **Application database**

## Connections

- Resident → App routing: browses (evidence: `src/App.tsx`)
- Administrator → App routing: uses (evidence: `src/App.tsx`)
- App routing → Public announcements: routes to (evidence: `src/App.tsx`)
- App routing → Admin dashboard: routes to (evidence: `src/App.tsx`)
- App routing → Announcement authoring: routes to (evidence: `src/App.tsx`)
- App routing → Announcement scheduling: routes to (evidence: `src/App.tsx`)
- App routing → Announcement history: routes to (evidence: `src/App.tsx`)
- App routing → Resident management: routes to (evidence: `src/App.tsx`)
- App routing → Emergency broadcast: routes to (evidence: `src/App.tsx`)
- App routing → Account management: routes to (evidence: `src/App.tsx`)
- Public announcements → API client: fetches announcements (evidence: `src/pages/PublicAnnouncementsPage.tsx`)
- Public announcements → Notification state: uses notifications (evidence: `src/pages/PublicAnnouncementsPage.tsx`)
- Public announcements → BantAI chat: renders chat (evidence: `src/pages/PublicAnnouncementsPage.tsx`)
- BantAI chat → API client: uses announcements (evidence: `src/components/BantAIChat.tsx`)
- Admin dashboard → API client: fetches data (evidence: `src/pages/DashboardPage.tsx`)
- Announcement authoring → API client: submits data (evidence: `src/pages/CreateAnnouncementPage.tsx`)
- Announcement history → API client: fetches history (evidence: `src/pages/HistoryPage.tsx`)
- Resident management → API client: fetches data (evidence: `src/pages/ResidentManagementPage.tsx`)
- Notification state → API client: fetches and updates (evidence: `src/contexts/NotificationContext.tsx`)
- Notification state → Auth session: checks user (evidence: `src/contexts/NotificationContext.tsx`)
- API client → Auth session: reads token (evidence: `src/lib/api.ts`)
- API client → Backend API: sends HTTP requests
- Backend API → Authentication: mounts routes (evidence: `backend/src/app.ts`)
- Backend API → User service: mounts routes (evidence: `backend/src/app.ts`)
- Backend API → Announcement service: mounts routes (evidence: `backend/src/app.ts`)
- Backend API → Notification service: mounts routes (evidence: `backend/src/app.ts`)
- Backend API → Chat endpoint: mounts routes (evidence: `backend/src/app.ts`)
- Authentication → Prisma access: uses persistence (evidence: `backend/src/routes/auth.ts`)
- User service → Prisma access: uses persistence (evidence: `backend/src/routes/users.ts`)
- Announcement service → Prisma access: uses persistence (evidence: `backend/src/routes/announcements.ts`)
- Notification service → Prisma access: uses persistence (evidence: `backend/src/routes/notifications.ts`)
- Prisma access → Application database: accesses
- Chat endpoint → Intent detection: uses (evidence: `backend/src/routes/chat.ts`)
- Chat endpoint → Chat data fetchers: uses (evidence: `backend/src/routes/chat.ts`)
- Chat endpoint → Language processing: uses (evidence: `backend/src/routes/chat.ts`)
- Chat endpoint → Barangay FAQ: reads FAQ (evidence: `backend/src/routes/chat.ts`)
- Chat endpoint → Chat templates: uses templates (evidence: `backend/src/routes/chat.ts`)
