Skip to content

gsoldatov/redis_keycloak_tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

An implementation of a Twitter clone project from Redis docs using Python 3.13, FastAPI, Redis as a database and Keycloak as a separate auth service.

Contains a simple API for registering & authenticating users, following other users, adding and viewing posts, as well as users' feeds.

Running in Development Mode

  1. Create virtual environment & install dependencies.
python -m venv venv --prompt "Redis + Keycloak tutorial"
source venv/bin/activate
pip install -r requirements.txt
  1. Add a project configuration file config.yml (see config.yml.example).

  2. Initialize Keycloak & Redis containers.

python src/container_cli.py run
  1. Start development server.
fastapi dev src/app/main.py

Running tests

Tests are implemented with Pytest + xdist plugin and use development containers for creating temporary Redis databases & Keycloak realms.

Tests can be run using tests module.

# Run all tests
python -m tests

# Run tests in tests/tests/validation dir
python -m tests validation

Each test file is executable and can be run on its own.

Other

Container Management

Keycloak and Redis containers can be created, started, stopped and removed with container CLI utility:

# Run or start existing containers
python src/container_cli.py run

# Stop existing containers
python src/container_cli.py stop

# Remove existing containers
python src/container_cli.py remove

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages