ecom-foundation-core 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ecom_foundation_core-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- ecom_foundation_core-0.1.0/.github/workflows/ci.yml +47 -0
- ecom_foundation_core-0.1.0/.github/workflows/release.yml +42 -0
- ecom_foundation_core-0.1.0/.gitignore +159 -0
- ecom_foundation_core-0.1.0/.pre-commit-config.yaml +31 -0
- ecom_foundation_core-0.1.0/.python-version +1 -0
- ecom_foundation_core-0.1.0/CHANGELOG.md +26 -0
- ecom_foundation_core-0.1.0/Dockerfile.test +15 -0
- ecom_foundation_core-0.1.0/LICENSE +7 -0
- ecom_foundation_core-0.1.0/Makefile +39 -0
- ecom_foundation_core-0.1.0/PKG-INFO +154 -0
- ecom_foundation_core-0.1.0/README.md +94 -0
- ecom_foundation_core-0.1.0/docker-compose.test.yml +13 -0
- ecom_foundation_core-0.1.0/docs/customizing-models.md +75 -0
- ecom_foundation_core-0.1.0/docs/database-and-migrations.md +68 -0
- ecom_foundation_core-0.1.0/docs/getting-started.md +70 -0
- ecom_foundation_core-0.1.0/examples/core_test_app/Dockerfile +29 -0
- ecom_foundation_core-0.1.0/examples/core_test_app/docker-compose.yml +41 -0
- ecom_foundation_core-0.1.0/examples/core_test_app/main.py +299 -0
- ecom_foundation_core-0.1.0/examples/core_test_app/requirements.txt +4 -0
- ecom_foundation_core-0.1.0/examples/fastapi_app.py +89 -0
- ecom_foundation_core-0.1.0/pyproject.toml +108 -0
- ecom_foundation_core-0.1.0/run_test_app.py +31 -0
- ecom_foundation_core-0.1.0/scripts/test_auth_manual.py +93 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/__init__.py +17 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/bootstrap.py +358 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/config.py +10 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/audit/__init__.py +10 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/audit/listeners.py +97 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/audit/mixins.py +32 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/audit/models.py +38 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/audit/tasks.py +45 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/auth/__init__.py +341 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/auth/constants.py +58 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/auth/dependencies.py +140 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/auth/exceptions.py +118 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/auth/models.py +402 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/auth/repository.py +388 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/auth/schemas.py +329 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/auth/security.py +267 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/auth/service.py +1051 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/billing/__init__.py +19 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/billing/models.py +83 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/billing/providers.py +91 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/billing/service.py +69 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/common/__init__.py +90 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/common/audit_logging.py +70 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/common/cache.py +218 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/common/config.py +396 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/common/database.py +200 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/common/errors.py +301 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/common/middleware.py +643 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/common/monitoring.py +510 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/common/rate_limiting.py +548 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/common/redis_client.py +481 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/config.py +10 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/notifications/__init__.py +20 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/notifications/dependencies.py +34 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/notifications/service.py +157 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/rbac/__init__.py +17 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/rbac/dependencies.py +38 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/rbac/schemas.py +31 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/rbac/service.py +61 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/workflows/__init__.py +8 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/workflows/base.py +34 -0
- ecom_foundation_core-0.1.0/src/ecom_foundation_core/modules/workflows/celery_app.py +32 -0
- ecom_foundation_core-0.1.0/tests/test_audit.py +48 -0
- ecom_foundation_core-0.1.0/tests/test_auth.py +102 -0
- ecom_foundation_core-0.1.0/tests/test_billing.py +82 -0
- ecom_foundation_core-0.1.0/tests/test_rbac.py +72 -0
- ecom_foundation_core-0.1.0/tests/test_workflows.py +15 -0
|
File without changes
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- develop
|
|
8
|
+
pull_request:
|
|
9
|
+
branches:
|
|
10
|
+
- main
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ["3.11", "3.12"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
23
|
+
uses: actions/setup-python@v4
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python-version }}
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: |
|
|
29
|
+
python -m pip install --upgrade pip
|
|
30
|
+
pip install -e ".[dev,postgres]"
|
|
31
|
+
|
|
32
|
+
- name: Lint with ruff
|
|
33
|
+
run: |
|
|
34
|
+
ruff check src/ecom_foundation_core tests/
|
|
35
|
+
|
|
36
|
+
- name: Type check with mypy
|
|
37
|
+
run: |
|
|
38
|
+
mypy src/ecom_foundation_core
|
|
39
|
+
|
|
40
|
+
- name: Test with pytest
|
|
41
|
+
run: |
|
|
42
|
+
pytest tests/ -v --cov=ecom_foundation_core --cov-report=xml
|
|
43
|
+
|
|
44
|
+
- name: Upload coverage to Codecov
|
|
45
|
+
uses: codecov/codecov-action@v3
|
|
46
|
+
with:
|
|
47
|
+
file: ./coverage.xml
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write
|
|
13
|
+
contents: write
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
|
|
20
|
+
- name: Set up Python
|
|
21
|
+
uses: actions/setup-python@v4
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.11"
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install build twine
|
|
29
|
+
|
|
30
|
+
- name: Build package
|
|
31
|
+
run: python -m build
|
|
32
|
+
|
|
33
|
+
- name: Check package
|
|
34
|
+
run: twine check dist/*
|
|
35
|
+
|
|
36
|
+
- name: Publish to PyPI
|
|
37
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
38
|
+
|
|
39
|
+
- name: Create GitHub Release
|
|
40
|
+
uses: softprops/action-gh-release@v1
|
|
41
|
+
with:
|
|
42
|
+
generate_release_notes: true
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.pyc
|
|
4
|
+
*.pyo
|
|
5
|
+
*.pyd
|
|
6
|
+
|
|
7
|
+
# C extensions
|
|
8
|
+
*.so
|
|
9
|
+
|
|
10
|
+
# Distribution / packaging
|
|
11
|
+
bin/
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script that run at build time
|
|
32
|
+
# interactively, so they don't contain sensitive information.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
pytest_debug_log.txt
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or binary, you wish to ignore .python-version.
|
|
88
|
+
# For a specific project, you may want to include it.
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or even
|
|
95
|
+
# fail to install them.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# poetry
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
100
|
+
#poetry.lock
|
|
101
|
+
|
|
102
|
+
# pdm
|
|
103
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
104
|
+
#pdm.lock
|
|
105
|
+
|
|
106
|
+
# PEP 582; used by e.g. github.com/pdm-project/pdm
|
|
107
|
+
__pypackages__/
|
|
108
|
+
|
|
109
|
+
# Celery stuff
|
|
110
|
+
celerybeat-schedule
|
|
111
|
+
celerybeat.pid
|
|
112
|
+
|
|
113
|
+
# SageMath parsed files
|
|
114
|
+
*.sage.py
|
|
115
|
+
|
|
116
|
+
# Environments
|
|
117
|
+
.env
|
|
118
|
+
.venv
|
|
119
|
+
env/
|
|
120
|
+
venv/
|
|
121
|
+
ENV/
|
|
122
|
+
env.bak/
|
|
123
|
+
venv.bak/
|
|
124
|
+
|
|
125
|
+
# Spyder project settings
|
|
126
|
+
.spyderproject
|
|
127
|
+
.spyproject
|
|
128
|
+
|
|
129
|
+
# Rope project settings
|
|
130
|
+
.ropeproject
|
|
131
|
+
|
|
132
|
+
# mkdocs documentation
|
|
133
|
+
/site
|
|
134
|
+
|
|
135
|
+
# mypy
|
|
136
|
+
.mypy_cache/
|
|
137
|
+
.dmypy.json
|
|
138
|
+
dmypy.json
|
|
139
|
+
|
|
140
|
+
# Pyre type checker
|
|
141
|
+
.pyre/
|
|
142
|
+
|
|
143
|
+
# pytype static type analyzer
|
|
144
|
+
.pytype/
|
|
145
|
+
|
|
146
|
+
# Cython debug symbols
|
|
147
|
+
cython_debug/
|
|
148
|
+
|
|
149
|
+
# PyCharm
|
|
150
|
+
.idea/
|
|
151
|
+
|
|
152
|
+
# VS Code
|
|
153
|
+
.vscode/
|
|
154
|
+
|
|
155
|
+
# Project specific
|
|
156
|
+
*.whl
|
|
157
|
+
*.gz
|
|
158
|
+
logs/
|
|
159
|
+
temp/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v4.5.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: check-yaml
|
|
8
|
+
- id: check-added-large-files
|
|
9
|
+
- id: check-toml
|
|
10
|
+
|
|
11
|
+
# - repo: https://github.com/astral-sh/ruff-pre-commit
|
|
12
|
+
# rev: v0.1.6
|
|
13
|
+
# hooks:
|
|
14
|
+
# - id: ruff
|
|
15
|
+
# args: [--fix, --exit-non-zero-on-fix]
|
|
16
|
+
|
|
17
|
+
- repo: https://github.com/psf/black
|
|
18
|
+
rev: 23.11.0
|
|
19
|
+
hooks:
|
|
20
|
+
- id: black
|
|
21
|
+
|
|
22
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
23
|
+
rev: v1.7.0
|
|
24
|
+
hooks:
|
|
25
|
+
- id: mypy
|
|
26
|
+
|
|
27
|
+
- repo: https://github.com/pre-commit/mirrors-prettier
|
|
28
|
+
rev: v3.0.3
|
|
29
|
+
hooks:
|
|
30
|
+
- id: prettier
|
|
31
|
+
types_or: [markdown, yaml, json]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11.8
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.1.0] - 2024-01-15
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Initial release with auth, notifications, and billing modules
|
|
8
|
+
- FastAPI application factory
|
|
9
|
+
- SQLAlchemy models and migrations
|
|
10
|
+
- SendGrid and Twilio integrations
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- N/A
|
|
15
|
+
|
|
16
|
+
### Deprecated
|
|
17
|
+
|
|
18
|
+
- N/A
|
|
19
|
+
|
|
20
|
+
### Removed
|
|
21
|
+
|
|
22
|
+
- N/A
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- N/A
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
FROM python:3.11-slim
|
|
2
|
+
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
|
|
5
|
+
# Upgrade pip
|
|
6
|
+
RUN pip install --upgrade pip
|
|
7
|
+
|
|
8
|
+
# Copy the whole core foundation directory
|
|
9
|
+
COPY . /app
|
|
10
|
+
|
|
11
|
+
# Install it in editable mode with dev dependencies
|
|
12
|
+
RUN pip install -e ".[dev]"
|
|
13
|
+
|
|
14
|
+
# Command to run tests
|
|
15
|
+
CMD ["pytest", "tests/", "-v"]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright (c) 2024 e-com services limited. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Proprietary and Confidential.
|
|
4
|
+
|
|
5
|
+
This software and its associated documentation are the exclusive property of e-com services limited.
|
|
6
|
+
Unauthorized copying, distribution, or use of this software, via any medium, is strictly prohibited.
|
|
7
|
+
Any use of this software requires a valid, written license agreement from e-com services limited.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.PHONY: install dev test lint format clean build publish docs
|
|
2
|
+
|
|
3
|
+
install:
|
|
4
|
+
pip install -e ".[dev]"
|
|
5
|
+
|
|
6
|
+
dev: install
|
|
7
|
+
pre-commit install
|
|
8
|
+
|
|
9
|
+
test:
|
|
10
|
+
pytest tests/ -v --cov=ecom_foundation_core --cov-report=term-missing
|
|
11
|
+
|
|
12
|
+
lint:
|
|
13
|
+
ruff check src/ecom_foundation_core tests/
|
|
14
|
+
mypy src/ecom_foundation_core
|
|
15
|
+
|
|
16
|
+
format:
|
|
17
|
+
ruff format src/ecom_foundation_core tests/
|
|
18
|
+
|
|
19
|
+
clean:
|
|
20
|
+
rm -rf build/
|
|
21
|
+
rm -rf dist/
|
|
22
|
+
rm -rf *.egg-info
|
|
23
|
+
find . -type f -name "*.pyc" -delete
|
|
24
|
+
find . -type d -name __pycache__ -delete
|
|
25
|
+
|
|
26
|
+
build: clean
|
|
27
|
+
python -m build
|
|
28
|
+
|
|
29
|
+
publish-test:
|
|
30
|
+
twine upload --repository testpypi dist/*
|
|
31
|
+
|
|
32
|
+
publish:
|
|
33
|
+
twine upload dist/*
|
|
34
|
+
|
|
35
|
+
docs:
|
|
36
|
+
cd docs && make html
|
|
37
|
+
|
|
38
|
+
check-stability:
|
|
39
|
+
docker compose -f docker-compose.test.yml run --rm test_suite pytest tests/ -vv
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ecom-foundation-core
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: E-Com Foundation Platform: A modular foundation for building high-performance enterprise microservices, powering systems like the International Regulatory Management System (IRMS).
|
|
5
|
+
Project-URL: Homepage, https://github.com/E-com-services-Ltd/platform-core
|
|
6
|
+
Project-URL: Documentation, https://github.com/E-com-services-Ltd/platform-core
|
|
7
|
+
Project-URL: Repository, https://github.com/E-com-services-Ltd/platform-core
|
|
8
|
+
Project-URL: Changelog, https://github.com/E-com-services-Ltd/platform-core/blob/main/CHANGELOG.md
|
|
9
|
+
Author-email: e-com services limited <technical@e-comservicesgh.com>
|
|
10
|
+
License: Proprietary
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: enterprise,fastapi,foundation,platform
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: Other/Proprietary License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: alembic>=1.13.0
|
|
22
|
+
Requires-Dist: celery>=5.3.0
|
|
23
|
+
Requires-Dist: email-validator>=2.1.0
|
|
24
|
+
Requires-Dist: fastapi>=0.104.0
|
|
25
|
+
Requires-Dist: httpx>=0.25.0
|
|
26
|
+
Requires-Dist: passlib[bcrypt]>=1.7.4
|
|
27
|
+
Requires-Dist: phonenumbers>=8.13.0
|
|
28
|
+
Requires-Dist: prometheus-client>=0.19.0
|
|
29
|
+
Requires-Dist: pydantic-settings>=2.1.0
|
|
30
|
+
Requires-Dist: pydantic>=2.5.0
|
|
31
|
+
Requires-Dist: pyotp>=2.9.0
|
|
32
|
+
Requires-Dist: python-jose[cryptography]>=3.3.0
|
|
33
|
+
Requires-Dist: python-multipart>=0.0.6
|
|
34
|
+
Requires-Dist: redis>=5.0.0
|
|
35
|
+
Requires-Dist: sendgrid>=6.11.0
|
|
36
|
+
Requires-Dist: sqlalchemy>=2.0.0
|
|
37
|
+
Requires-Dist: stripe>=7.0.0
|
|
38
|
+
Requires-Dist: structlog>=23.2.0
|
|
39
|
+
Requires-Dist: uvicorn[standard]>=0.24.0
|
|
40
|
+
Provides-Extra: aws
|
|
41
|
+
Requires-Dist: boto3>=1.34.0; extra == 'aws'
|
|
42
|
+
Provides-Extra: dev
|
|
43
|
+
Requires-Dist: black>=23.11.0; extra == 'dev'
|
|
44
|
+
Requires-Dist: faker>=20.0.0; extra == 'dev'
|
|
45
|
+
Requires-Dist: mypy>=1.7.0; extra == 'dev'
|
|
46
|
+
Requires-Dist: pre-commit>=3.5.0; extra == 'dev'
|
|
47
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
48
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
|
|
49
|
+
Requires-Dist: pytest>=7.4.0; extra == 'dev'
|
|
50
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
51
|
+
Provides-Extra: mysql
|
|
52
|
+
Requires-Dist: aiomysql>=0.2.0; extra == 'mysql'
|
|
53
|
+
Requires-Dist: mysqlclient>=2.2.0; extra == 'mysql'
|
|
54
|
+
Provides-Extra: postgres
|
|
55
|
+
Requires-Dist: asyncpg>=0.29.0; extra == 'postgres'
|
|
56
|
+
Requires-Dist: psycopg2-binary>=2.9.0; extra == 'postgres'
|
|
57
|
+
Provides-Extra: sentry
|
|
58
|
+
Requires-Dist: sentry-sdk>=1.35.0; extra == 'sentry'
|
|
59
|
+
Description-Content-Type: text/markdown
|
|
60
|
+
|
|
61
|
+
# E-Com Foundation Core
|
|
62
|
+
|
|
63
|
+
A production-ready foundation for high-performance enterprise microservices. Built with **FastAPI**, **Pydantic V2**, and **SQLAlchemy 2.0 (Async)**.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 🚀 Overview
|
|
68
|
+
|
|
69
|
+
`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)**.
|
|
70
|
+
|
|
71
|
+
### Core Modules
|
|
72
|
+
|
|
73
|
+
- 🔑 **Auth**: JWT-based authentication, password hashing, and 2FA.
|
|
74
|
+
- 🛡️ **RBAC**: Multi-role support with fine-grained permission enforcement.
|
|
75
|
+
- 💳 **Billing**: Unified interface for Stripe and Paystack.
|
|
76
|
+
- 📜 **Audit**: Automatic logging of database changes (INSERT/UPDATE/DELETE).
|
|
77
|
+
- ⚙️ **Workflows**: Built-in Celery integration for asynchronous processing.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 🛠️ Getting Started
|
|
82
|
+
|
|
83
|
+
### Installation
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pip install ecom-foundation-core
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Quick Start Example
|
|
90
|
+
|
|
91
|
+
This is all you need to create a fully secure microservice using the foundation:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from ecom_foundation_core.bootstrap import create_app, AppConfig
|
|
95
|
+
from ecom_foundation_core.modules.common.database import create_async_engine
|
|
96
|
+
|
|
97
|
+
# 1. Configuration
|
|
98
|
+
config = AppConfig(
|
|
99
|
+
title="Order Service",
|
|
100
|
+
enable_auth=True,
|
|
101
|
+
enable_rbac=True
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
# 2. Initialize PostgreSQL
|
|
105
|
+
db_engine = create_async_engine("postgresql+asyncpg://user:pass@localhost/db")
|
|
106
|
+
|
|
107
|
+
# 3. Bootstrap
|
|
108
|
+
app = create_app(config=config, db_engine=db_engine)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 📖 In-Depth Guides
|
|
114
|
+
|
|
115
|
+
We have provided step-by-step guides for every part of the system:
|
|
116
|
+
|
|
117
|
+
1. **[Getting Started](./docs/getting-started.md)**: Standard installation and basic usage.
|
|
118
|
+
2. **[Database & Migrations](./docs/database-and-migrations.md)**: Connecting to Postgres and managing migrations with Alembic.
|
|
119
|
+
3. **[Customizing Models](./docs/customizing-models.md)**: How to add your own fields and models, and how to use the `AuditableMixin`.
|
|
120
|
+
4. **[Example Application](./examples/fastapi_app.py)**: A standalone, runnable FastAPI application demonstrating all features.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 🧬 Extending the System
|
|
125
|
+
|
|
126
|
+
The foundation is designed to be personalized. You can easily extend internal models by inheriting from `Base`:
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
from ecom_foundation_core.modules.common.database import Base
|
|
130
|
+
from ecom_foundation_core.modules.audit.mixins import AuditableMixin
|
|
131
|
+
|
|
132
|
+
class Product(Base, AuditableMixin):
|
|
133
|
+
__tablename__ = "products"
|
|
134
|
+
name: Mapped[str] = mapped_column(String(255))
|
|
135
|
+
price: Mapped[int] = mapped_column(Integer)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Adding this model to your application's `metadata` will automatically allow you to manage it via migrations and track it with the Audit system.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## 🧪 Testing
|
|
143
|
+
|
|
144
|
+
The foundation comes with a robust test suite in Docker for maximum reliability:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
docker compose -f docker-compose.test.yml up --build
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 📄 License
|
|
153
|
+
|
|
154
|
+
e-com services limited. All rights reserved.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# E-Com Foundation Core
|
|
2
|
+
|
|
3
|
+
A production-ready foundation for high-performance enterprise microservices. Built with **FastAPI**, **Pydantic V2**, and **SQLAlchemy 2.0 (Async)**.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🚀 Overview
|
|
8
|
+
|
|
9
|
+
`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)**.
|
|
10
|
+
|
|
11
|
+
### Core Modules
|
|
12
|
+
|
|
13
|
+
- 🔑 **Auth**: JWT-based authentication, password hashing, and 2FA.
|
|
14
|
+
- 🛡️ **RBAC**: Multi-role support with fine-grained permission enforcement.
|
|
15
|
+
- 💳 **Billing**: Unified interface for Stripe and Paystack.
|
|
16
|
+
- 📜 **Audit**: Automatic logging of database changes (INSERT/UPDATE/DELETE).
|
|
17
|
+
- ⚙️ **Workflows**: Built-in Celery integration for asynchronous processing.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 🛠️ Getting Started
|
|
22
|
+
|
|
23
|
+
### Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install ecom-foundation-core
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Quick Start Example
|
|
30
|
+
|
|
31
|
+
This is all you need to create a fully secure microservice using the foundation:
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from ecom_foundation_core.bootstrap import create_app, AppConfig
|
|
35
|
+
from ecom_foundation_core.modules.common.database import create_async_engine
|
|
36
|
+
|
|
37
|
+
# 1. Configuration
|
|
38
|
+
config = AppConfig(
|
|
39
|
+
title="Order Service",
|
|
40
|
+
enable_auth=True,
|
|
41
|
+
enable_rbac=True
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
# 2. Initialize PostgreSQL
|
|
45
|
+
db_engine = create_async_engine("postgresql+asyncpg://user:pass@localhost/db")
|
|
46
|
+
|
|
47
|
+
# 3. Bootstrap
|
|
48
|
+
app = create_app(config=config, db_engine=db_engine)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 📖 In-Depth Guides
|
|
54
|
+
|
|
55
|
+
We have provided step-by-step guides for every part of the system:
|
|
56
|
+
|
|
57
|
+
1. **[Getting Started](./docs/getting-started.md)**: Standard installation and basic usage.
|
|
58
|
+
2. **[Database & Migrations](./docs/database-and-migrations.md)**: Connecting to Postgres and managing migrations with Alembic.
|
|
59
|
+
3. **[Customizing Models](./docs/customizing-models.md)**: How to add your own fields and models, and how to use the `AuditableMixin`.
|
|
60
|
+
4. **[Example Application](./examples/fastapi_app.py)**: A standalone, runnable FastAPI application demonstrating all features.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 🧬 Extending the System
|
|
65
|
+
|
|
66
|
+
The foundation is designed to be personalized. You can easily extend internal models by inheriting from `Base`:
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from ecom_foundation_core.modules.common.database import Base
|
|
70
|
+
from ecom_foundation_core.modules.audit.mixins import AuditableMixin
|
|
71
|
+
|
|
72
|
+
class Product(Base, AuditableMixin):
|
|
73
|
+
__tablename__ = "products"
|
|
74
|
+
name: Mapped[str] = mapped_column(String(255))
|
|
75
|
+
price: Mapped[int] = mapped_column(Integer)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Adding this model to your application's `metadata` will automatically allow you to manage it via migrations and track it with the Audit system.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 🧪 Testing
|
|
83
|
+
|
|
84
|
+
The foundation comes with a robust test suite in Docker for maximum reliability:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
docker compose -f docker-compose.test.yml up --build
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 📄 License
|
|
93
|
+
|
|
94
|
+
e-com services limited. All rights reserved.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
services:
|
|
2
|
+
test_suite:
|
|
3
|
+
build:
|
|
4
|
+
context: .
|
|
5
|
+
dockerfile: Dockerfile.test
|
|
6
|
+
volumes:
|
|
7
|
+
- .:/app
|
|
8
|
+
environment:
|
|
9
|
+
PYTHONPATH: /app/src
|
|
10
|
+
DATABASE_URL: "sqlite+aiosqlite:///:memory:"
|
|
11
|
+
REDIS_URL: "redis://localhost:6379/0"
|
|
12
|
+
CELERY_BROKER_URL: "redis://localhost:6379/0"
|
|
13
|
+
CELERY_RESULT_BACKEND: "redis://localhost:6379/0"
|