boostapi 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.
- boostapi-0.1.0/.coverage +0 -0
- boostapi-0.1.0/.env.example +24 -0
- boostapi-0.1.0/.github/workflows/ci.yml +100 -0
- boostapi-0.1.0/.github/workflows/release.yml +92 -0
- boostapi-0.1.0/.pre-commit-config.yaml +35 -0
- boostapi-0.1.0/Dockerfile +41 -0
- boostapi-0.1.0/PKG-INFO +242 -0
- boostapi-0.1.0/README.md +188 -0
- boostapi-0.1.0/_test_import.py +11 -0
- boostapi-0.1.0/alembic.ini +46 -0
- boostapi-0.1.0/coverage.xml +496 -0
- boostapi-0.1.0/docker-compose.yml +51 -0
- boostapi-0.1.0/logs/boostapi.log +13 -0
- boostapi-0.1.0/logs/forgekit.log +123 -0
- boostapi-0.1.0/pyproject.toml +140 -0
- boostapi-0.1.0/src/boostapi/__init__.py +34 -0
- boostapi-0.1.0/src/boostapi/_version.py +2 -0
- boostapi-0.1.0/src/boostapi/app/__init__.py +1 -0
- boostapi-0.1.0/src/boostapi/app/api/__init__.py +1 -0
- boostapi-0.1.0/src/boostapi/app/api/deps.py +91 -0
- boostapi-0.1.0/src/boostapi/app/api/endpoints/__init__.py +1 -0
- boostapi-0.1.0/src/boostapi/app/api/endpoints/auth.py +108 -0
- boostapi-0.1.0/src/boostapi/app/api/endpoints/health.py +65 -0
- boostapi-0.1.0/src/boostapi/app/api/schemas/__init__.py +1 -0
- boostapi-0.1.0/src/boostapi/app/api/schemas/auth.py +40 -0
- boostapi-0.1.0/src/boostapi/app/core/__init__.py +1 -0
- boostapi-0.1.0/src/boostapi/app/core/config.py +97 -0
- boostapi-0.1.0/src/boostapi/app/core/security.py +77 -0
- boostapi-0.1.0/src/boostapi/app/db/__init__.py +1 -0
- boostapi-0.1.0/src/boostapi/app/db/database.py +68 -0
- boostapi-0.1.0/src/boostapi/app/db/models.py +43 -0
- boostapi-0.1.0/src/boostapi/app/main.py +124 -0
- boostapi-0.1.0/src/boostapi/app/services/__init__.py +1 -0
- boostapi-0.1.0/src/boostapi/app/services/auth.py +52 -0
- boostapi-0.1.0/src/boostapi/app/utils/__init__.py +1 -0
- boostapi-0.1.0/src/boostapi/app/utils/logger.py +38 -0
- boostapi-0.1.0/src/boostapi/cli.py +228 -0
- boostapi-0.1.0/src/boostapi/migrations/__init__.py +1 -0
- boostapi-0.1.0/src/boostapi/migrations/env.py +57 -0
- boostapi-0.1.0/tests/__init__.py +1 -0
- boostapi-0.1.0/tests/conftest.py +128 -0
- boostapi-0.1.0/tests/test_api/__init__.py +1 -0
- boostapi-0.1.0/tests/test_api/test_auth.py +95 -0
- boostapi-0.1.0/tests/test_services/__init__.py +1 -0
boostapi-0.1.0/.coverage
ADDED
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# ─── Database ──────────────────────────────────────────────
|
|
2
|
+
POSTGRES_SERVER=localhost
|
|
3
|
+
POSTGRES_PORT=5432
|
|
4
|
+
POSTGRES_USER=postgres
|
|
5
|
+
POSTGRES_PASSWORD=password
|
|
6
|
+
POSTGRES_DB=boostapi
|
|
7
|
+
DATABASE_URL=postgresql+asyncpg://postgres:password@localhost:5432/boostapi
|
|
8
|
+
|
|
9
|
+
# ─── Redis ─────────────────────────────────────────────────
|
|
10
|
+
REDIS_URL=redis://localhost:6379
|
|
11
|
+
REDIS_CACHE_TTL=300
|
|
12
|
+
|
|
13
|
+
# ─── Auth ──────────────────────────────────────────────────
|
|
14
|
+
# IMPORTANT: Change this to a strong random key in production!
|
|
15
|
+
# Generate with: python -c "import secrets; print(secrets.token_hex(32))"
|
|
16
|
+
SECRET_KEY=your-super-secret-key-change-in-production
|
|
17
|
+
ACCESS_TOKEN_EXPIRE_MINUTES=30
|
|
18
|
+
ALGORITHM=HS256
|
|
19
|
+
|
|
20
|
+
# ─── Application ───────────────────────────────────────────
|
|
21
|
+
PROJECT_NAME=BoostAPI
|
|
22
|
+
ENV=development
|
|
23
|
+
LOG_LEVEL=DEBUG
|
|
24
|
+
CORS_ORIGINS=["http://localhost:3000","http://localhost:8000"]
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
PYTHON_VERSION: "3.11"
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
lint:
|
|
14
|
+
name: Lint & Type Check
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
23
|
+
cache: pip
|
|
24
|
+
|
|
25
|
+
- name: Install dev dependencies
|
|
26
|
+
run: pip install -e ".[dev]"
|
|
27
|
+
|
|
28
|
+
- name: Run Ruff (linter)
|
|
29
|
+
run: ruff check src/ tests/
|
|
30
|
+
|
|
31
|
+
- name: Run Black (formatter check)
|
|
32
|
+
run: black --check src/ tests/
|
|
33
|
+
|
|
34
|
+
- name: Run MyPy (type checker)
|
|
35
|
+
run: mypy src/boostapi
|
|
36
|
+
|
|
37
|
+
test:
|
|
38
|
+
name: Tests (Python ${{ matrix.python-version }})
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
strategy:
|
|
41
|
+
matrix:
|
|
42
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
43
|
+
|
|
44
|
+
services:
|
|
45
|
+
postgres:
|
|
46
|
+
image: pgvector/pgvector:pg16
|
|
47
|
+
env:
|
|
48
|
+
POSTGRES_DB: boostapi_test
|
|
49
|
+
POSTGRES_USER: postgres
|
|
50
|
+
POSTGRES_PASSWORD: password
|
|
51
|
+
ports:
|
|
52
|
+
- 5432:5432
|
|
53
|
+
options: >-
|
|
54
|
+
--health-cmd pg_isready
|
|
55
|
+
--health-interval 10s
|
|
56
|
+
--health-timeout 5s
|
|
57
|
+
--health-retries 5
|
|
58
|
+
|
|
59
|
+
redis:
|
|
60
|
+
image: redis:7-alpine
|
|
61
|
+
ports:
|
|
62
|
+
- 6379:6379
|
|
63
|
+
options: >-
|
|
64
|
+
--health-cmd "redis-cli ping"
|
|
65
|
+
--health-interval 10s
|
|
66
|
+
--health-timeout 5s
|
|
67
|
+
--health-retries 5
|
|
68
|
+
|
|
69
|
+
steps:
|
|
70
|
+
- uses: actions/checkout@v4
|
|
71
|
+
|
|
72
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
73
|
+
uses: actions/setup-python@v5
|
|
74
|
+
with:
|
|
75
|
+
python-version: ${{ matrix.python-version }}
|
|
76
|
+
cache: pip
|
|
77
|
+
|
|
78
|
+
- name: Install dependencies
|
|
79
|
+
run: pip install -e ".[dev]"
|
|
80
|
+
|
|
81
|
+
- name: Run tests with coverage
|
|
82
|
+
env:
|
|
83
|
+
DATABASE_URL: postgresql+asyncpg://postgres:password@localhost:5432/boostapi_test
|
|
84
|
+
REDIS_URL: redis://localhost:6379
|
|
85
|
+
SECRET_KEY: ci-test-secret-key
|
|
86
|
+
ENV: test
|
|
87
|
+
run: |
|
|
88
|
+
pytest tests/ \
|
|
89
|
+
--cov=src/boostapi \
|
|
90
|
+
--cov-report=xml \
|
|
91
|
+
--cov-report=term-missing \
|
|
92
|
+
--cov-fail-under=80 \
|
|
93
|
+
-v
|
|
94
|
+
|
|
95
|
+
- name: Upload coverage to Codecov
|
|
96
|
+
uses: codecov/codecov-action@v4
|
|
97
|
+
with:
|
|
98
|
+
file: ./coverage.xml
|
|
99
|
+
flags: py${{ matrix.python-version }}
|
|
100
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
name: Release to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*.*.*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
id-token: write # Trusted publishing
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
name: Build distribution
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0 # Full history for changelog
|
|
20
|
+
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.11"
|
|
25
|
+
cache: pip
|
|
26
|
+
|
|
27
|
+
- name: Install build tools
|
|
28
|
+
run: pip install build twine
|
|
29
|
+
|
|
30
|
+
- name: Build package
|
|
31
|
+
run: python -m build
|
|
32
|
+
|
|
33
|
+
- name: Check build artifacts
|
|
34
|
+
run: twine check dist/*
|
|
35
|
+
|
|
36
|
+
- name: Upload artifacts
|
|
37
|
+
uses: actions/upload-artifact@v4
|
|
38
|
+
with:
|
|
39
|
+
name: dist
|
|
40
|
+
path: dist/
|
|
41
|
+
|
|
42
|
+
publish-testpypi:
|
|
43
|
+
name: Publish to TestPyPI
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
needs: build
|
|
46
|
+
environment: testpypi
|
|
47
|
+
steps:
|
|
48
|
+
- name: Download artifacts
|
|
49
|
+
uses: actions/download-artifact@v4
|
|
50
|
+
with:
|
|
51
|
+
name: dist
|
|
52
|
+
path: dist/
|
|
53
|
+
|
|
54
|
+
- name: Publish to TestPyPI
|
|
55
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
56
|
+
with:
|
|
57
|
+
repository-url: https://test.pypi.org/legacy/
|
|
58
|
+
|
|
59
|
+
publish-pypi:
|
|
60
|
+
name: Publish to PyPI
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
needs: [build, publish-testpypi]
|
|
63
|
+
environment: pypi
|
|
64
|
+
steps:
|
|
65
|
+
- name: Download artifacts
|
|
66
|
+
uses: actions/download-artifact@v4
|
|
67
|
+
with:
|
|
68
|
+
name: dist
|
|
69
|
+
path: dist/
|
|
70
|
+
|
|
71
|
+
- name: Publish to PyPI
|
|
72
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
73
|
+
|
|
74
|
+
github-release:
|
|
75
|
+
name: Create GitHub Release
|
|
76
|
+
runs-on: ubuntu-latest
|
|
77
|
+
needs: publish-pypi
|
|
78
|
+
steps:
|
|
79
|
+
- uses: actions/checkout@v4
|
|
80
|
+
|
|
81
|
+
- name: Download artifacts
|
|
82
|
+
uses: actions/download-artifact@v4
|
|
83
|
+
with:
|
|
84
|
+
name: dist
|
|
85
|
+
path: dist/
|
|
86
|
+
|
|
87
|
+
- name: Create GitHub Release
|
|
88
|
+
uses: softprops/action-gh-release@v2
|
|
89
|
+
with:
|
|
90
|
+
files: dist/*
|
|
91
|
+
generate_release_notes: true
|
|
92
|
+
fail_on_unmatched_files: true
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v4.6.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: check-yaml
|
|
8
|
+
- id: check-toml
|
|
9
|
+
- id: check-added-large-files
|
|
10
|
+
args: ["--maxkb=1000"]
|
|
11
|
+
- id: check-merge-conflict
|
|
12
|
+
- id: debug-statements
|
|
13
|
+
|
|
14
|
+
- repo: https://github.com/psf/black
|
|
15
|
+
rev: 24.8.0
|
|
16
|
+
hooks:
|
|
17
|
+
- id: black
|
|
18
|
+
language_version: python3
|
|
19
|
+
|
|
20
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
21
|
+
rev: v0.6.9
|
|
22
|
+
hooks:
|
|
23
|
+
- id: ruff
|
|
24
|
+
args: [--fix]
|
|
25
|
+
|
|
26
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
27
|
+
rev: v1.11.2
|
|
28
|
+
hooks:
|
|
29
|
+
- id: mypy
|
|
30
|
+
additional_dependencies: [
|
|
31
|
+
"pydantic>=2.8",
|
|
32
|
+
"pydantic-settings>=2.8",
|
|
33
|
+
"types-passlib",
|
|
34
|
+
]
|
|
35
|
+
args: ["--ignore-missing-imports"]
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# ── Build stage ───────────────────────────────────────────────────────────────
|
|
2
|
+
FROM python:3.11-slim AS builder
|
|
3
|
+
|
|
4
|
+
WORKDIR /app
|
|
5
|
+
|
|
6
|
+
# Install build tools
|
|
7
|
+
RUN pip install --no-cache-dir build hatchling
|
|
8
|
+
|
|
9
|
+
COPY pyproject.toml README.md ./
|
|
10
|
+
COPY src/ src/
|
|
11
|
+
|
|
12
|
+
RUN python -m build --wheel --outdir /dist
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# ── Runtime stage ─────────────────────────────────────────────────────────────
|
|
16
|
+
FROM python:3.11-slim
|
|
17
|
+
|
|
18
|
+
WORKDIR /app
|
|
19
|
+
|
|
20
|
+
# Create non-root user
|
|
21
|
+
RUN addgroup --system boostapi && adduser --system --group boostapi
|
|
22
|
+
|
|
23
|
+
# Install runtime dependencies only
|
|
24
|
+
COPY --from=builder /dist/*.whl /tmp/
|
|
25
|
+
RUN pip install --no-cache-dir /tmp/*.whl && rm /tmp/*.whl
|
|
26
|
+
|
|
27
|
+
# Copy alembic config
|
|
28
|
+
COPY alembic.ini ./
|
|
29
|
+
COPY src/boostapi/migrations/ src/boostapi/migrations/
|
|
30
|
+
|
|
31
|
+
# Create logs directory
|
|
32
|
+
RUN mkdir -p logs && chown -R boostapi:boostapi logs
|
|
33
|
+
|
|
34
|
+
USER boostapi
|
|
35
|
+
|
|
36
|
+
EXPOSE 8000
|
|
37
|
+
|
|
38
|
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
39
|
+
CMD python -c "import httpx; httpx.get('http://localhost:8000/api/v1/health/ping')" || exit 1
|
|
40
|
+
|
|
41
|
+
CMD ["uvicorn", "boostapi.app.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]
|
boostapi-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: boostapi
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Production FastAPI starter toolkit with Redis, SQLAlchemy, JWT Auth, and CLI scaffolding
|
|
5
|
+
Project-URL: Homepage, https://github.com/dhinakaran/boostapi
|
|
6
|
+
Project-URL: Documentation, https://boostapi.readthedocs.io
|
|
7
|
+
Project-URL: Repository, https://github.com/dhinakaran/boostapi
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/dhinakaran/boostapi/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/dhinakaran/boostapi/blob/main/CHANGELOG.md
|
|
10
|
+
Author-email: Dhinakaran <dhinakaranthangaraj198@gmail.com>
|
|
11
|
+
License: MIT
|
|
12
|
+
Keywords: async,embeddings,fastapi,nlp,pgvector,postgresql,redis,semantic-search,sqlalchemy,vector-search
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Framework :: FastAPI
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Requires-Dist: alembic>=1.13.0
|
|
26
|
+
Requires-Dist: asyncpg>=0.29.0
|
|
27
|
+
Requires-Dist: click>=8.1.0
|
|
28
|
+
Requires-Dist: fastapi>=0.115.0
|
|
29
|
+
Requires-Dist: loguru>=0.7.0
|
|
30
|
+
Requires-Dist: passlib[bcrypt]>=1.7.4
|
|
31
|
+
Requires-Dist: pydantic-settings>=2.8.0
|
|
32
|
+
Requires-Dist: python-jose[cryptography]>=3.3.0
|
|
33
|
+
Requires-Dist: python-multipart>=0.0.9
|
|
34
|
+
Requires-Dist: redis[hiredis]>=5.0.0
|
|
35
|
+
Requires-Dist: sqlalchemy[asyncio]>=2.0.0
|
|
36
|
+
Requires-Dist: uvicorn[standard]>=0.30.0
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: aiosqlite>=0.20.0; extra == 'dev'
|
|
39
|
+
Requires-Dist: black>=24.0; extra == 'dev'
|
|
40
|
+
Requires-Dist: httpx>=0.27; extra == 'dev'
|
|
41
|
+
Requires-Dist: mypy>=1.11; extra == 'dev'
|
|
42
|
+
Requires-Dist: pre-commit>=3.7.0; extra == 'dev'
|
|
43
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
|
|
44
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
45
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
46
|
+
Requires-Dist: ruff>=0.6.0; extra == 'dev'
|
|
47
|
+
Requires-Dist: types-passlib>=1.7.7; extra == 'dev'
|
|
48
|
+
Provides-Extra: docker
|
|
49
|
+
Requires-Dist: docker>=7.0.0; extra == 'docker'
|
|
50
|
+
Provides-Extra: ml
|
|
51
|
+
Requires-Dist: numpy>=1.26.0; extra == 'ml'
|
|
52
|
+
Requires-Dist: sentence-transformers>=3.0.0; extra == 'ml'
|
|
53
|
+
Description-Content-Type: text/markdown
|
|
54
|
+
|
|
55
|
+
# 🛠️ BoostAPI
|
|
56
|
+
|
|
57
|
+
<p align="center">
|
|
58
|
+
<strong>Production-ready FastAPI starter toolkit with Redis caching, JWT Auth & CLI scaffolding</strong>
|
|
59
|
+
</p>
|
|
60
|
+
|
|
61
|
+
<p align="center">
|
|
62
|
+
<a href="https://pypi.org/project/boostapi/"><img src="https://img.shields.io/pypi/v/boostapi?color=blue&logo=pypi&logoColor=white" alt="PyPI version"></a>
|
|
63
|
+
<a href="https://pypi.org/project/boostapi/"><img src="https://img.shields.io/pypi/pyversions/boostapi?logo=python&logoColor=white" alt="Python versions"></a>
|
|
64
|
+
<a href="https://github.com/dhinakaran/boostapi/actions"><img src="https://img.shields.io/github/actions/workflow/status/dhinakaran/boostapi/ci.yml?label=CI&logo=github" alt="CI"></a>
|
|
65
|
+
<a href="https://codecov.io/gh/dhinakaran/boostapi"><img src="https://img.shields.io/codecov/c/github/dhinakaran/boostapi?logo=codecov" alt="Coverage"></a>
|
|
66
|
+
<a href="https://github.com/dhinakaran/boostapi/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="MIT License"></a>
|
|
67
|
+
<a href="https://github.com/dhinakaran/boostapi"><img src="https://img.shields.io/github/stars/dhinakaran/boostapi?style=flat&logo=github" alt="GitHub Stars"></a>
|
|
68
|
+
</p>
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## ✨ Features
|
|
73
|
+
|
|
74
|
+
| Feature | Details |
|
|
75
|
+
|---|---|
|
|
76
|
+
| ⚡ **Redis Caching** | Built-in caching templates for instant responses |
|
|
77
|
+
| 🔐 **JWT Auth** | Secure authentication with refresh tokens built-in |
|
|
78
|
+
| 🗃️ **Async SQLAlchemy** | asyncpg driver, connection pooling, Alembic migrations |
|
|
79
|
+
| 🛠️ **CLI Scaffolding** | `boostapi quickstart myapp` → full project in seconds |
|
|
80
|
+
| 📦 **Zero-Config** | Works out of the box with sane defaults |
|
|
81
|
+
| 🚀 **Production-Grade** | Loguru logging, CORS, rate limiting, OpenAPI docs |
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## ⚡ 2-Minute Quickstart
|
|
86
|
+
|
|
87
|
+
### Option A: Scaffold a New Project
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Install BoostAPI
|
|
91
|
+
pip install boostapi
|
|
92
|
+
|
|
93
|
+
# Scaffold a complete web application
|
|
94
|
+
boostapi quickstart my-app
|
|
95
|
+
cd my-app
|
|
96
|
+
|
|
97
|
+
# Start dependencies (PostgreSQL + Redis)
|
|
98
|
+
docker compose up -d
|
|
99
|
+
|
|
100
|
+
# Run migrations & start server
|
|
101
|
+
alembic upgrade head
|
|
102
|
+
uvicorn app.main:app --reload
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Open http://localhost:8000/docs — your API is live! 🎉
|
|
106
|
+
|
|
107
|
+
### Option B: Embed in Your App
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
# myapp.py
|
|
111
|
+
from boostapi import create_app
|
|
112
|
+
|
|
113
|
+
app = create_app()
|
|
114
|
+
# uvicorn myapp:app --reload
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Option C: Custom Settings
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
from boostapi import create_app
|
|
121
|
+
from boostapi.app.core.config import Settings
|
|
122
|
+
|
|
123
|
+
app = create_app(settings=Settings(
|
|
124
|
+
POSTGRES_DB="mydb",
|
|
125
|
+
REDIS_URL="redis://myredis:6379",
|
|
126
|
+
SECRET_KEY="super-secret-change-me",
|
|
127
|
+
))
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 🔌 API Reference
|
|
133
|
+
|
|
134
|
+
### Authentication
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Login
|
|
138
|
+
curl -X POST http://localhost:8000/api/v1/auth/login \
|
|
139
|
+
-H "Content-Type: application/json" \
|
|
140
|
+
-d '{"username": "admin", "password": "secret"}'
|
|
141
|
+
|
|
142
|
+
# Returns:
|
|
143
|
+
# {"access_token": "eyJ...", "token_type": "bearer"}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Health Check
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
curl http://localhost:8000/api/v1/health/
|
|
150
|
+
# {"status": "healthy", "version": "0.1.0", "db": "ok", "redis": "ok"}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## 🐳 Docker Compose
|
|
156
|
+
|
|
157
|
+
BoostAPI ships with a production-ready `docker-compose.yml`:
|
|
158
|
+
|
|
159
|
+
```yaml
|
|
160
|
+
# Included automatically via `boostapi quickstart`
|
|
161
|
+
services:
|
|
162
|
+
db: # postgres:16-alpine
|
|
163
|
+
redis: # redis:7-alpine
|
|
164
|
+
app: # your FastAPI app
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## ⚙️ Configuration
|
|
170
|
+
|
|
171
|
+
All settings are configurable via environment variables or `.env` file:
|
|
172
|
+
|
|
173
|
+
| Variable | Default | Description |
|
|
174
|
+
|---|---|---|
|
|
175
|
+
| `POSTGRES_SERVER` | `localhost` | PostgreSQL host |
|
|
176
|
+
| `POSTGRES_PORT` | `5432` | PostgreSQL port |
|
|
177
|
+
| `POSTGRES_USER` | `postgres` | DB username |
|
|
178
|
+
| `POSTGRES_PASSWORD` | `password` | DB password |
|
|
179
|
+
| `POSTGRES_DB` | `boostapi` | Database name |
|
|
180
|
+
| `REDIS_URL` | `redis://localhost:6379` | Redis connection URL |
|
|
181
|
+
| `SECRET_KEY` | *(change me)* | JWT signing key |
|
|
182
|
+
| `ACCESS_TOKEN_EXPIRE_MINUTES` | `30` | Token TTL (minutes) |
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## 🧪 Testing
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
pip install boostapi[dev]
|
|
190
|
+
pytest --cov=boostapi
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 🚀 Deployment
|
|
196
|
+
|
|
197
|
+
### Render / Fly.io
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Set environment variables in your hosting dashboard
|
|
201
|
+
# then:
|
|
202
|
+
uvicorn boostapi.app.main:app --host 0.0.0.0 --port $PORT
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Docker
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
docker build -t my-app .
|
|
209
|
+
docker compose up
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Publish to PyPI
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
pip install build twine
|
|
216
|
+
python -m build
|
|
217
|
+
twine upload dist/*
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## 🏗️ Project Structure
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
my-app/ # generated by `boostapi quickstart`
|
|
226
|
+
├── app/
|
|
227
|
+
│ ├── main.py # create_app() entry point
|
|
228
|
+
│ ├── api/endpoints/ # auth, health, etc.
|
|
229
|
+
│ ├── core/ # config, security
|
|
230
|
+
│ ├── db/ # models, migrations
|
|
231
|
+
│ └── services/ # business logic
|
|
232
|
+
├── tests/ # pytest suite (90%+ coverage)
|
|
233
|
+
├── docker-compose.yml
|
|
234
|
+
├── alembic.ini
|
|
235
|
+
└── .env
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## 📄 License
|
|
241
|
+
|
|
242
|
+
MIT © [Dhinakaran](https://github.com/dheena731)
|