Logo Lanfrica

lordkign2/opsPilot-be

Domaine:

socioeconomic

Type de record:

software
Créateur:
lor
Hôte:
OpsPilot is an AI-powered business operations platform for Nigerian and African SMEs. The backend is a FastAPI-based Modular Monolith that exposes a REST + WebSocket + SSE API, backed by PostgreSQL (async via SQLAlchemy 2.0 + asyncpg), Redis (caching, rate limiting, token blacklisting, Celery broker), and Celery workers for background processing. # OpsPilot Backend OpsPilot is an AI-powered business operations platform tailored for SMEs. This repository contains the FastAPI backend, built with strict enterprise engineering standards, clean architecture, and horizontal scalability in mind. ## Architecture We follow a strict **Layered Architecture** enforced across the codebase: - **Routers** (`routes.py`): HTTP concerns, request validation, response formatting. - **Services** (`service.py`): Core business logic, orchestration, and domain rules. - **Repositories** (`repository.py`): Database abstractions using SQLAlchemy. For detailed engineering standards, refer to RULES.md. ## Technology Stack - **Framework**: FastAPI - **Database**: PostgreSQL (via `asyncpg` and `SQLAlchemy`) - **Caching & Pub/Sub**: Redis - **Authentication**: OAuth2 with JWT - **Package Management**: Poetry - **Static Analysis**: Ruff, MyPy, Black, pre-commit ## Core Modules The monolith backend consists of the following decoupled domain modules: - **Auth & Businesses**: Multi-tenant workspace onboarding, RBAC, and secure JWT verification. - **Customers, Orders & Payments**: Customer management, transactional order lifecycle, and Paystack payment verification. - **AI Engine (`app/modules/ai`)**: Sessionless AI operations chat assistant, Markdown performance summaries, and predictive recommendations. Falls back dynamically to local context-aware mock generators if `OPENAI_API_KEY` is not present. - **Notifications (`app/modules/notifications`)**: Workspace-wide and targeted user notifications dynamically triggered via decoupled system-wide events. - **Analytics (`app/modules/analytics`)**: High-performance aggregate queries providing overview metrics, revenue history, and order breakdown. - **WebSocket Gateway (`app/websocket`)**: Bidirectional real-time communication fabric bridging local system events to active user sockets. Supports workspace presence tracking, current resource-view auditing, and streaming AI assistant replies, …