Ultra API
This is a optimized RESTful API. It's built with Flask,PostgresSQL,Redis and Docker.The aim is to show the different concepts of a backend(caching,security,...) that are sometimes considered as just CRUD operations.
Project stack
Stack | Logo |
---|---|
Docker | |
Flask | |
AWS | |
PostgreSQL | |
Redis |
Features
- User registration and authentication and authorization(JWT+CORS)
- CRUD operations for todos
- Caching(with redis)
- Pagination and search for todos
- Rate limiting
- Logging system(with CloudWatch)
Endpoints
/api/v1/user
: Register a new user/auth
: Log in a user/api/v1/todos
: Get all todos for the current user/api/v1/todo/<int:id_todo>
: Get, update, or delete a specific todo
Installation
-
Clone the repository:
git clone https://github.com/yourusername/yourrepository.git
-
Create .env file copy .env.sample contents and change the values(if you not change it,sending mail and logging system aren't running)
-
You can use the docker-compose file it's so simple but you need that Docker installed in your device
-
You can generate data by running gen_todos.py script who uses threading and generate 100k todo rows in your db
docker-compose up -d
Otherwise, you need to setup your own postgres server and also redis
Usage
To get all todos for the current user:
GET /api/v1/todos?page=1&per_page=10&query=test
To update a specific todo:
PUT /api/v1/todo/1 Content-Type: application/json
{ "title": "New title", "description": "New description", "completed": true, "deadline": "12/31/21 23:59:59" }
Contributing
Pull requests are welcome CONTRIBUTING.