Metadata-Version: 2.4
Name: ecom-foundation-core
Version: 0.1.0
Summary: E-Com Foundation Platform: A modular foundation for building high-performance enterprise microservices, powering systems like the International Regulatory Management System (IRMS).
Project-URL: Homepage, https://github.com/E-com-services-Ltd/platform-core
Project-URL: Documentation, https://github.com/E-com-services-Ltd/platform-core
Project-URL: Repository, https://github.com/E-com-services-Ltd/platform-core
Project-URL: Changelog, https://github.com/E-com-services-Ltd/platform-core/blob/main/CHANGELOG.md
Author-email: e-com services limited <technical@e-comservicesgh.com>
License: Proprietary
License-File: LICENSE
Keywords: enterprise,fastapi,foundation,platform
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Requires-Python: >=3.11
Requires-Dist: alembic>=1.13.0
Requires-Dist: celery>=5.3.0
Requires-Dist: email-validator>=2.1.0
Requires-Dist: fastapi>=0.104.0
Requires-Dist: httpx>=0.25.0
Requires-Dist: passlib[bcrypt]>=1.7.4
Requires-Dist: phonenumbers>=8.13.0
Requires-Dist: prometheus-client>=0.19.0
Requires-Dist: pydantic-settings>=2.1.0
Requires-Dist: pydantic>=2.5.0
Requires-Dist: pyotp>=2.9.0
Requires-Dist: python-jose[cryptography]>=3.3.0
Requires-Dist: python-multipart>=0.0.6
Requires-Dist: redis>=5.0.0
Requires-Dist: sendgrid>=6.11.0
Requires-Dist: sqlalchemy>=2.0.0
Requires-Dist: stripe>=7.0.0
Requires-Dist: structlog>=23.2.0
Requires-Dist: uvicorn[standard]>=0.24.0
Provides-Extra: aws
Requires-Dist: boto3>=1.34.0; extra == 'aws'
Provides-Extra: dev
Requires-Dist: black>=23.11.0; extra == 'dev'
Requires-Dist: faker>=20.0.0; extra == 'dev'
Requires-Dist: mypy>=1.7.0; extra == 'dev'
Requires-Dist: pre-commit>=3.5.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
Requires-Dist: pytest>=7.4.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Provides-Extra: mysql
Requires-Dist: aiomysql>=0.2.0; extra == 'mysql'
Requires-Dist: mysqlclient>=2.2.0; extra == 'mysql'
Provides-Extra: postgres
Requires-Dist: asyncpg>=0.29.0; extra == 'postgres'
Requires-Dist: psycopg2-binary>=2.9.0; extra == 'postgres'
Provides-Extra: sentry
Requires-Dist: sentry-sdk>=1.35.0; extra == 'sentry'
Description-Content-Type: text/markdown

# E-Com Foundation Core

A production-ready foundation for high-performance enterprise microservices. Built with **FastAPI**, **Pydantic V2**, and **SQLAlchemy 2.0 (Async)**.

---

## 🚀 Overview

`ecom_foundation_core` provides a modular backbone for complex enterprise systems. It is an enterprise foundation platform with auth, billing, notifications, and workflows, modularizing Authentication, RBAC, Billing, and Auditing—allowing you to build new microservices in minutes instead of months. While originally designed for the Ordvel marketplace, it is currently the foundation for the **International Regulatory Management System (IRMS)**.

### Core Modules

- 🔑 **Auth**: JWT-based authentication, password hashing, and 2FA.
- 🛡️ **RBAC**: Multi-role support with fine-grained permission enforcement.
- 💳 **Billing**: Unified interface for Stripe and Paystack.
- 📜 **Audit**: Automatic logging of database changes (INSERT/UPDATE/DELETE).
- ⚙️ **Workflows**: Built-in Celery integration for asynchronous processing.

---

## 🛠️ Getting Started

### Installation

```bash
pip install ecom-foundation-core
```

### Quick Start Example

This is all you need to create a fully secure microservice using the foundation:

```python
from ecom_foundation_core.bootstrap import create_app, AppConfig
from ecom_foundation_core.modules.common.database import create_async_engine

# 1. Configuration
config = AppConfig(
    title="Order Service",
    enable_auth=True,
    enable_rbac=True
)

# 2. Initialize PostgreSQL
db_engine = create_async_engine("postgresql+asyncpg://user:pass@localhost/db")

# 3. Bootstrap
app = create_app(config=config, db_engine=db_engine)
```

---

## 📖 In-Depth Guides

We have provided step-by-step guides for every part of the system:

1.  **[Getting Started](./docs/getting-started.md)**: Standard installation and basic usage.
2.  **[Database & Migrations](./docs/database-and-migrations.md)**: Connecting to Postgres and managing migrations with Alembic.
3.  **[Customizing Models](./docs/customizing-models.md)**: How to add your own fields and models, and how to use the `AuditableMixin`.
4.  **[Example Application](./examples/fastapi_app.py)**: A standalone, runnable FastAPI application demonstrating all features.

---

## 🧬 Extending the System

The foundation is designed to be personalized. You can easily extend internal models by inheriting from `Base`:

```python
from ecom_foundation_core.modules.common.database import Base
from ecom_foundation_core.modules.audit.mixins import AuditableMixin

class Product(Base, AuditableMixin):
    __tablename__ = "products"
    name: Mapped[str] = mapped_column(String(255))
    price: Mapped[int] = mapped_column(Integer)
```

Adding this model to your application's `metadata` will automatically allow you to manage it via migrations and track it with the Audit system.

---

## 🧪 Testing

The foundation comes with a robust test suite in Docker for maximum reliability:

```bash
docker compose -f docker-compose.test.yml up --build
```

---

## 📄 License

e-com services limited. All rights reserved.
