How ibubenok/safeworkhub works
SafeWorkHub is a corporate occupational-safety SaaS combining organization accounts and subscriptions with a knowledge base, LMS, checklist templates and inspection runs. Users enter through the React application or API; backend routes dispatch work to domain services, which use repositories and PostgreSQL. The frontend and backend responsibilities are shown separately, with major documented product areas retained. Edges follow sampled imports/calls or README statements; unsampled integrations are not asserted.
Main entry points: router.py API v1 router · __init__.py Data repositories · main.py FastAPI runtime · material_service.py Knowledge base
Components 24
Web application
- Web application
frontend/src/App.tsx - API client
frontend/src/api/client.ts
API and runtime
- FastAPI runtime
backend/app/main.py - API v1 router
backend/app/api/v1/router.py - Authentication API
backend/app/api/v1/endpoints/auth.py - Materials API
backend/app/api/v1/endpoints/materials.py - Checklist API
backend/app/api/v1/endpoints/checklists.py - Inspection API
backend/app/api/v1/endpoints/checklist_runs.py - Courses API
backend/app/api/v1/endpoints/courses.py - Users API
backend/app/api/v1/endpoints/users.py - Notifications API
backend/app/api/v1/endpoints/notifications.py
Product services
- Auth and subscriptions
backend/app/services/auth_service.py - Knowledge base
backend/app/services/material_service.py - File storage
backend/app/services/file_storage.py - Checklist templates
backend/app/services/checklist_service.py - Inspection runs
backend/app/services/checklist_run_service.py - Learning courses
backend/app/services/course_service.py - Notifications
backend/app/services/notification_service.py - Deadline reminders
backend/app/tasks/deadline_reminders.py
Persistence
- Data repositories
backend/app/db/repositories/__init__.py - Database sessions
backend/app/db/session.py - PostgreSQL
- Redis service
backend/app/services/redis_service.py
Other components
- User
Connections 25
- User → Web application: uses
README.md - Web application → API client: requests data
- API client → FastAPI runtime: calls API
- FastAPI runtime → API v1 router: mounts routes
backend/app/main.py - API v1 router → Authentication API: routes
backend/app/api/v1/router.py - API v1 router → Materials API: routes
backend/app/api/v1/router.py - API v1 router → Checklist API: routes
backend/app/api/v1/router.py - API v1 router → Inspection API: routes
backend/app/api/v1/router.py - API v1 router → Courses API: routes
backend/app/api/v1/router.py - API v1 router → Users API: routes
backend/app/api/v1/router.py - API v1 router → Notifications API: routes
backend/app/api/v1/router.py - Authentication API → Auth and subscriptions: delegates
backend/app/api/v1/endpoints/auth.py - Materials API → Knowledge base: delegates
backend/app/api/v1/endpoints/materials.py - Checklist API → Checklist templates: delegates
backend/app/api/v1/endpoints/checklists.py - Inspection API → Inspection runs: delegates
backend/app/api/v1/endpoints/checklist_runs.py - Courses API → Learning courses: delegates
backend/app/api/v1/endpoints/courses.py - Knowledge base → File storage: stores files
backend/app/services/material_service.py - Auth and subscriptions → Data repositories: uses repositories
backend/app/services/auth_service.py - Knowledge base → Data repositories: uses repositories
backend/app/services/material_service.py - Inspection runs → Data repositories: uses repositories
backend/app/services/checklist_run_service.py - FastAPI runtime → Deadline reminders: starts task
backend/app/main.py - Deadline reminders → Notifications: sends reminders
backend/app/tasks/deadline_reminders.py - Deadline reminders → Redis service: uses Redis
backend/app/tasks/deadline_reminders.py - Database sessions → PostgreSQL: opens sessions
backend/app/db/session.py - Data repositories → Database sessions: uses sessions