A RESTful API for issue tracking built with FastAPI. This application provides full CRUD operations for managing issues with priority levels, status tracking, and JSON-based persistence.
- β Full CRUD operations (Create, Read, Update, Delete) for issues
- π·οΈ Issue status tracking (open, in_progress, closed)
- β‘ Priority levels (low, medium, high)
- π Automatic data validation using Pydantic
- π Request timing middleware
- π CORS support for web integration
- π Interactive API documentation (Swagger UI)
- πΎ JSON-based file storage
- FastAPI - Modern, fast web framework for building APIs
- Pydantic - Data validation using Python type annotations
- Uvicorn - ASGI server for running the application
- Python 3.9+ - Programming language
- Python 3.9 or higher
- pip (Python package manager)
- Clone the repository:
git clone <repository-url>
cd FastAPI- Create a virtual environment:
python3 -m venv .venv- Activate the virtual environment:
# On macOS/Linux:
source .venv/bin/activate
# On Windows:
.venv\Scripts\activate- Install dependencies:
pip install -r requirements.txtStart the development server:
uvicorn main:app --reloadThe API will be available at:
- API Base URL: http://localhost:8000
- Interactive API Docs (Swagger): http://localhost:8000/docs
- Alternative API Docs (ReDoc): http://localhost:8000/redoc
The application is deployed and available at:
π Live API: https://fastapi-vs9l.onrender.com
You can access the interactive API documentation at:
- Swagger UI: https://fastapi-vs9l.onrender.com/docs
- ReDoc: https://fastapi-vs9l.onrender.com/redoc
All API endpoints are available at the base URL. For example:
- Get all issues:
https://fastapi-vs9l.onrender.com/api/v1/issues/ - Create an issue:
POST https://fastapi-vs9l.onrender.com/api/v1/issues/
All endpoints are prefixed with /api/v1/issues
GET /api/v1/issues/Returns a list of all issues.
Response: 200 OK
[
{
"id": "uuid-string",
"title": "Issue title",
"description": "Issue description",
"priority": "medium",
"status": "open"
}
]GET /api/v1/issues/{issue_id}Returns a specific issue by its ID.
Parameters:
issue_id(string): The unique identifier of the issue
Response: 200 OK or 404 Not Found
POST /api/v1/issues/Creates a new issue.
Request Body:
{
"title": "Fix authentication bug",
"description": "Users cannot log in with their credentials",
"priority": "high"
}Validation Rules:
title: 3-100 charactersdescription: 5-1000 characterspriority: "low", "medium", or "high" (defaults to "medium")
Response: 201 Created
PUT /api/v1/issues/{issue_id}Updates an existing issue. All fields are optional.
Request Body:
{
"title": "Updated title",
"description": "Updated description",
"priority": "high",
"status": "in_progress"
}Response: 200 OK or 404 Not Found
DELETE /api/v1/issues/{issue_id}Deletes an issue by its ID.
Response: 204 No Content or 404 Not Found
Create an issue:
curl -X POST "http://localhost:8000/api/v1/issues/" \
-H "Content-Type: application/json" \
-d '{
"title": "Fix bug in authentication",
"description": "Users cannot log in with their credentials",
"priority": "high"
}'Get all issues:
curl http://localhost:8000/api/v1/issues/Get a specific issue:
curl http://localhost:8000/api/v1/issues/{issue_id}Update an issue:
curl -X PUT "http://localhost:8000/api/v1/issues/{issue_id}" \
-H "Content-Type: application/json" \
-d '{
"status": "in_progress",
"priority": "high"
}'Delete an issue:
curl -X DELETE "http://localhost:8000/api/v1/issues/{issue_id}"import requests
# Create an issue
response = requests.post(
"http://localhost:8000/api/v1/issues/",
json={
"title": "Fix authentication bug",
"description": "Users cannot log in",
"priority": "high"
}
)
issue = response.json()
# Get all issues
issues = requests.get("http://localhost:8000/api/v1/issues/").json()
# Update an issue
requests.put(
f"http://localhost:8000/api/v1/issues/{issue['id']}",
json={"status": "in_progress"}
)FastAPI/
βββ app/
β βββ __init__.py
β βββ schemas.py # Pydantic models for data validation
β βββ storage.py # JSON file storage utilities
β βββ middleware/
β β βββ timer.py # Request timing middleware
β βββ routes/
β βββ __init__.py
β βββ issues.py # Issue CRUD endpoints
βββ data/
β βββ issues.json # JSON data storage (auto-created)
βββ main.py # FastAPI application entry point
βββ requirements.txt # Python dependencies
βββ README.md # This file
open- Issue is newly createdin_progress- Issue is being worked onclosed- Issue is resolved
low- Low priority issuemedium- Medium priority issue (default)high- High priority issue
The --reload flag enables auto-reload on code changes:
uvicorn main:app --reloadIssues are stored in data/issues.json. This file is automatically created when the first issue is saved.
This project is open source and available under the MIT License.