No description
  • Python 99.6%
  • Dockerfile 0.4%
Find a file
Ricardo Umans aa73fdca4b Basis opzet
2026-05-02 21:34:32 +02:00
app Basis opzet 2026-05-02 21:34:32 +02:00
tests Basis opzet 2026-05-02 21:34:32 +02:00
.dockerignore Initialize Git repository 2026-05-02 15:49:06 +02:00
.env.example Basis opzet 2026-05-02 21:34:32 +02:00
.gitignore Basis opzet 2026-05-02 21:34:32 +02:00
.woodpecker.yml Basis opzet 2026-05-02 21:34:32 +02:00
AGENTS.md Initialize Git repository 2026-05-02 15:49:06 +02:00
database.sql Basis opzet 2026-05-02 21:34:32 +02:00
docker-compose.production.yml Basis opzet 2026-05-02 21:34:32 +02:00
docker-compose.test.yml Basis opzet 2026-05-02 21:34:32 +02:00
Dockerfile Initialize Git repository 2026-05-02 15:49:06 +02:00
openapi.yml Basis opzet 2026-05-02 21:34:32 +02:00
README.md Basis opzet 2026-05-02 21:34:32 +02:00
requirements.txt Basis opzet 2026-05-02 21:34:32 +02:00

RDTS API

Secure Python REST API scaffold built with FastAPI using layered architecture:

  • controllers: API route handlers
  • services: business logic
  • repository: database access

The project includes:

  • environment profiles for local, test, production
  • OpenAPI YAML documentation for every implemented endpoint
  • integration tests for every implemented endpoint
  • Docker setup for deployable test/production stacks

Tech Stack

  • FastAPI
  • SQLAlchemy
  • PostgreSQL (containerized for compose test/production)
  • PyTest + FastAPI TestClient

Project Structure

  • app/main.py
  • app/controllers/
  • app/services/
  • app/repository/
  • app/db/
  • app/core/
  • app/schemas/
  • tests/integration/
  • openapi.yml

Environment Files

  • .env.local
  • .env.test
  • .env.production
  • .env.example

Important:

  • Update API_KEY in every environment before deployment.
  • Update production DATABASE_URL and ALLOWED_HOSTS/ALLOWED_ORIGINS with real values.

Run Locally

  1. Create and activate a virtual environment.
  2. Install dependencies:
pip install -r requirements.txt
  1. Start API with local env:
uvicorn app.main:app --host 0.0.0.0 --port 8000
  1. Try endpoints:
curl http://localhost:8000/
curl -H "X-API-Key: local-dev-api-key-please-change-123456" http://localhost:8000/api/v1/health

Run Tests

Use the required command:

python -m pytest

Docker Deployment

Test stack

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

Production stack

docker compose -f docker-compose.production.yml up --build -d

API Security Baseline

  • API key authentication on protected endpoint(s)
  • Trusted host validation
  • CORS allow-list
  • Security response headers
  • Request size limit middleware
  • Parameterized SQL query for DB health check

OpenAPI YAML

See openapi.yml for the endpoint contract.