https://github.com/frnn4268/kanban_api_pfp-gsi
This project is a Kanban Task Management API built with FastAPI, SQLAlchemy, and PostgreSQL. It provides CRUD operations for managing tasks and follows a structured architecture to ensure scalability and maintainability.
https://github.com/frnn4268/kanban_api_pfp-gsi
docker-compose dockerfile fastapi fastapi-sqlalchemy makefile poetry postgresql postman-collection python
Last synced: 4 months ago
JSON representation
This project is a Kanban Task Management API built with FastAPI, SQLAlchemy, and PostgreSQL. It provides CRUD operations for managing tasks and follows a structured architecture to ensure scalability and maintainability.
- Host: GitHub
- URL: https://github.com/frnn4268/kanban_api_pfp-gsi
- Owner: Frnn4268
- Created: 2025-02-27T15:56:01.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2025-02-27T20:25:01.000Z (4 months ago)
- Last Synced: 2025-02-27T22:42:36.545Z (4 months ago)
- Topics: docker-compose, dockerfile, fastapi, fastapi-sqlalchemy, makefile, poetry, postgresql, postman-collection, python
- Language: Python
- Homepage:
- Size: 72.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kanban API - GSI
## Overview
This project is a Task Management API built with FastAPI, SQLAlchemy, and PostgreSQL. It provides CRUD operations for managing tasks and follows a structured architecture to ensure scalability and maintainability.
## Features
- Create, read, update, and delete (CRUD) tasks.
- Database schema and seed data included.
- Containerized deployment using Docker Compose.
- Preconfigured Makefile for easier command execution.
- Postman collection for testing API endpoints.
## Directory Structure
```plaintext
├── app
│ ├── crud
│ │ └── crud.py # CRUD operations for tasks
│ ├── database
│ │ ├── database.py # Database connection
│ │ └── schemas.py # Pydantic models for request validation
│ ├── main.py # FastAPI application entry point
│ ├── models
│ │ └── models.py # SQLAlchemy database models
│ ├── __pycache__
│ └── routes
│ └── tasks.py # API routes for task management
├── db
│ ├── schema.sql # Database schema
│ └── seed-data.sql # Initial seed data for testing
├── docker-compose.yml # Docker Compose configuration
├── Dockerfile # Docker image definition
├── entrypoint.sh # Script to initialize the application
├── Makefile # Makefile for common commands
├── poetry.lock # Poetry dependencies lock file
├── postman_collection.json # Postman collection for API testing
├── pyproject.toml # Project dependencies and configuration
└── README.md # Project documentation
```## Services
This project consists of the following services:
| Service | Description | Port |
| ------------ | ------------ | ------------ |
| FastAPI | Main application handling API requests | 8000 |
| PostgreSQL | Database service storing task data | 5432 |## Installation & Setup
### Prerequisites
Ensure you have the following installed:
- Docker & Docker Compose
- Make (optional, for simplified commands)### Running the Application with Docker Compose
1. Clone the repository:
```bash
git clone https://github.com/Frnn4268/kanban_api_PFP-gsi
cd kanban_api_PFP-gsi
```2. Start the application:
```bash
docker-compose up --build
```
For other hand
```bash
docker-compose up --build -d
```#### When to use:
> - Use docker-compose up --build if you want to see logs in the terminal and ensure the containers are running.
> - Use docker-compose up --build -d if you prefer the containers to run in the background without keeping the terminal session open for logs.3. The API will be available at:
```bash
http://localhost:8000
```4. Stop the application:
```bash
docker-compose down
```### Running the Application with Makefile
To run the application using the ***Makefile***, you can use the following commands:
- Start PostgreSQL:
```bash
make run-postgres
```
This will start a PostgreSQL container with a persistent volume.- Run the FastAPI application locally:
```bash
make run-api-fastapi
```
This runs the FastAPI application using uvicorn.- Build the Docker Compose services:
```bash
make compose-build
```
This builds the images defined in docker-compose.yml.- Start the entire application (recommended):
```bash
make compose-up-build
```
**Use this command to bring up all services, ensuring everything is built correctly.** It will start the database, initialize it with the necessary schema and seed data, and then launch the FastAPI backend.- Stop all services:
```bash
make compose-down
```
This shuts down the running containers.- Manually initialize the database:
```bash
make run-init-db
```
This runs the database migration and seed scripts separately.## API Endpoints
| Method | Endpoint | Description |
| ------------ | ------------ | ------------ |
| GET | /tasks/ | Retrieve all tasks |
| GET | /tasks/{id} | Retrieve a specific task by ID |
| GET | /tasks/kanban/all | Retrieve all tasks of Kanban |
| POST | /tasks/ | Create a new task |
| PUT | /tasks/{id} | Update an existing task |
| DELETE | /tasks/{id} | Delete a task |## Database Requirements
- Database URL: ***DATABASE_URL=postgresql://postgres:frnn4268@db:5432/postgres***
| Database | Password |
| ------------ | ------------ |
| postgres | frnn4268 |## Testing with Postman Collection
To test the API, you can use:
- Postman: Import ***postman_collection.json***.
(Collection attached to this project.)## Contributors
- Fernando Martínez - [Github Profile](https://github.com/Frnn4268 "Github Profile")