# p1app/freelance architecture

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

## Overview

Freelance Lite is a two-sided freelance marketplace: clients and freelancers discover projects, exchange proposals, form contracts, track milestones, communicate, and review completed work. The frontend provides marketplace and account screens; the FastAPI backend exposes domain routes and separates service logic from persistence. The tree documents these capabilities, but most domain handlers and frontend views were not sampled, so their internal call paths are not asserted. Shown edges are limited to router registration and sampled auth/review/notification relationships.

Main entry points: [`backend/src/main.py`](https://github.com/p1app/freelance/blob/main/backend/src/main.py) (FastAPI application), [`backend/src/service/auth_service.py`](https://github.com/p1app/freelance/blob/main/backend/src/service/auth_service.py) (Authentication service), [`backend/src/service/review_service.py`](https://github.com/p1app/freelance/blob/main/backend/src/service/review_service.py) (Review service), [`backend/src/repository`](https://github.com/p1app/freelance/tree/main/backend/src/repository) (Domain repositories)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Marketplace UI"]
  node_frontend["Vue application<br/>[App.vue]"]
  node_frontend_views["Marketplace screens"]
  node_frontend_api["HTTP client modules"]
end

subgraph group_api["API and Identity"]
  node_backend_app["FastAPI application<br/>[main.py]"]
  node_auth_routes["Authentication routes<br/>[auth_router.py]"]
  node_auth_service["Authentication service<br/>[auth_service.py]"]
  node_security["Token and access control<br/>[security.py]"]
end

subgraph group_work["Project Workflow"]
  node_project_work["Projects and proposals"]
  node_contract_work["Contracts and milestones"]
  node_review_routes["Review routes<br/>[review_router.py]"]
  node_review_service["Review service<br/>[review_service.py]"]
end

subgraph group_collab["Collaboration"]
  node_collab_work["Chat and notifications"]
  node_ws_routes["WebSocket routes<br/>[ws_router.py]"]
  node_notification_push["Notification manager"]
end

subgraph group_platform["Persistence and Runtime"]
  node_repositories["Domain repositories"]
  node_data_models["Domain models<br/>[user_model.py]"]
  node_database[("Relational database<br/>[database.py]")]
  node_redis[("Redis token revocation")]
  node_email["Email delivery"]
end

node_person(("Marketplace user"))

node_person -.->|"uses"| node_frontend
node_frontend -.->|"renders"| node_frontend_views
node_frontend_views -.->|"requests data"| node_frontend_api
node_frontend_api -.->|"HTTP requests"| node_backend_app
node_backend_app -->|"registers"| node_auth_routes
node_backend_app -->|"registers"| node_review_routes
node_backend_app -->|"registers"| node_ws_routes
node_auth_routes -->|"delegates"| node_auth_service
node_auth_service -->|"queries users"| node_repositories
node_auth_service -->|"creates tokens"| node_security
node_auth_service -->|"queues email"| node_email
node_security -->|"checks revocation"| node_redis
node_review_routes -->|"delegates"| node_review_service
node_review_service -->|"reads and writes"| node_repositories
node_review_service -->|"creates notification"| node_collab_work
node_ws_routes -->|"uses manager"| node_notification_push
node_collab_work -->|"pushes updates"| node_notification_push
node_repositories -.->|"queries"| node_data_models
node_data_models -->|"maps tables"| node_database

click node_frontend "https://github.com/p1app/freelance/blob/main/frontend/src/App.vue"
click node_frontend_views "https://github.com/p1app/freelance/tree/main/frontend/src/views"
click node_frontend_api "https://github.com/p1app/freelance/tree/main/frontend/src/api"
click node_backend_app "https://github.com/p1app/freelance/blob/main/backend/src/main.py"
click node_auth_routes "https://github.com/p1app/freelance/blob/main/backend/src/routers/auth_router.py"
click node_auth_service "https://github.com/p1app/freelance/blob/main/backend/src/service/auth_service.py"
click node_security "https://github.com/p1app/freelance/blob/main/backend/src/core/security.py"
click node_project_work "https://github.com/p1app/freelance/tree/main/backend/src/service"
click node_contract_work "https://github.com/p1app/freelance/tree/main/backend/src/service"
click node_review_routes "https://github.com/p1app/freelance/blob/main/backend/src/routers/review_router.py"
click node_review_service "https://github.com/p1app/freelance/blob/main/backend/src/service/review_service.py"
click node_collab_work "https://github.com/p1app/freelance/tree/main/backend/src/service"
click node_ws_routes "https://github.com/p1app/freelance/blob/main/backend/src/routers/ws_router.py"
click node_notification_push "https://github.com/p1app/freelance/blob/main/backend/src/websocket/notifications_manager.py"
click node_repositories "https://github.com/p1app/freelance/tree/main/backend/src/repository"
click node_data_models "https://github.com/p1app/freelance/blob/main/backend/src/models/user_model.py"
click node_database "https://github.com/p1app/freelance/blob/main/backend/src/core/database.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_frontend,node_frontend_views,node_frontend_api,node_person toneBlue
class node_backend_app,node_auth_routes,node_auth_service,node_security toneAmber
class node_project_work,node_contract_work,node_review_routes,node_review_service toneMint
class node_collab_work,node_ws_routes,node_notification_push toneRose
class node_repositories,node_data_models,node_database,node_redis,node_email toneIndigo
```

## Components

### Marketplace UI

- [Vue application](https://github.com/p1app/freelance/blob/main/frontend/src/App.vue): `frontend/src/App.vue`
- [Marketplace screens](https://github.com/p1app/freelance/tree/main/frontend/src/views): `frontend/src/views`
- [HTTP client modules](https://github.com/p1app/freelance/tree/main/frontend/src/api): `frontend/src/api`

### API and Identity

- [FastAPI application](https://github.com/p1app/freelance/blob/main/backend/src/main.py): `backend/src/main.py`
- [Authentication routes](https://github.com/p1app/freelance/blob/main/backend/src/routers/auth_router.py): `backend/src/routers/auth_router.py`
- [Authentication service](https://github.com/p1app/freelance/blob/main/backend/src/service/auth_service.py): `backend/src/service/auth_service.py`
- [Token and access control](https://github.com/p1app/freelance/blob/main/backend/src/core/security.py): `backend/src/core/security.py`

### Project Workflow

- [Projects and proposals](https://github.com/p1app/freelance/tree/main/backend/src/service): `backend/src/service`
- [Contracts and milestones](https://github.com/p1app/freelance/tree/main/backend/src/service): `backend/src/service`
- [Review routes](https://github.com/p1app/freelance/blob/main/backend/src/routers/review_router.py): `backend/src/routers/review_router.py`
- [Review service](https://github.com/p1app/freelance/blob/main/backend/src/service/review_service.py): `backend/src/service/review_service.py`

### Collaboration

- [Chat and notifications](https://github.com/p1app/freelance/tree/main/backend/src/service): `backend/src/service`
- [WebSocket routes](https://github.com/p1app/freelance/blob/main/backend/src/routers/ws_router.py): `backend/src/routers/ws_router.py`
- [Notification manager](https://github.com/p1app/freelance/blob/main/backend/src/websocket/notifications_manager.py): `backend/src/websocket/notifications_manager.py`

### Persistence and Runtime

- [Domain repositories](https://github.com/p1app/freelance/tree/main/backend/src/repository): `backend/src/repository`
- [Domain models](https://github.com/p1app/freelance/blob/main/backend/src/models/user_model.py): `backend/src/models/user_model.py`
- [Relational database](https://github.com/p1app/freelance/blob/main/backend/src/core/database.py): `backend/src/core/database.py`
- **Redis token revocation**
- **Email delivery**

### Other components

- **Marketplace user**

## Connections

- Marketplace user → Vue application: uses
- Vue application → Marketplace screens: renders
- Marketplace screens → HTTP client modules: requests data
- HTTP client modules → FastAPI application: HTTP requests
- FastAPI application → Authentication routes: registers (evidence: `backend/src/main.py`)
- FastAPI application → Review routes: registers (evidence: `backend/src/main.py`)
- FastAPI application → WebSocket routes: registers (evidence: `backend/src/main.py`)
- Authentication routes → Authentication service: delegates (evidence: `backend/src/routers/auth_router.py`)
- Authentication service → Domain repositories: queries users (evidence: `backend/src/service/auth_service.py`)
- Authentication service → Token and access control: creates tokens (evidence: `backend/src/service/auth_service.py`)
- Authentication service → Email delivery: queues email (evidence: `backend/src/service/auth_service.py`)
- Token and access control → Redis token revocation: checks revocation (evidence: `backend/src/core/security.py`)
- Review routes → Review service: delegates (evidence: `backend/src/routers/review_router.py`)
- Review service → Domain repositories: reads and writes (evidence: `backend/src/service/review_service.py`)
- Review service → Chat and notifications: creates notification (evidence: `backend/src/service/review_service.py`)
- WebSocket routes → Notification manager: uses manager (evidence: `backend/src/routers/ws_router.py`)
- Chat and notifications → Notification manager: pushes updates (evidence: `backend/src/service/notification_service.py`)
- Domain repositories → Domain models: queries
- Domain models → Relational database: maps tables (evidence: `backend/src/models/user_model.py`)
