# yaahaablyaa/peppv7 architecture

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

- Interactive diagram: https://gitdiagram.com/yaahaablyaa/peppv7
- Repository: https://github.com/yaahaablyaa/peppv7

## Overview

Peppv7 is a restaurant staff-management system combining a Telegram bot and employee/manager web app. Staff sign in or link their account, then use self-service attendance, schedules and staff resources; managers administer staff and schedules, while analytics and payroll support oversight. The graph separates entry points, workforce operations, employee capabilities and persistence. The README provides only the product name; feature coverage also reflects the sampled source and SOURCE INDEX, so links from unsampled web views to API routes are omitted.

Main entry points: [`restaurant-staff-bot/lib/api.js`](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/api.js) (Mini app API), [`restaurant-staff-bot/bot.js`](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/bot.js) (Bot setup), [`restaurant-staff-bot/lib/staff.js`](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/staff.js) (Staff directory), [`restaurant-staff-bot/webapp/app.js`](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/webapp/app.js) (Web app shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry points"]
  node_server["Web server<br/>[server.js]"]
  node_bot["Bot setup<br/>[bot.js]"]
  node_webapp["Web app shell<br/>[app.js]"]
  node_webanalytics["Analytics view<br/>[analytics.js]"]
  node_weblearning["Learning view<br/>[learning.js]"]
  node_applications["Applications view<br/>[applications.js]"]
end

subgraph group_workforce["Workforce operations"]
  node_staffhandler["Staff bot flows<br/>[staff.js]"]
  node_shifthandler["Shift bot flows<br/>[shifts.js]"]
  node_staffservice["Staff directory<br/>[staff.js]"]
  node_employees["Employee identity<br/>[employees.js]"]
  node_roles["Roles and access<br/>[roles.js]"]
  node_shiftservice["Shift planning<br/>[shifts.js]"]
end

subgraph group_employee["Employee services"]
  node_api["Mini app API<br/>[api.js]"]
  node_attendance["Attendance<br/>[attendance.js]"]
  node_learning["Learning content<br/>[learning.js]"]
end

subgraph group_insight["Analytics and learning"]
  node_analytics["Analytics<br/>[analytics.js]"]
  node_reports["Analytics reports"]
  node_salary["Payroll calculations<br/>[salary.js]"]
  node_time["Business time<br/>[time.js]"]
end

subgraph group_persistence["Persistence"]
  node_schema["Schema and migrations<br/>[schema.js]"]
  node_adapter["Database adapter<br/>[db-adapter.js]"]
  node_database[("SQLite database<br/>[database.db]")]
end

node_staff(("Staff and managers"))
node_telegram(("Telegram platform"))

node_staff -->|"uses bot"| node_telegram
node_staff -->|"uses web app"| node_server
node_server -->|"starts"| node_bot
node_server -->|"opens database"| node_adapter
node_server -->|"serves static app"| node_webapp
node_bot -->|"initializes"| node_schema
node_bot -->|"registers routes"| node_api
node_bot -->|"registers flows"| node_staffhandler
node_bot -->|"registers flows"| node_shifthandler
node_staffhandler -->|"manages staff"| node_staffservice
node_shifthandler -->|"plans shifts"| node_shiftservice
node_shifthandler -->|"looks up staff"| node_staffservice
node_staffservice -->|"uses identity"| node_employees
node_staffservice -->|"derives roles"| node_roles
node_api -->|"handles check-in"| node_attendance
node_api -->|"registers analytics"| node_analytics
node_api -->|"registers reports"| node_reports
node_api -->|"registers learning"| node_learning
node_api -->|"resolves employees"| node_employees
node_api -->|"uses payroll"| node_salary
node_api -->|"serves schedules"| node_shiftservice
node_api -->|"serves staff actions"| node_staffservice
node_api -->|"checks permissions"| node_roles
node_attendance -->|"uses business time"| node_time
node_analytics -->|"uses payroll"| node_salary
node_analytics -->|"uses role data"| node_roles
node_reports -->|"uses payroll"| node_salary
node_reports -->|"uses business time"| node_time
node_salary -->|"uses business time"| node_time
node_learning -->|"uses business time"| node_time
node_schema -->|"creates tables"| node_database
node_attendance -->|"reads and writes"| node_database
node_salary -->|"reads attendance"| node_database
node_staffservice -->|"reads and writes"| node_database
node_api -.->|"serves API data"| node_webapp
node_telegram -.->|"sends updates"| node_bot
node_webapp -.->|"shows analytics"| node_webanalytics
node_webapp -.->|"shows learning"| node_weblearning
node_webapp -.->|"shows applications"| node_applications

click node_server "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/server.js"
click node_bot "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/bot.js"
click node_webapp "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/webapp/app.js"
click node_webanalytics "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/webapp/analytics.js"
click node_weblearning "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/webapp/learning.js"
click node_applications "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/webapp/applications.js"
click node_staffhandler "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/handlers/staff.js"
click node_shifthandler "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/handlers/shifts.js"
click node_staffservice "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/staff.js"
click node_employees "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/employees.js"
click node_roles "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/roles.js"
click node_shiftservice "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/shifts.js"
click node_api "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/api.js"
click node_attendance "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/attendance.js"
click node_learning "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/learning.js"
click node_analytics "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/analytics.js"
click node_reports "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/analytics-report.js"
click node_salary "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/salary.js"
click node_time "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/time.js"
click node_schema "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/schema.js"
click node_adapter "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/db-adapter.js"
click node_database "https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/seed/database.db"

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_server,node_bot,node_webapp,node_webanalytics,node_weblearning,node_applications toneBlue
class node_staffhandler,node_shifthandler,node_staffservice,node_employees,node_roles,node_shiftservice toneAmber
class node_api,node_attendance,node_learning toneMint
class node_analytics,node_reports,node_salary,node_time toneRose
class node_schema,node_adapter,node_database,node_staff,node_telegram toneIndigo
```

## Components

### Application entry points

- [Web server](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/server.js): `restaurant-staff-bot/server.js`
- [Bot setup](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/bot.js): `restaurant-staff-bot/bot.js`
- [Web app shell](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/webapp/app.js): `restaurant-staff-bot/webapp/app.js`
- [Analytics view](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/webapp/analytics.js): `restaurant-staff-bot/webapp/analytics.js`
- [Learning view](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/webapp/learning.js): `restaurant-staff-bot/webapp/learning.js`
- [Applications view](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/webapp/applications.js): `restaurant-staff-bot/webapp/applications.js`

### Workforce operations

- [Staff bot flows](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/handlers/staff.js): `restaurant-staff-bot/handlers/staff.js`
- [Shift bot flows](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/handlers/shifts.js): `restaurant-staff-bot/handlers/shifts.js`
- [Staff directory](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/staff.js): `restaurant-staff-bot/lib/staff.js`
- [Employee identity](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/employees.js): `restaurant-staff-bot/lib/employees.js`
- [Roles and access](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/roles.js): `restaurant-staff-bot/lib/roles.js`
- [Shift planning](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/shifts.js): `restaurant-staff-bot/lib/shifts.js`

### Employee services

- [Mini app API](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/api.js): `restaurant-staff-bot/lib/api.js`
- [Attendance](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/attendance.js): `restaurant-staff-bot/lib/attendance.js`
- [Learning content](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/learning.js): `restaurant-staff-bot/lib/learning.js`

### Analytics and learning

- [Analytics](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/analytics.js): `restaurant-staff-bot/lib/analytics.js`
- [Analytics reports](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/analytics-report.js): `restaurant-staff-bot/lib/analytics-report.js`
- [Payroll calculations](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/salary.js): `restaurant-staff-bot/lib/salary.js`
- [Business time](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/time.js): `restaurant-staff-bot/lib/time.js`

### Persistence

- [Schema and migrations](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/schema.js): `restaurant-staff-bot/lib/schema.js`
- [Database adapter](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/lib/db-adapter.js): `restaurant-staff-bot/lib/db-adapter.js`
- [SQLite database](https://github.com/yaahaablyaa/peppv7/blob/main/restaurant-staff-bot/seed/database.db): `restaurant-staff-bot/seed/database.db`

### Other components

- **Staff and managers**
- **Telegram platform**

## Connections

- Staff and managers → Telegram platform: uses bot
- Staff and managers → Web server: uses web app (evidence: `restaurant-staff-bot/server.js`)
- Web server → Bot setup: starts (evidence: `restaurant-staff-bot/server.js`)
- Web server → Database adapter: opens database (evidence: `restaurant-staff-bot/server.js`)
- Web server → Web app shell: serves static app (evidence: `restaurant-staff-bot/server.js`)
- Bot setup → Schema and migrations: initializes (evidence: `restaurant-staff-bot/bot.js`)
- Bot setup → Mini app API: registers routes (evidence: `restaurant-staff-bot/bot.js`)
- Bot setup → Staff bot flows: registers flows (evidence: `restaurant-staff-bot/bot.js`)
- Bot setup → Shift bot flows: registers flows (evidence: `restaurant-staff-bot/bot.js`)
- Staff bot flows → Staff directory: manages staff (evidence: `restaurant-staff-bot/handlers/staff.js`)
- Shift bot flows → Shift planning: plans shifts (evidence: `restaurant-staff-bot/handlers/shifts.js`)
- Shift bot flows → Staff directory: looks up staff (evidence: `restaurant-staff-bot/handlers/shifts.js`)
- Staff directory → Employee identity: uses identity (evidence: `restaurant-staff-bot/lib/staff.js`)
- Staff directory → Roles and access: derives roles (evidence: `restaurant-staff-bot/lib/staff.js`)
- Mini app API → Attendance: handles check-in (evidence: `restaurant-staff-bot/lib/api.js`)
- Mini app API → Analytics: registers analytics (evidence: `restaurant-staff-bot/lib/api.js`)
- Mini app API → Analytics reports: registers reports (evidence: `restaurant-staff-bot/lib/api.js`)
- Mini app API → Learning content: registers learning (evidence: `restaurant-staff-bot/lib/api.js`)
- Mini app API → Employee identity: resolves employees (evidence: `restaurant-staff-bot/lib/api.js`)
- Mini app API → Payroll calculations: uses payroll (evidence: `restaurant-staff-bot/lib/api.js`)
- Mini app API → Shift planning: serves schedules (evidence: `restaurant-staff-bot/lib/api.js`)
- Mini app API → Staff directory: serves staff actions (evidence: `restaurant-staff-bot/lib/api.js`)
- Mini app API → Roles and access: checks permissions (evidence: `restaurant-staff-bot/lib/api.js`)
- Attendance → Business time: uses business time (evidence: `restaurant-staff-bot/lib/attendance.js`)
- Analytics → Payroll calculations: uses payroll (evidence: `restaurant-staff-bot/lib/analytics.js`)
- Analytics → Roles and access: uses role data (evidence: `restaurant-staff-bot/lib/analytics.js`)
- Analytics reports → Payroll calculations: uses payroll (evidence: `restaurant-staff-bot/lib/analytics-report.js`)
- Analytics reports → Business time: uses business time (evidence: `restaurant-staff-bot/lib/analytics-report.js`)
- Payroll calculations → Business time: uses business time (evidence: `restaurant-staff-bot/lib/salary.js`)
- Learning content → Business time: uses business time (evidence: `restaurant-staff-bot/lib/learning.js`)
- Schema and migrations → SQLite database: creates tables (evidence: `restaurant-staff-bot/lib/schema.js`)
- Attendance → SQLite database: reads and writes (evidence: `restaurant-staff-bot/lib/attendance.js`)
- Payroll calculations → SQLite database: reads attendance (evidence: `restaurant-staff-bot/lib/salary.js`)
- Staff directory → SQLite database: reads and writes (evidence: `restaurant-staff-bot/lib/staff.js`)
- Mini app API → Web app shell: serves API data
- Telegram platform → Bot setup: sends updates
- Web app shell → Analytics view: shows analytics
- Web app shell → Learning view: shows learning
- Web app shell → Applications view: shows applications
