Skip to content

DanielBarutov/Todo_API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

I am Danil Barutov, an aspiring Python backend developer.

I self-studied a modern Python web development stack (FastAPI, SQLAlchemy, Alembic, Pydantic, Pytest, and GitHub Actions) in an intensive seven-day period and built a ToDo REST API project to demonstrate my skills.
Despite having no formal industry experience, I have completed this case project and undertaken freelance development work.
I am passionate about backend development and continuously learning to improve my skills.

Case Project: ToDo REST API

Project Title: ToDo REST API

Objective: Develop a complete RESTful API for managing a to-do list, demonstrating proficiency in backend development and best practices.

Architecture: The project uses a modular architecture with separate modules for database models, API routes, and data schemas. It includes SQLAlchemy models for database interactions, Pydantic schemas for input/output validation, and Alembic for database migrations.

Tech Stack: FastAPI (web framework), SQLAlchemy (ORM), Alembic (database migrations), Pydantic (data validation), Pytest (testing), Git & GitHub Actions (version control and CI/CD).

Key Components: CRUD API endpoints for task management, proper data validation and error handling, database migrations, and automated tests.

GitHub: Todo_API

Contact Information

Name: Danil Barutov
Email: barutovdg@gmail.com
Telegram: @daniel_papo
GitHub: github.com/danilbarutov

πŸš€ Features

  • βœ… CRUD operations for tasks
  • πŸ—„οΈ SQLAlchemy ORM with migration support
  • πŸ“š Automatic API documentation (Swagger/ReDoc)
  • πŸ—„οΈ SQLAlchemy ORM with migration support

πŸ› οΈ Technology stack

  • FastAPI - a modern web framework for Python
  • SQLAlchemy - ORM for working with the database
  • Alembic - migration system
  • Pydantic - data validation
  • Pytest - testing
  • SQLite - database (can be replaced with PostgreSQL)

πŸ› οΈ Technology stack

Preliminary requirements

  • Python 3.9+
  • pip

Local installation

  1. Clone the repository:
git clone <repository-url>
cd todo-api
  1. Create a virtual environment: ``bash python -m venv venv source venv/bin/activate # Linux/Mac

or

venv\Scripts\activate # Windows


3. **Install dependencies:**
```bash
pip install -r requirements.txt
  1. Configure the environment variables:
cp .env.example .env
# Edit it .env file if necessary
``

5. **Start migrations:**
```bash
alembic upgrade head
  1. Start the server:
uvicorn app.main:app --reload

The API will be available at: http://localhost:8000

πŸ“š Automatic API Documentation (Swagger/ReDoc)

After starting the server, the documentation is available at the following addresses:

πŸ§ͺ Testing

Running tests

pytest tests/ -v

Running tests with coverage

pytest tests/ -v --cov=app --cov-report=html

πŸ“‹ Usage examples

Creating a task

curl -X POST "http://localhost:8000/tasks/" \
     -H "Content-Type: application/json" \
     -d '{
       "title": "Explore FastAPI",
"description": "Explore documentation and create the first project",
       "is_completed": false
     }'

Getting the task list

curl -X GET "http://localhost:8000/tasks/"

Getting a specific task

curl -X GET "http://localhost:8000/tasks/1"

Updating the task

curl -X PUT "http://localhost:8000/tasks/1" \
     -H "Content-Type: application/json" \
     -d '{
       "title": "Explore FastAPI (updated)",
       "is_completed": true
     }'

Deleting an issue

curl -X DELETE "http://localhost:8000/tasks/1"

πŸ“‹ Structure

todo-api/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ main.py # Application Entry Point
β”‚   β”œβ”€β”€ models.py # SQLAlchemy models
β”‚   β”œβ”€β”€ schemas.py # Pydantic schemes
β”‚   β”œβ”€β”€ crud.py # CRUD operations
β”‚   β”œβ”€β”€ routes.py        # API endpoints
β”‚   └── database.py # Database Configuration
β”œβ”€β”€ alembic/ # Database migrations
β”œβ”€β”€ tests/               # Tests
,──__
init__.py ,── conftest.py # Pytest configuration
,── test_tasks.py # Tests for tasks
β”œβ”€β”€ .github/workflows/ # CI/CD
β”œβ”€β”€ requirements.txt # Dependencies
β”œβ”€β”€ .env.example # Example of environment variables
,── alembic.ini # Alembic configuration
,── README.md # Documentation

πŸ”§ API Endpoints

The Endpoint method Description
POST /tasks/ Create a new task
GET /tasks/ Get a list of tasks
GET /tasks/{id} Get a task by ID
PUT /tasks/{id} Update the issue
DELETE /tasks/{id} Delete an issue
POST /user/ Create a new user
GET /users/ Get a list of users
GET /health API Health Check

πŸ†˜ Support

If you have any questions or concerns, create an issue in the repository.


Author: Danil Barutov
Version: 1.0.0
Date: 2025

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors