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.
Stack | Logo |
---|---|
Docker | |
Flask | |
AWS | |
PostgreSQL | |
Redis |
- 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)
/api/v1/users
: Register a new user/api/v1/login
: Log in a user/api/v1/logout
: Log out a user/api/v1/todos
: Get all todos for the current user/api/v1/todos/<int:id_todo>
: Get, update, or delete a specific todo
-
Clone the repository:
git clone https://github.com/bambadiagne/ultra-api.git
-
Create .env file copy .env.sample contents and change the values(if you not change it,sending mail and logging system aren't working)
-
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
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/todos/1 Content-Type: application/json
{ "title": "New title", "description": "New description", "completed": true, "deadline": "12/31/21 23:59:59" }
Pull requests are welcome CONTRIBUTING.