Sign inSign up

keneandita/taskmanagerapi

By keneandita

Updated 6 months ago

Modular Flask REST API for managing tasks with SQLite, CRUD endpoints, and demo data.

Image
Integration & delivery
API management
Web servers
0

1.6K

keneandita/taskmanagerapi repository overview

Project Summary

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.


Architecture Overview

Task Manager API follows a modular Flask architecture with separate layers for routing, models, and utilities:

  • App Factory & Blueprints: The __init__.py file initializes the application and registers blueprints, enabling modular expansion.
  • Models Layer: models.py defines the Task model using Flask-SQLAlchemy, mapping task attributes to the SQLite database.
  • Routes Layer: routes.py defines RESTful endpoints for task operations, including CRUD operations and homepage info.
  • Utilities Layer: Optional helper functions are defined in utils.py.
  • Database: SQLite (tasks.db) stores task data and is created automatically when the application runs.
  • Container Environment: The Docker container packages the Flask application, database, and dependencies for consistent deployment.

The modular structure allows easy extension for user management, authentication, filtering, or pagination of tasks.


Key Features

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.


How to Run

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 tasks
  • GET /tasks/<id> – Retrieve a task by ID
  • POST /tasks/ – Create a new task
  • PUT /tasks/<id> – Update an existing task
  • DELETE /tasks/<id> – Delete a task

Example 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.

Tag summary

Content type

Image

Digest

sha256:782db8313

Size

63 MB

Last updated

about 1 year ago

docker pull keneandita/taskmanagerapi