OpenViper Documentation
OpenViper is a production-ready, async-first Python web framework designed to be both flexible and batteries-included. It gives you the freedom of a minimal, unopinionated core when you want control, while also providing a rich, fully integrated stack when you want to move fast.
Out of the box it includes a powerful ORM with model lifecycle and events, built-in authentication and authorization, an Admin UI, background task processing, a pluggable AI provider registry, and automatic OpenAPI documentation.
Whether you’re building lean APIs or full-scale platforms, OpenViper scales with you - without forcing you into rigid architectural constraints.
Quick Example
The examples/flexible/app.py or examples/todoapp/ in the repo is the minimal way to get started:
# examples/flexible/app.py
from openviper import OpenViper, JSONResponse
from openviper.http.request import Request
app = OpenViper(title="Standard Example API", version="1.0.0")
@app.get("/")
async def index(request: Request) -> JSONResponse:
return JSONResponse({"message": "Hello, OpenViper!"})
@app.get("/users/{user_id}")
async def get_user(request: Request, user_id: int) -> JSONResponse:
# ... fetch from DB
return JSONResponse({"id": user_id})
# Run it
openviper run app --reload # from examples/flexible/, --reload to watch file changes and hot reload
# Open: http://localhost:8000
# Swagger: http://localhost:8000/open-api/docs
For a full example with auth, admin, templates, and ORM see examples/todoapp/. For a production-grade multi-app example with AI moderation see examples/ai_moderation_platform/.
Key highlights
Async-first - every request handler, ORM query, and lifecycle hook is
async/awaitnative.Models and ORM - models with full async support and model lifecycle.
Protected ORM - role-based access enforcement at the query level, not just at the view level.
AI-native - a unified AI Integration abstracts OpenAI, Anthropic, Gemini, Ollama, Grok and custom providers behind a single async API.
Admin panel - automatic CRUD interface, auto-discovery, and role-based visibility.
OpenAPI - live Swagger and ReDoc UIs generated automatically from your routes.
Getting Started
Tutorial
- Tutorial: Building a Blog
- Step 1 - Create the Project
- Step 2 - Create the Users App
- Step 3 - Create the Blog App
- Define the Post Model
- Create the Serializer (Optional)
- Step 4 - Write the Views
- Step 5 - Register Routes
- Step 6 - Register with the Admin Panel
- Step 7 - Events
- Step 8 - Optional: AI Content Generator
- Explore the Tools
- Testing with Swagger UI (OpenAPI)
- Well Done!
Framework Reference
- The OpenViper Application
- HTTP - Requests, Responses & Views
- Routing
- Middleware
- Plugin Development
- Serializers
- Database & ORM
- Array Field
- Database Backends
- Overview
- How OpenViper Database Backends Work
- DATABASES Configuration
- BACKEND is Optional
- DatabaseBackend
- DatabaseFeatures
- DatabaseOperations
- DatabaseExecution
- DatabaseIntrospection
- DatabaseCreation
- Default SQLAlchemy Backend
- Creating a Custom Backend
- Instrumentation Example
- Testing a Backend
- Security Notes
- Limitations
- Database Routing and Read/Write Replicas
- Single Models
- Authentication & Authorization
- OAuth2 / Social Login
- Auth Lifecycle Hooks
- Admin Panel
- OpenAPI & Swagger UI
- Templates
- File Storage
- Static Files
- Exception Reference
- Debug Page
- Cache Framework
- App Lifecycle
- Background Tasks
- Testing
- Overview
- Installation and Setup
- Configuration
- Core Fixtures
- Testing Routes
- Testing the Database
- Model Factories
- Authentication Helpers
- Settings Overrides
- Assertion Helpers
- Testing Mail, Events, Tasks, Cache, and Storage
- Testing OpenAPI and Admin
- CLI Testing
- Pytest Markers
- Public API Reference
- Project Scaffold
- Running Tests
- Best Practices
- Limitations
Configuration & Operations
Indices and tables