-
FastAPI for API
-
PostgreSQL for database
-
Async SQLAlchemy as the ORM coupled with Alembic for migrations
-
Aiogram for using a previously created telegram bot (used for sending OTPs and reminding user's todos)
-
Celery for task scheduling
- Redis as Celery's results Backend
- RabbitMQ as the message Broker between the App and Celery
Using @BotFather in Telegram, first create a bot and go through configuring it (BotFather will guide you, making you an offer you can't refuse ;} ). You will be given a Token in the end. Set this token inside your .env
file.
You also need to create a single .env
file and specify the below required environment variables:
POSTGRES_USER
POSTGRES_PASSWORD
POSTGRES_DB
PGADMIN_DEFAULT_EMAIL
PGADMIN_DEFAULT_PASSWORD
DB_URL
SECRET_KEY
ALGORITHM
TOKEN_EXPIRATION_IN_SECONDS
BROKER_URL
BACKEND_URL
Note: Put these all inside one file named .env
Note: If launching without Docker, you need to first load the environment variables, e.g. using dotenv
module's load_dotenv()
method
Note: Secret_key
and Algorithm
are used for login token handling
It's highly recommended to launch this using Docker.
Otherwise you are gonna have to install different applications, and use two seperate terminals for launching the app. (one for FastAPI and one for the Celery worker)
Use docker-compose up
command to launch the application.
After setting up PostgreSQL, Redis and RabbitMQ:
run uvicorn main:app
on Linux / MacOS, run: celery -A utils.celery_worker.app worker --loglevel=info
on Windows, run: celery -A utils.celery_worker.app worker --pool=solo --loglevel=info
Check out localhost:8000
for FastAPI, and its docs (Swagger) at localhost:8000/docs
Using Docker only access pgAdmin at localhost:5050