How architjen/murmur_api works
Project Type and Purpose
• This is a full-stack backend API service centered on Automatic Speech Recognition (ASR). The purpose is to expose audio transcription functionality via a FastAPI web service, incorporating a faster-whisper model for audio processing.
• The README clearly outlines that the system focuses on transcribing audio files and providing performance metrics, with support for both local and containerized (Docker/Kubernetes) deployment. It also integrates a Postgres database for persistence.
Analyzing the File Structure
• The top-level structure includes:
• “app” directory that encapsulates the main application – API endpoints (app/api), database interaction (app/db), models (app/models), and schemas (app/schemas).
• “tests” folder for unit tests.
• Kubernetes manifests in the “manifests” directory.
• Deployment support files like Dockerfile, docker-compose.yml, CI workflows in .github, etc.
• This indicates a layered architecture separating the API layer, business/domain logic (models), data access layer (db), and schema definitions used for request/response validation.
Identifying Main Components
a. API Layer (FastAPI):
• Located in "app/api" with endpoints for transcription, metrics, and data retrieval.
• Interacts with the user (clients via HTTP) and drives the processing by calling underlying services.
b. Transcription Service:
• Incorporates the “faster-whisper” model (indicated in the README and possibly organized in “app/models/whisper_model.py”) to process and convert audio into text.
c. Database Component (Postgres):
• The “app/db” directory contains scripts (SQL table creation) and code for CRUD operations. The inclusion of “manifests” for db-deployment also confirms persistence is managed via a Postgres container.
d. Schemas & Models:
• Found in “app/schemas” and “app/models”, these define the structure of data both for internal purposes and API responses/requests.
e. External/Deployment Components:
• Docker: Dockerfile and docker-compose.yml illustrate containerization.
• Kubernetes Deployment: “manifests/” providing deployment/service configuration.
• CI/CD: GitHub workflows and tests indicate code quality and integration practices.
f. Dependency Management & Testing:
• Use of uv for dependency management and unit tests in “tests”.
Relationships and Interactions
• Client(s) send HTTP requests (e.g., to /transcribe or /metrics endpoints) to the FastAPI service.
• The FastAPI layer routes these requests to relevant modules (such as calling the transcription functionality in the whisper model or executing CRUD operations via the db component).
• The transcription logic processes the audio, potentially triggers database inserts/updates.
• Metrics are gathered and returned via dedicated endpoints.
• Containers (Docker) and orchestration (Kubernetes) wrap the application and database for production deployments.
Architectural Patterns and Design Principles
• Layered architecture: Clear separation (API routes, business models, database access) signifying separation of concerns.
• Containerization: Use of Docker and Kubernetes deployment manifests indicates microservice-like deployment and ease of scalability.
• API Documentation and Testing: FastAPI’s auto-generated docs and defined tests demonstrate an emphasis on maintainability and reliability.
• CI/CD: GitHub workflows and pre-commit checks through Ruff assure code quality through automation.
Relevant Technologies and Frameworks
• FastAPI for the API layer.
• Faster-Whisper for transcription.
• Postgres as the persistent database.
• Docker and docker-compose for containerized development.
• Kubernetes (via minikube and kompose) for deployment.
• uv for dependency and environment management.
• Ruff for code formatting and linting.
• Pytest for testing.