Skip to content

An optimized API with caching, data compression,...

License

Notifications You must be signed in to change notification settings

bambadiagne/ultra-api

Repository files navigation

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 docker
Flask flask
AWS redis
PostgreSQL postgresql
Redis 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/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

Installation

  1. Clone the repository: git clone https://github.com/bambadiagne/ultra-api.git

  2. Create .env file copy .env.sample contents and change the values(if you not change it,sending mail and logging system aren't working)

  3. You can use the docker-compose file it's so simple but you need that Docker installed in your device

  4. 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/todos/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.

License

MIT

Releases

No releases published

Packages

No packages published

Languages