Skip to content

Latest commit

 

History

History
52 lines (36 loc) · 1.52 KB

File metadata and controls

52 lines (36 loc) · 1.52 KB

User Management System with FastAPI

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.

What it does

  • 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

Tech used

  • Python with FastAPI
  • SQLAlchemy for ORM
  • PostgreSQL
  • Redis
  • Docker + Docker Compose
  • Jinja2 for templates

How it’s organized

  • app/crud.py – contains the database operations and caching logic
  • app/db.py – sets up the PostgreSQL connection
  • app/models.py – defines the User model
  • app/templates/users.html – contains the Jinja2 template for the user interface
  • docker-compose.yml – runs everything in containers
  • Dockerfile – builds the Python app container
  • requirements.txt – lists the Python dependencies

How to run it

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.

Deployment on Hostim.dev

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.