Hello Backend Engineers
Hello Backend Engineers
Task Description
Your task is to deploy a FastAPI application with a Continuous Integration (CI) and Continuous
Deployment (CD) pipeline. You will use an existing template repository, add a missing endpoint,
set up a test pipeline, and configure the deployment process. Your application should be served
using Nginx.Get Started
Requirements
1. Implement the Missing Endpoint
● Endpoint: /api/v1/books/{book_id}
● Functionality:
○ Retrieve a book by its ID.
○ Return a JSON response containing the book details.
○ If the book does not exist, return a 404 Not Found response.
● Constraints:
○ Do not delete any books from the database.
○ Do not modify main.py.
● Trigger: The workflow should run on pull requests to the main branch.
● Job Name: test
● Actions:
○ Run pytest to execute the existing tests.
○ Fail if there are issues in the application.
○ Succeed if the application passes all tests.
● Trigger: The workflow should run on merging a pull request to the main branch.
● Job Name: deploy
● Actions:
○ Automatically update the deployed api with the latest changes.
● Configuration:
○ Use Nginx as a reverse proxy for the FastAPI application.
○ Ensure API requests are correctly handled by the FastAPI backend.
API Specification
Endpoint
● Method: GET
● URL: /api/v1/books/{book_id}
● Parameters: book_id (integer)
Response Formats
Acceptance Criteria
Functionality
Deployment
Documentation
Submission Mode
Submit your solution in your stage two slack channel #stage-two-backend using the
/submit command.Provide the following:
1. The base URL of your deployed application (without any paths or endpoints).
2. Your GitHub repository URL (without .git at the end).
Submission Deadline
The deadline for submissions is 12th February 2025, 11:59 PM WAT (GMT +1). Late
submissions will not be entertained.Additional Notes
● Evaluation Criteria:
○ Correctness of the API implementation.
○ Proper setup of CI/CD pipelines.
○ Successful deployment and Nginx integration.
● Retry Policy: If you fail all 3 attempts, you’ll get another chance in HNG13.