This is a simple user management system built with FastAPI, PostgreSQL, and Redis. It allows you to create users, upload avatar images, and cache user data.
- Create users with names, emails, and optional avatar images
- List all users with their avatars
- Cache user data in Redis for faster access
- Store user data in PostgreSQL
- Runs in Docker containers
- Python with FastAPI
- SQLAlchemy for ORM
- PostgreSQL
- Redis
- Docker + Docker Compose
- Jinja2 for templates
app/crud.py
– contains the database operations and caching logicapp/db.py
– sets up the PostgreSQL connectionapp/models.py
– defines the User modelapp/templates/users.html
– contains the Jinja2 template for the user interfacedocker-compose.yml
– runs everything in containersDockerfile
– builds the Python app containerrequirements.txt
– lists the Python dependencies
To run the app locally:
docker-compose up --build
Docker Compose sets up three services:
- The web app (FastAPI)
- PostgreSQL
- Redis
The app will be available at http://localhost:8000
.
This app is also set up for easy deployment on Hostim.dev. It shows how to spin up a full stack app with a database and cache inside containers.
For detailed steps on hosting this on Hostim.dev, check out the Hostim.dev deployment guide.