Case Study

Risk Compliance Tracker API

A production-oriented API for governance workflows that combines domain-specific models, role-aware access control, and full write-audit coverage.

FastAPISQLAlchemy 2.0PostgreSQLPydantic v2JWT
GitHub repository ↗

Role

Backend engineer

Timeline

2025

Organization

Independent project

Status

Production-ready backend

Overview

Risk and compliance products are usually built under pressure from audits, incidents, or customer due diligence requirements. That creates two recurring failures in backend design: domain models collapse into generic ticket tables, and authorization becomes scattered policy checks that are hard to reason about. This API was designed to avoid both outcomes by starting with explicit governance entities and a strict layered architecture.

The repository implements a FastAPI service for risks, controls, evidence, tasks, users, authentication, health checks, and audit event retrieval. It is not just CRUD around a single table. It captures the relationships that governance teams actually use: risks own controls and tasks, controls own evidence, and all write actions are traceable through audit records.

Technical Design

Routing is split under app/api with dedicated modules such as /risks, /controls, /evidence, /tasks, /auth, /users, and /audit. The API layer delegates business rules to app/services, and services delegate persistence concerns to app/repositories, which keeps transaction logic and query behavior isolated from endpoint concerns.

Data modeling uses SQLAlchemy 2.0 with UUID primary keys, enum-backed status and severity fields, timestamp columns, and foreign-key relationships across domain entities. Pydantic v2 schemas define separate create, update, and read contracts for each resource, keeping request validation and response shape explicit.

Authentication uses JWT access and refresh tokens, including refresh-token lifecycle handling. Authorization includes role checks, with admin-only operations for sensitive routes such as user creation and audit event listing. The architecture also includes request IDs, structured logging, Docker support, Alembic migrations, and environment-driven runtime configuration.

Key Features

The result is a backend foundation that is concrete enough for production use while still cleanly extensible for additional governance modules.