How naveen3011/fastapi-docker-ecr works
Main Components
• API Endpoints: Within the FastAPI service, there are distinct endpoints such as /ping, /notes, and others. Inside the FastAPI block (or as sub-components), annotate the ‘api’ folder and its modules (ping, notes, CRUD, models) to show the internal routing and business logic separation.
• Database Layer: There is a db.py file under src/app which, while not fully detailed as an external database, abstracts data interactions. Include a “Database Module” node that represents data storage/interactions (even if it’s simply an in-memory or lightweight abstraction).
• Testing: Represent the “Test Suite” component (using Pytest) which is located in the src/tests directory. This ensures the API endpoints and business logic are validated.
Out the Relationships and Interactions
• Inside the FastAPI container, illustrate internal interactions:
• API routers directing requests to the appropriate modules (ping, notes, etc.).
• Business logic invoking CRUD methods and database abstractions.
• For local development and testing, illustrate a connection between Docker Compose and the FastAPI container (e.g., by annotating that running “docker-compose up –d --build” will spin up the container exposing port 8002).
Architectural Patterns and Design Principles
• Modularity: Break down the API’s endpoints and business logic into dedicated modules (API routes, CRUD operations, and models). This reflects a clean separation of concerns.
• Containerization: Emphasize the use of Docker for packaging and deployment, which supports consistent deployment from development through production.
• CI/CD Integration: Stress the automation of the build and deployment cycle through GitHub Actions, ensuring efficient delivery.
• Testing: Mention the importance of automated testing (Pytest) for maintaining code quality.
Relevant Technologies and Their Roles
• FastAPI: The framework powering the asynchronous API.
• Docker & Docker Compose: Tools for containerizing and orchestrating the application.
• GitHub Actions: Automates Docker image build and push to AWS ECR.
• Pytest: Framework for testing application functionality.
• AWS ECR: Repository where Docker images are stored after CI/CD processes.