Initial scaffold: FastAPI micro-services API (forge + founder)

This commit is contained in:
2026-06-05 02:48:04 +02:00
parent 350143ceb4
commit b2973b63ee
5 changed files with 79 additions and 220 deletions
+21 -75
View File
@@ -1,88 +1,34 @@
# Micro-API
# MicroAPI
Lightweight FastAPI micro-service foundation. Docker-ready, zero-cost deployment.
## Stack
- **Python 3.12** — slim Docker image
- **FastAPI** — async web framework
- **Uvicorn** — ASGI server
- **SQLite** — local database (swap to Postgres via `DATABASE_URL`)
- **Docker + Docker Compose** — containerized deployment
## Quick Start
### Local dev
```bash
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt -r requirements-dev.txt
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
```
Open http://localhost:8000/api/health
### Docker
```bash
docker compose up --build
```
### Tests
```bash
pytest -v
```
API de micro-services — transcription audio, résumé automatique, conversion de formats.
## Endpoints
| Method | Path | Description |
|--------|----------------|-----------------|
| GET | `/` | Service info |
| GET | `/api/health` | Health check |
| Méthode | Route | Description |
|---|---|---|
| GET | `/` | Informations du service |
| GET | `/api/health` | Health check |
## Environment
### À venir
- `POST /api/transcribe` — Transcription audio (Whisper local)
- `POST /api/summarize` — Résumé de texte
- `POST /api/convert` — Conversion Markdown↔PDF, JSON↔CSV
Copy `.env.example` to `.env` and adjust:
| Variable | Default | Description |
|----------------|-------------------------|----------------------|
| `DATABASE_URL` | `sqlite:///data/app.db` | Database connection |
| `DEBUG` | `false` | Enable debug mode |
| `API_PORT` | `8000` | Host port binding |
## Deployment
See [ARCHITECTURE.md](ARCHITECTURE.md) for the full deployment plan.
## Lancer en local
```bash
# On the VPS
git clone <repo-url> /opt/micro-api
cd /opt/micro-api
docker compose up -d --build
pip install -r requirements.txt
uvicorn main:app --reload
```
## Project Structure
## Docker
```bash
docker compose up -d
```
micro-api/
├── app/
│ ├── __init__.py
│ ├── main.py # FastAPI app entry point
│ ├── routes.py # API routes
│ ├── models.py # Pydantic schemas
│ ├── database.py # SQLite utilities
│ └── config.py # App settings
├── tests/
│ ├── __init__.py
│ └── test_main.py # API tests
├── Dockerfile
├── docker-compose.yml
├── requirements.txt
├── requirements-dev.txt
├── .env.example
├── .gitignore
├── README.md
└── ARCHITECTURE.md
## Tests
```bash
pytest tests/ -v
```