# nextdevelopernetwork/posta-fast architecture

> Architecture diagram of the GitHub repository nextdevelopernetwork/posta-fast, 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/nextdevelopernetwork/posta-fast
- Repository: https://github.com/nextdevelopernetwork/posta-fast

## Overview

Posta Fast is a parcel-delivery operations application spanning seller package creation, office intake and handling, courier transit and delivery, and finance settlement. Role-specific Next.js pages invoke server actions and queries; these access a shared PostgreSQL database. Admin tools cover office/user management and backup. Edges reflect sampled calls or SOURCE INDEX references; several listed capability pages were not sampled, so their internal links are omitted.

Main entry points: [`lib/queries.ts`](https://github.com/nextdevelopernetwork/posta-fast/blob/main/lib/queries.ts) (Parcel queries), [`app/actions/courier-system.ts`](https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/actions/courier-system.ts) (Package actions), [`lib/auth-guards.ts`](https://github.com/nextdevelopernetwork/posta-fast/blob/main/lib/auth-guards.ts) (Role access guard), [`db/index.ts`](https://github.com/nextdevelopernetwork/posta-fast/blob/main/db/index.ts) (PostgreSQL database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Access and identity"]
  node_login["Login and registration<br/>[page.tsx]"]
  node_auth_actions["Authentication actions<br/>[auth.ts]"]
  node_auth_service["Session and providers<br/>[auth.ts]"]
  node_access_guard["Role access guard<br/>[auth-guards.ts]"]
end

subgraph group_parcel["Parcel operations"]
  node_seller["Seller portal<br/>[page.tsx]"]
  node_package_action["Package actions<br/>[courier-system.ts]"]
  node_office_intake["Office intake<br/>[page.tsx]"]
  node_office_handling["Office handling<br/>[page.tsx]"]
  node_courier_bags["Courier bags<br/>[page.tsx]"]
  node_courier_delivery["Courier delivery<br/>[page.tsx]"]
  node_parcel_data["Parcel queries<br/>[queries.ts]"]
end

subgraph group_finance["Finance"]
  node_finance_dashboard["Finance dashboard<br/>[page.tsx]"]
  node_finance_ledger["Finance ledger<br/>[page.tsx]"]
  node_office_payouts["Office payouts<br/>[page.tsx]"]
  node_payout_modal["Payout processing"]
end

subgraph group_admin["Administration and data"]
  node_admin_offices["Office administration<br/>[page.tsx]"]
  node_admin_dashboard["Admin dashboard<br/>[page.tsx]"]
  node_backup_page["Backup management<br/>[page.tsx]"]
  node_backup_action["Backup actions<br/>[backup.ts]"]
  node_backup_export["Backup export route<br/>[route.ts]"]
  node_database[("PostgreSQL database<br/>[index.ts]")]
end

node_user(("User"))

node_user -->|"signs in"| node_login
node_login -->|"submits credentials"| node_auth_actions
node_auth_actions -->|"calls sign-in"| node_auth_service
node_auth_service -->|"reads users"| node_database
node_seller -->|"creates packages"| node_package_action
node_office_intake -->|"accepts intake"| node_package_action
node_office_handling -->|"updates handling"| node_package_action
node_courier_bags -->|"manages bags"| node_package_action
node_courier_delivery -->|"records delivery"| node_package_action
node_seller -->|"loads packages"| node_parcel_data
node_office_handling -->|"loads operations"| node_parcel_data
node_courier_bags -->|"loads bag data"| node_parcel_data
node_package_action -->|"updates parcel records"| node_database
node_parcel_data -->|"queries records"| node_database
node_finance_dashboard -->|"checks access"| node_access_guard
node_finance_ledger -->|"checks access"| node_access_guard
node_office_payouts -->|"checks access"| node_access_guard
node_access_guard -->|"reads session"| node_auth_service
node_access_guard -->|"loads office name"| node_database
node_finance_dashboard -->|"loads finance data"| node_parcel_data
node_finance_ledger -->|"loads ledger data"| node_parcel_data
node_office_payouts -->|"loads payout data"| node_parcel_data
node_office_payouts -->|"opens payout flow"| node_payout_modal
node_payout_modal -->|"submits payout"| node_package_action
node_admin_offices -->|"manages offices"| node_package_action
node_admin_offices -->|"loads office data"| node_parcel_data
node_admin_dashboard -->|"checks access"| node_access_guard
node_admin_dashboard -->|"loads overview"| node_parcel_data
node_backup_page -->|"requests backup"| node_backup_action
node_backup_action -->|"reads records"| node_database
node_backup_export -->|"exports records"| node_database

click node_seller "https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/seller/new/page.tsx"
click node_package_action "https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/actions/courier-system.ts"
click node_office_intake "https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/office/intake/page.tsx"
click node_office_handling "https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/office/unloading/page.tsx"
click node_courier_bags "https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/courier/bags/page.tsx"
click node_courier_delivery "https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/courier/deliveries/page.tsx"
click node_parcel_data "https://github.com/nextdevelopernetwork/posta-fast/blob/main/lib/queries.ts"
click node_login "https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/(auth)/login/page.tsx"
click node_auth_actions "https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/actions/auth.ts"
click node_auth_service "https://github.com/nextdevelopernetwork/posta-fast/blob/main/auth.ts"
click node_access_guard "https://github.com/nextdevelopernetwork/posta-fast/blob/main/lib/auth-guards.ts"
click node_finance_dashboard "https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/finance/page.tsx"
click node_finance_ledger "https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/finance/ledger/page.tsx"
click node_office_payouts "https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/finance/office-payouts/page.tsx"
click node_payout_modal "https://github.com/nextdevelopernetwork/posta-fast/blob/main/components/finance/office-payout-modal.tsx"
click node_admin_offices "https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/admin/offices/page.tsx"
click node_admin_dashboard "https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/admin/page.tsx"
click node_backup_page "https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/admin/backup/page.tsx"
click node_backup_action "https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/actions/backup.ts"
click node_backup_export "https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/api/admin/backup/export/route.ts"
click node_database "https://github.com/nextdevelopernetwork/posta-fast/blob/main/db/index.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_login,node_auth_actions,node_auth_service,node_access_guard,node_user toneBlue
class node_seller,node_package_action,node_office_intake,node_office_handling,node_courier_bags,node_courier_delivery,node_parcel_data toneAmber
class node_finance_dashboard,node_finance_ledger,node_office_payouts,node_payout_modal toneMint
class node_admin_offices,node_admin_dashboard,node_backup_page,node_backup_action,node_backup_export,node_database toneRose
```

## Components

### Access and identity

- [Login and registration](https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/(auth)/login/page.tsx): `app/(auth)/login/page.tsx`
- [Authentication actions](https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/actions/auth.ts): `app/actions/auth.ts`
- [Session and providers](https://github.com/nextdevelopernetwork/posta-fast/blob/main/auth.ts): `auth.ts`
- [Role access guard](https://github.com/nextdevelopernetwork/posta-fast/blob/main/lib/auth-guards.ts): `lib/auth-guards.ts`

### Parcel operations

- [Seller portal](https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/seller/new/page.tsx): `app/seller/new/page.tsx`
- [Package actions](https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/actions/courier-system.ts): `app/actions/courier-system.ts`
- [Office intake](https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/office/intake/page.tsx): `app/office/intake/page.tsx`
- [Office handling](https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/office/unloading/page.tsx): `app/office/unloading/page.tsx`
- [Courier bags](https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/courier/bags/page.tsx): `app/courier/bags/page.tsx`
- [Courier delivery](https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/courier/deliveries/page.tsx): `app/courier/deliveries/page.tsx`
- [Parcel queries](https://github.com/nextdevelopernetwork/posta-fast/blob/main/lib/queries.ts): `lib/queries.ts`

### Finance

- [Finance dashboard](https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/finance/page.tsx): `app/finance/page.tsx`
- [Finance ledger](https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/finance/ledger/page.tsx): `app/finance/ledger/page.tsx`
- [Office payouts](https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/finance/office-payouts/page.tsx): `app/finance/office-payouts/page.tsx`
- [Payout processing](https://github.com/nextdevelopernetwork/posta-fast/blob/main/components/finance/office-payout-modal.tsx): `components/finance/office-payout-modal.tsx`

### Administration and data

- [Office administration](https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/admin/offices/page.tsx): `app/admin/offices/page.tsx`
- [Admin dashboard](https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/admin/page.tsx): `app/admin/page.tsx`
- [Backup management](https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/admin/backup/page.tsx): `app/admin/backup/page.tsx`
- [Backup actions](https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/actions/backup.ts): `app/actions/backup.ts`
- [Backup export route](https://github.com/nextdevelopernetwork/posta-fast/blob/main/app/api/admin/backup/export/route.ts): `app/api/admin/backup/export/route.ts`
- [PostgreSQL database](https://github.com/nextdevelopernetwork/posta-fast/blob/main/db/index.ts): `db/index.ts`

### Other components

- **User**

## Connections

- User → Login and registration: signs in (evidence: `app/(auth)/login/page.tsx`)
- Login and registration → Authentication actions: submits credentials (evidence: `app/(auth)/login/page.tsx`)
- Authentication actions → Session and providers: calls sign-in (evidence: `app/actions/auth.ts`)
- Session and providers → PostgreSQL database: reads users (evidence: `auth.ts`)
- Seller portal → Package actions: creates packages (evidence: `app/seller/new/page.tsx`)
- Office intake → Package actions: accepts intake (evidence: `app/office/intake/page.tsx`)
- Office handling → Package actions: updates handling (evidence: `app/office/unloading/page.tsx`)
- Courier bags → Package actions: manages bags (evidence: `app/courier/bags/page.tsx`)
- Courier delivery → Package actions: records delivery (evidence: `app/courier/deliveries/page.tsx`)
- Seller portal → Parcel queries: loads packages (evidence: `app/seller/new/page.tsx`)
- Office handling → Parcel queries: loads operations (evidence: `app/office/unloading/page.tsx`)
- Courier bags → Parcel queries: loads bag data (evidence: `app/courier/bags/page.tsx`)
- Package actions → PostgreSQL database: updates parcel records (evidence: `app/actions/courier-system.ts`)
- Parcel queries → PostgreSQL database: queries records (evidence: `lib/queries.ts`)
- Finance dashboard → Role access guard: checks access (evidence: `app/finance/page.tsx`)
- Finance ledger → Role access guard: checks access (evidence: `app/finance/ledger/page.tsx`)
- Office payouts → Role access guard: checks access (evidence: `app/finance/office-payouts/page.tsx`)
- Role access guard → Session and providers: reads session (evidence: `lib/auth-guards.ts`)
- Role access guard → PostgreSQL database: loads office name (evidence: `lib/auth-guards.ts`)
- Finance dashboard → Parcel queries: loads finance data (evidence: `app/finance/page.tsx`)
- Finance ledger → Parcel queries: loads ledger data (evidence: `app/finance/ledger/page.tsx`)
- Office payouts → Parcel queries: loads payout data (evidence: `app/finance/office-payouts/page.tsx`)
- Office payouts → Payout processing: opens payout flow (evidence: `app/finance/office-payouts/page.tsx`)
- Payout processing → Package actions: submits payout (evidence: `components/finance/office-payout-modal.tsx`)
- Office administration → Package actions: manages offices (evidence: `app/admin/offices/page.tsx`)
- Office administration → Parcel queries: loads office data (evidence: `app/admin/offices/page.tsx`)
- Admin dashboard → Role access guard: checks access (evidence: `app/admin/page.tsx`)
- Admin dashboard → Parcel queries: loads overview (evidence: `app/admin/page.tsx`)
- Backup management → Backup actions: requests backup (evidence: `app/admin/backup/page.tsx`)
- Backup actions → PostgreSQL database: reads records (evidence: `app/actions/backup.ts`)
- Backup export route → PostgreSQL database: exports records (evidence: `app/api/admin/backup/export/route.ts`)
