A modern, fast, and production-ready Python web framework built on top of FastAPI with batteries included.
Faster is a comprehensive web framework that provides a solid foundation for building scalable web applications. It includes pre-configured components for database management, Redis integration, authentication, logging, and more, allowing developers to focus on business logic rather than infrastructure setup.
- FastAPI Core: Built on top of FastAPI for high performance and async support
- Database Integration: SQLModel/SQLAlchemy with connection pooling and migration support
- Redis Management: Multi-provider Redis support with pub/sub capabilities
- Authentication: JWT-based authentication system
- Configuration Management: Environment-based configuration with Pydantic Settings
- Logging: Structured logging with multiple output formats
- Error Handling: Comprehensive exception handling mechanisms
- Testing: Ready-to-use test setup with pytest
- Deployment Ready: Production-ready server configuration
Added full support for Redis publish/subscribe patterns with the following features:
- Publish Method: Send messages to Redis channels
- Subscribe Method: Subscribe to Redis channels and receive messages
- Pub/Sub Object: Returns a Redis PubSub object for managing subscriptions
- Error Handling: Proper error wrapping and logging for pub/sub operations
- Complete Test Coverage: Unit tests for all pub/sub functionality
Fixed and enhanced the test suite with:
- Redis Test Fixes: Resolved issues with Redis client behavior for
nx/xxconditions - Error Recovery Testing: Fixed RedisSafeContext to properly handle default values
- Comprehensive Pub/Sub Tests: Added 4 new test cases for publish/subscribe functionality
- Integration Testing: Verified all components work together correctly
faster/
├── faster/
│ ├── core/
│ │ ├── auth/ # Authentication system
│ │ ├── bootstrap.py # Application initialization
│ │ ├── config.py # Configuration management
│ │ ├── database.py # Database integration
│ │ ├── redis.py # Redis client with pub/sub
│ │ ├── logging.py # Structured logging
│ │ └── ... # Other core components
│ └── __init__.py
├── tests/
│ └── core/ # Unit tests for core components
├── main.py # Application entry point
├── pyproject.toml # Project dependencies and configuration
├── requirements.txt # Dependency list
└── alembic.ini # Database migration configuration
- Python 3.10 or higher
- Redis server (for Redis functionality)
- PostgreSQL or SQLite (for database functionality)
- Clone the repository:
git clone https://github.com/robinmin/faster
cd faster
# Create logs directory
mkdir logs- Install dependencies:
# create virtual environment
python3 -m venv .venv
# activate virtual environment
source .venv/bin/activate
# install dependencies
uv sync
# Or you can use pip to install dependencies
pip install -r requirements.txt
- Set up environment variables:
cp .env.example .env
# Edit .env with your configuration# Development mode
chmod u+x ./main.py
./main.py
# Or with make tool
make run
# Or production mode with uvicorn
uvicorn main:app --host 0.0.0.0 --port 8000# Build the Docker image
make docker-build
# Start all services with Docker Compose
make docker-up
# View logs
make docker-logs
# Stop services
make docker-downFor development with hot-reloading, uncomment the command line in docker/docker-compose.yml:
docker-compose -f docker/docker-compose.yml up -dFor a full production setup with Supabase, Redis, and Traefik, use:
docker-compose -f docker/docker-compose-full.yml up -dThis full setup includes:
- Traefik reverse proxy with SSL support
- Your FastAPI application
- Redis for caching and session storage
- Supabase Auth (GoTrue) for authentication
- Supabase Database (PostgreSQL)
- Supabase API Gateway (Kong)
The application uses environment variables for configuration. Copy the .env.example file to .env and adjust the values as needed:
cp docker/.env.example docker/.envFor the full setup with Supabase, use:
cp docker/.env.example docker/.envThen edit the docker/.env file to set your specific configuration values.
The application is configured through environment variables. Key configuration options include:
- Database:
DATABASE_URL - Redis:
REDIS_URL,REDIS_PROVIDER - Security:
JWT_SECRET_KEY,AUTH_ENABLED - Server:
HOST,PORT,WORKERS
See .env.example for a complete list of configuration options.
The Redis manager provides:
- Multi-provider Support: Local Redis, Upstash, and Fake Redis for testing
- Pub/Sub Functionality: Publish messages and subscribe to channels
- Error Recovery: Decorators and context managers for graceful error handling
- Health Checks: Connection status monitoring
Example usage:
from faster.core.redis import get_redis
@app.get("/publish")
async def publish_message(redis: RedisClient = Depends(get_redis)):
await redis.publish("channel", "Hello, World!")
return {"message": "Published!"}JWT-based authentication system with:
- Token Generation: Secure token creation and validation
- Middleware: Automatic token verification
- Role-based Access: Flexible permission system
SQLModel/SQLAlchemy integration with:
- Connection Pooling: Efficient database connection management
- Migration Support: Alembic integration for schema changes
- Async Operations: Full async support for database operations
Run the test suite with pytest:
# Automatically fix linting errors with ruff
make autofix
# Lint the code with ruff & mypy
make lintRun the test suite with pytest:
# Run all tests
make test- Enhanced Documentation: Create detailed API documentation
- Example Applications: Build sample applications showcasing framework features
- Performance Monitoring: Integrate Prometheus for metrics collection
- Caching Layer: Implement Redis-based caching for improved performance
- Event Bus: Expand event-driven architecture capabilities
- Task Queue: Enhance Celery integration for background tasks
- Rate Limiting: Add request rate limiting middleware
- API Documentation: Auto-generated OpenAPI documentation
- Plugin System: Create an extensible plugin architecture
- Microservices Support: Add service discovery and communication patterns
- Cloud Deployment: Kubernetes deployment configurations
- Admin Interface: Built-in administrative dashboard