Project build on FastApi using JWT token with kafka to manage requests to PostgreSQL database
See Models
Variables .env
file is requried.
Sample file can be found at .env.sample
docker-compose up --build -d
docker-compose -f docker-compose_test.yml run --rm pytest_app && docker-compose down
- Healthcheck
- This is a GET endpoint
- Token
- This is a POST endpoint to get the connection token
- Token Info
- This is a GET endpoint to get info about a token
- Register an user
- This is a POST endpoint to register a user sending data to kafka
- http://127.0.0.1:8080/v1/register
-
body: { "username": "user3", "password": "user3", "first_name": "user3", "middle_name": "user3", "last_name": "user3", "email": "user3@user3.com", "last_login": null, "active": true }
-
- http://127.0.0.1:8080/v1/register
- This is a POST endpoint to register a user sending data to kafka
- Update a user
- This is a POST endpoint to update a user sending data to kafka
- http://127.0.0.1:8080/v1/update/{user_id}
-
body: { "username": "user3", "password": "user3", "first_name": "user3", "middle_name": "user3", "last_name": "user3", "email": "user3@user3.com", "last_login": null, "active": true }
-
- http://127.0.0.1:8080/v1/update/{user_id}
- This is a POST endpoint to update a user sending data to kafka
- Change a user password
- This is a POST endpoint to change a user password by username
- http://127.0.0.1:8080/v1/change_password
-
body: { "username": "user3", "password": "user3", }
-
- http://127.0.0.1:8080/v1/change_password
- This is a POST endpoint to change a user password by username
- User Info by username
- This is a POST endpoint to get info about a user by username
- http://127.0.0.1:8080/v1/userinfo
-
body: { "username": "user3", }
-
- http://127.0.0.1:8080/v1/userinfo
- This is a POST endpoint to get info about a user by username
- User Info by user_id
- This is a GET endpoint to get info about a user by user_id
- Get all users
- This is a GET endpoint to get info about all users
This template uses the following Python libraries to function. Documentation can be found at the links provided:
- FastAPI - Python Framework
- SQLModel - Database Models
- Pydantic - Schema Declarations
- Alembic - Database Migrations
- Apache Kafka - Streaming Platform
- Data Pipeline
- Processes a stream of incoming JSON data from a webhook to register and update a user
- kafka_utils.py
- kafka_insert_processor.py
- kafka_update_processor.py
- users_dal.py
- register_user
- update_user
- Outputs results to a message queue
- Processes a stream of incoming JSON data from a webhook to register and update a user
- Custom Async/Sync Context Manager for database connection
- Manages connections to database
- Provides proper cleanup in case of exceptions
- Includes detailed logging and performance metrics
- Using My own databases project: ddcDatabases