Skip to content

A simple API with 19 endpoints written in FastAPI (works asynchronously), using PostgreSQL, Redis, SMTP, Docker, JWT

Notifications You must be signed in to change notification settings

kreipikc/fastAPI-book-async

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What kind of project is this?

This is an API with 19 endpoints. Realistic AAA (Authentication Authorization and Accounting) server.

What technologies have I used?

  • Python
    • FastAPI
    • SQLAlchemy
    • Pydantic
    • Alembic
  • JWT
  • PostgreSQL
  • Redis
  • SMTP
  • Docker

Why did I even start creating this project?

This is a project created to study FastAPI. Also, with the help of this project, I studied (and am still studying): Docker, JWT token, AAA server.

How usage?

For start project uvicorn app.main:app --reload

You can send requests for book:

  • GET /books/ - all info;
  • POST /books/ - add new book;
  • GET /books/id_book - info about a specific book;
  • PUT /books/id_book - update info about a specific book;
  • DELETE /books/id_book - delete info about a specific book.

Requests for auth:

  • POST /auth/register - user registrator;
  • POST /auth/login - login for user;
  • POST /auth/refresh - refresh access token;
  • POST /auth/logout - logout account;
  • GET /auth/me - information about you;
  • POST /auth/forgot_password - request a reset password procedure;
  • POST /auth/reset_password - reset a password by recovery code in email.

Requests for admin:

  • GET /admin/all_users - information about all users;
  • PUT /admin/update_user_role - update role for user;
  • DELETE /admin/delete_user - delete user.

Requests for roles:

  • GET /roles/all_roles - information about all roles;
  • POST /roles/add_role - add new role;
  • PUT /roles/update_role - update info about a specific role;
  • DELETE /roles/delete_role - delete info about a specific role.

You can also use /docs to check the sending of requests, where all the endpoints will be

How usage Docker?

  1. Download git and docker to your server
  2. Clone the entire project from the github - git clone <link>
  3. Create a ".env" file in the root directory and copy everything from "example.env.txt " and adjust the parameters as needed
  4. Then use docker-compose to run the project - docker-compose up

About

A simple API with 19 endpoints written in FastAPI (works asynchronously), using PostgreSQL, Redis, SMTP, Docker, JWT

Topics

Resources

Stars

Watchers

Forks

Languages