# mularahul/fastship architecture

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

- Interactive diagram: https://gitdiagram.com/mularahul/fastship
- Repository: https://github.com/mularahul/fastship

## Overview

FastShip is a delivery-management application with a React frontend and FastAPI backend; the README identifies PostgreSQL, Redis, and Celery as runtime requirements. The main workflow is seller shipment creation, partner assignment, and shipment-event tracking; delivery partners can view and update assigned shipments, while sellers can manage shipments and review delivery. Authentication, verification, and notifications are supporting stages. The source excerpts show service and dependency wiring, but not the frontend’s API calls or the notification service implementation, so those links are left unverified or omitted.

Main entry points: [`backend/app/api/dependencies.py`](https://github.com/mularahul/fastship/blob/main/backend/app/api/dependencies.py) (Auth and service dependencies), [`backend/app/database/models.py`](https://github.com/mularahul/fastship/blob/main/backend/app/database/models.py) (Domain records), [`backend/app/services/shipment.py`](https://github.com/mularahul/fastship/blob/main/backend/app/services/shipment.py) (Shipment lifecycle), [`backend/app/api/router.py`](https://github.com/mularahul/fastship/blob/main/backend/app/api/router.py) (API router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_routes["App routes<br/>[routes.ts]"]
  node_dashboard["Shipment dashboard<br/>[dashboard.tsx]"]
  node_shipmentcard["Shipment card<br/>[shipment-card.tsx]"]
  node_shipmentview["Shipment details<br/>[shipment-view.tsx]"]
  node_submitform["Create shipment form"]
  node_updateform["Update shipment form"]
  node_auth["Auth context<br/>[AuthContext.tsx]"]
  node_root["App shell<br/>[root.tsx]"]
end

subgraph group_api["Backend API"]
  node_api_router["API router<br/>[router.py]"]
  node_shipment_api["Shipment endpoints<br/>[shipment.py]"]
  node_seller_api["Seller endpoints<br/>[seller.py]"]
  node_partner_api["Partner endpoints"]
  node_dependencies["Auth and service dependencies<br/>[dependencies.py]"]
  node_schemas["Shipment schemas<br/>[shipment.py]"]
end

subgraph group_domain["Delivery Services"]
  node_shipment_service["Shipment lifecycle<br/>[shipment.py]"]
  node_partner_service["Partner assignment"]
  node_seller_service["Seller accounts<br/>[seller.py]"]
  node_user_service["User identity<br/>[user.py]"]
  node_event_service["Shipment events<br/>[shipment_event.py]"]
end

subgraph group_state["State and Persistence"]
  node_models[("Domain records<br/>[models.py]")]
  node_postgres[("PostgreSQL")]
  node_redis[("Redis state<br/>[redis.py]")]
end

subgraph group_async["Async Notifications"]
  node_celery_tasks["Email and SMS tasks<br/>[tasks.py]"]
  node_email_sms["Mail and SMS providers"]
end

node_shipper(("Seller or partner"))

node_root -->|"provides context"| node_auth
node_shipmentcard -->|"renders"| node_shipmentview
node_updateform -.->|"updates shipment"| node_shipmentcard
node_shipper -.->|"uses"| node_routes
node_routes -.->|"API requests"| node_api_router
node_api_router -->|"registers"| node_shipment_api
node_api_router -->|"registers"| node_seller_api
node_api_router -->|"registers"| node_partner_api
node_shipment_api -->|"resolves dependencies"| node_dependencies
node_seller_api -->|"resolves dependencies"| node_dependencies
node_partner_api -->|"resolves dependencies"| node_dependencies
node_dependencies -->|"constructs"| node_shipment_service
node_dependencies -->|"constructs"| node_seller_service
node_dependencies -->|"constructs"| node_partner_service
node_shipment_api -->|"validates with"| node_schemas
node_shipment_service -->|"assigns partner"| node_partner_service
node_shipment_service -->|"records events"| node_event_service
node_shipment_service -->|"checks delivery code"| node_redis
node_partner_api -->|"blacklists token"| node_redis
node_dependencies -->|"checks blacklist"| node_redis
node_user_service -->|"queues verification mail"| node_celery_tasks
node_celery_tasks -->|"sends messages"| node_email_sms
node_shipment_service -->|"creates and updates"| node_models
node_event_service -->|"persists events"| node_models
node_user_service -->|"manages users"| node_models
node_seller_service -->|"manages sellers"| node_models
node_partner_service -->|"manages partners"| node_models
node_models -.->|"stored in"| node_postgres
node_redis -.-> node_postgres

click node_routes "https://github.com/mularahul/fastship/blob/main/frontend/app/routes.ts"
click node_dashboard "https://github.com/mularahul/fastship/blob/main/frontend/app/routes/dashboard.tsx"
click node_shipmentcard "https://github.com/mularahul/fastship/blob/main/frontend/app/components/shipment-card.tsx"
click node_shipmentview "https://github.com/mularahul/fastship/blob/main/frontend/app/components/shipment-view.tsx"
click node_submitform "https://github.com/mularahul/fastship/blob/main/frontend/app/components/submit-shipment-form.tsx"
click node_updateform "https://github.com/mularahul/fastship/blob/main/frontend/app/components/update-shipment-form.tsx"
click node_auth "https://github.com/mularahul/fastship/blob/main/frontend/app/contexts/AuthContext.tsx"
click node_root "https://github.com/mularahul/fastship/blob/main/frontend/app/root.tsx"
click node_api_router "https://github.com/mularahul/fastship/blob/main/backend/app/api/router.py"
click node_shipment_api "https://github.com/mularahul/fastship/blob/main/backend/app/api/routers/shipment.py"
click node_seller_api "https://github.com/mularahul/fastship/blob/main/backend/app/api/routers/seller.py"
click node_partner_api "https://github.com/mularahul/fastship/blob/main/backend/app/api/routers/delivery_partner.py"
click node_dependencies "https://github.com/mularahul/fastship/blob/main/backend/app/api/dependencies.py"
click node_shipment_service "https://github.com/mularahul/fastship/blob/main/backend/app/services/shipment.py"
click node_partner_service "https://github.com/mularahul/fastship/blob/main/backend/app/services/delivery_partner.py"
click node_seller_service "https://github.com/mularahul/fastship/blob/main/backend/app/services/seller.py"
click node_user_service "https://github.com/mularahul/fastship/blob/main/backend/app/services/user.py"
click node_event_service "https://github.com/mularahul/fastship/blob/main/backend/app/services/shipment_event.py"
click node_schemas "https://github.com/mularahul/fastship/blob/main/backend/app/api/schemas/shipment.py"
click node_models "https://github.com/mularahul/fastship/blob/main/backend/app/database/models.py"
click node_redis "https://github.com/mularahul/fastship/blob/main/backend/app/database/redis.py"
click node_celery_tasks "https://github.com/mularahul/fastship/blob/main/backend/app/worker/tasks.py"

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_routes,node_dashboard,node_shipmentcard,node_shipmentview,node_submitform,node_updateform,node_auth,node_root toneBlue
class node_api_router,node_shipment_api,node_seller_api,node_partner_api,node_dependencies,node_schemas toneAmber
class node_shipment_service,node_partner_service,node_seller_service,node_user_service,node_event_service toneMint
class node_models,node_postgres,node_redis toneRose
class node_celery_tasks,node_email_sms,node_shipper toneIndigo
```

## Components

### Frontend

- [App routes](https://github.com/mularahul/fastship/blob/main/frontend/app/routes.ts): `frontend/app/routes.ts`
- [Shipment dashboard](https://github.com/mularahul/fastship/blob/main/frontend/app/routes/dashboard.tsx): `frontend/app/routes/dashboard.tsx`
- [Shipment card](https://github.com/mularahul/fastship/blob/main/frontend/app/components/shipment-card.tsx): `frontend/app/components/shipment-card.tsx`
- [Shipment details](https://github.com/mularahul/fastship/blob/main/frontend/app/components/shipment-view.tsx): `frontend/app/components/shipment-view.tsx`
- [Create shipment form](https://github.com/mularahul/fastship/blob/main/frontend/app/components/submit-shipment-form.tsx): `frontend/app/components/submit-shipment-form.tsx`
- [Update shipment form](https://github.com/mularahul/fastship/blob/main/frontend/app/components/update-shipment-form.tsx): `frontend/app/components/update-shipment-form.tsx`
- [Auth context](https://github.com/mularahul/fastship/blob/main/frontend/app/contexts/AuthContext.tsx): `frontend/app/contexts/AuthContext.tsx`
- [App shell](https://github.com/mularahul/fastship/blob/main/frontend/app/root.tsx): `frontend/app/root.tsx`

### Backend API

- [API router](https://github.com/mularahul/fastship/blob/main/backend/app/api/router.py): `backend/app/api/router.py`
- [Shipment endpoints](https://github.com/mularahul/fastship/blob/main/backend/app/api/routers/shipment.py): `backend/app/api/routers/shipment.py`
- [Seller endpoints](https://github.com/mularahul/fastship/blob/main/backend/app/api/routers/seller.py): `backend/app/api/routers/seller.py`
- [Partner endpoints](https://github.com/mularahul/fastship/blob/main/backend/app/api/routers/delivery_partner.py): `backend/app/api/routers/delivery_partner.py`
- [Auth and service dependencies](https://github.com/mularahul/fastship/blob/main/backend/app/api/dependencies.py): `backend/app/api/dependencies.py`
- [Shipment schemas](https://github.com/mularahul/fastship/blob/main/backend/app/api/schemas/shipment.py): `backend/app/api/schemas/shipment.py`

### Delivery Services

- [Shipment lifecycle](https://github.com/mularahul/fastship/blob/main/backend/app/services/shipment.py): `backend/app/services/shipment.py`
- [Partner assignment](https://github.com/mularahul/fastship/blob/main/backend/app/services/delivery_partner.py): `backend/app/services/delivery_partner.py`
- [Seller accounts](https://github.com/mularahul/fastship/blob/main/backend/app/services/seller.py): `backend/app/services/seller.py`
- [User identity](https://github.com/mularahul/fastship/blob/main/backend/app/services/user.py): `backend/app/services/user.py`
- [Shipment events](https://github.com/mularahul/fastship/blob/main/backend/app/services/shipment_event.py): `backend/app/services/shipment_event.py`

### State and Persistence

- [Domain records](https://github.com/mularahul/fastship/blob/main/backend/app/database/models.py): `backend/app/database/models.py`
- **PostgreSQL**
- [Redis state](https://github.com/mularahul/fastship/blob/main/backend/app/database/redis.py): `backend/app/database/redis.py`

### Async Notifications

- [Email and SMS tasks](https://github.com/mularahul/fastship/blob/main/backend/app/worker/tasks.py): `backend/app/worker/tasks.py`
- **Mail and SMS providers**

### Other components

- **Seller or partner**

## Connections

- App shell → Auth context: provides context (evidence: `frontend/app/root.tsx`)
- Shipment card → Shipment details: renders (evidence: `frontend/app/components/shipment-card.tsx`)
- Update shipment form → Shipment card: updates shipment
- Seller or partner → App routes: uses
- App routes → API router: API requests
- API router → Shipment endpoints: registers (evidence: `backend/app/api/router.py`)
- API router → Seller endpoints: registers (evidence: `backend/app/api/router.py`)
- API router → Partner endpoints: registers (evidence: `backend/app/api/router.py`)
- Shipment endpoints → Auth and service dependencies: resolves dependencies (evidence: `backend/app/api/routers/shipment.py`)
- Seller endpoints → Auth and service dependencies: resolves dependencies (evidence: `backend/app/api/routers/seller.py`)
- Partner endpoints → Auth and service dependencies: resolves dependencies (evidence: `backend/app/api/routers/delivery_partner.py`)
- Auth and service dependencies → Shipment lifecycle: constructs (evidence: `backend/app/api/dependencies.py`)
- Auth and service dependencies → Seller accounts: constructs (evidence: `backend/app/api/dependencies.py`)
- Auth and service dependencies → Partner assignment: constructs (evidence: `backend/app/api/dependencies.py`)
- Shipment endpoints → Shipment schemas: validates with (evidence: `backend/app/api/routers/shipment.py`)
- Shipment lifecycle → Partner assignment: assigns partner (evidence: `backend/app/services/shipment.py`)
- Shipment lifecycle → Shipment events: records events (evidence: `backend/app/services/shipment.py`)
- Shipment lifecycle → Redis state: checks delivery code (evidence: `backend/app/services/shipment.py`)
- Partner endpoints → Redis state: blacklists token (evidence: `backend/app/api/routers/delivery_partner.py`)
- Auth and service dependencies → Redis state: checks blacklist (evidence: `backend/app/api/dependencies.py`)
- User identity → Email and SMS tasks: queues verification mail (evidence: `backend/app/services/user.py`)
- Email and SMS tasks → Mail and SMS providers: sends messages (evidence: `backend/app/worker/tasks.py`)
- Shipment lifecycle → Domain records: creates and updates (evidence: `backend/app/services/shipment.py`)
- Shipment events → Domain records: persists events (evidence: `backend/app/services/shipment_event.py`)
- User identity → Domain records: manages users (evidence: `backend/app/services/user.py`)
- Seller accounts → Domain records: manages sellers (evidence: `backend/app/services/seller.py`)
- Partner assignment → Domain records: manages partners (evidence: `backend/app/services/delivery_partner.py`)
- Domain records → PostgreSQL: stored in
- Redis state → PostgreSQL
