Modular Flask REST API for managing tasks with SQLite, CRUD endpoints, and demo data.
1.6K
This repository contains a containerized version of Task Manager API, a modular RESTful API built with Flask that allows users to manage tasks efficiently. The system supports full CRUD operations (Create, Read, Update, Delete) for tasks, each of which includes a title, description, and completed status. The API is designed with a clean, scalable Flask structure suitable for learning, testing, and small project deployment.
The Docker container encapsulates the Python runtime, Flask framework, and SQLite database, allowing the API to run consistently across systems without requiring local setup.
Task Manager API follows a modular Flask architecture with separate layers for routing, models, and utilities:
__init__.py file initializes the application and registers blueprints, enabling modular expansion.models.py defines the Task model using Flask-SQLAlchemy, mapping task attributes to the SQLite database.routes.py defines RESTful endpoints for task operations, including CRUD operations and homepage info.utils.py.tasks.db) stores task data and is created automatically when the application runs.The modular structure allows easy extension for user management, authentication, filtering, or pagination of tasks.
Full CRUD Operations
Create, read, update, and delete tasks via RESTful endpoints.
Task Management
Tasks include a title, description, and completed status.
JSON-Based API Responses
All endpoints return structured JSON responses for easy integration.
Modular Flask Structure
The application uses Flask Blueprints for scalability and maintainability.
Database Population Script
populate.py provides a simple way to prefill the database with sample tasks for testing or demo purposes.
Extensible and Testable
Supports expansion for additional endpoints, authentication, or data filtering. Recommended to use Postman or cURL for testing.
Containerized Deployment
The Docker container encapsulates the Python runtime, Flask framework, and SQLite database for easy deployment.
First, pull the Docker image:
docker pull keneandita/taskmanagerapi
Run the container while exposing the API port:
docker run -p 5000:5000 keneandita/taskmanagerapi
Once the container starts, the API is accessible in a browser or via API clients:
Homepage: http://localhost:5000/
Tasks API: http://localhost:5000/tasks/
You can populate the database with sample tasks using the included script:
docker exec -it <container-id> python populate.py
The API supports the following endpoints:
GET /tasks/ – Retrieve all tasksGET /tasks/<id> – Retrieve a task by IDPOST /tasks/ – Create a new taskPUT /tasks/<id> – Update an existing taskDELETE /tasks/<id> – Delete a taskExample POST body:
{
"title": "Buy groceries",
"description": "Get milk, eggs, bread, and vegetables",
"completed": false
}
The containerized setup enables rapid testing, deployment, and development of this modular task management API.
Content type
Image
Digest
sha256:782db8313…
Size
63 MB
Last updated
about 1 year ago
docker pull keneandita/taskmanagerapi