Skip to main content

Ravyn

A next-generation async Python framework for building high-performance APIs, microservices, and web applications with type safety and elegance. 🚀

Test Suite Package version Supported Python versions


Documentation: https://ravyn.dev 📚

Source Code: https://github.com/dymmond/ravyn

The official supported version is always the latest released.

!!! Info "Coming from Esmerald?" If you came looking for Esmerald, you are in the right place. Esmerald was rebranded to Ravyn. All features remain and continue to grow.


Quick Start

Get your first Ravyn API running in minutes.

Installation

pip install ravyn[standard]

This installs Ravyn with recommended extras. You'll also need an ASGI server:

pip install palfrey

Your First API

Create a file called app.py:

from ravyn import Ravyn, get, JSONResponse

app = Ravyn()

@app.get("/")
def welcome() -> JSONResponse:
    return JSONResponse({"message": "Welcome to Ravyn!"})

@app.get("/hello/{name}")
def greet(name: str) -> JSONResponse:
    return JSONResponse({"message": f"Hello, {name}!"})

Run It

palfrey app:app --reload

Visit http://127.0.0.1:8000/hello/World and you'll see:

{"message": "Hello, World!"}

Explore the Docs

Ravyn automatically generates interactive API documentation:

Congratulations! 🎉 You've built your first Ravyn API.


Why Ravyn?

Ravyn combines the best ideas from FastAPI, Django, Flask, and NestJS into a framework designed for real-world applications. from prototypes to enterprise systems.

Key Features

  • ⚡ Fast: Built on Lilya and Pydantic, with async-first design
  • 🎯 Type-Safe: Full Python 3.10+ type hints for better IDE support and fewer bugs
  • 🧩 Flexible: Choose OOP (controllers) or functional style. or mix both
  • 🔋 Batteries Included: Dependency injection, middleware, permissions, schedulers, and more
  • Database Ready: Native support for Edgy ORM and Mongoz ODM
  • 🧪 Testable: Built-in test client for easy testing
  • 📖 Auto-Documented: OpenAPI/Swagger docs generated automatically

Core Concepts

Routes and Handlers

Ravyn uses decorators or Gateway objects to define routes.

!!! warning "Critical Requirements" 1. At least one route is required: An empty Ravyn() application does nothing. You must define routes to handle requests. 2. Return types are important: Always specify return type hints (e.g., -> dict, -> JSONResponse). Ravyn uses these to: - Serialize your data correctly - Generate accurate API documentation - Validate responses

from ravyn import Ravyn, get, post

app = Ravyn()

@app.get("/users")
def list_users() -> dict:
    return {"users": ["Alice", "Bob"]}

@app.post("/users")
def create_user(name: str) -> dict:
    return {"created": name}
from ravyn import Ravyn, Gateway, get

@get()
def list_users() -> dict:
    return {"users": ["Alice", "Bob"]}

app = Ravyn(
    routes=[
        Gateway("/users", handler=list_users)
    ]
)

!!! tip Use decorators for quick prototypes. Use Gateway + Include for scalable, organized applications.

Dependency Injection

Inject dependencies at any level. from application-wide to individual routes.

from ravyn import Ravyn, Gateway, Inject, Injects, get

def get_database():
    return {"db": "connected"}

@get()
def users(db: dict = Injects()) -> dict:
    return {"users": [], "db_status": db}

app = Ravyn(
    routes=[Gateway("/users", handler=users)],
    dependencies={"db": Inject(get_database)}
)

Learn more in the Dependencies guide.

Settings Management

Ravyn uses environment-based settings inspired by Django.

from ravyn import RavynSettings
from ravyn.conf.enums import EnvironmentType

class DevelopmentSettings(RavynSettings):
    app_name: str = "My App (Dev)"
    environment: str = EnvironmentType.DEVELOPMENT
    debug: bool = True

Load your settings via environment variable:

# MacOS/Linux
RAVYN_SETTINGS_MODULE='myapp.settings.DevelopmentSettings' palfrey app:app --reload

# Windows
$env:RAVYN_SETTINGS_MODULE="myapp.settings.DevelopmentSettings"; palfrey app:app --reload

If no RAVYN_SETTINGS_MODULE is set, Ravyn uses sensible defaults.

Learn more in Application Settings.


Organizing Larger Applications

As your app grows, use Include to organize routes into modules.

Project Structure

myapp/
├── app.py
├── urls.py
└── accounts/
    ├── controllers.py
    └── urls.py

accounts/controllers.py

from ravyn import get, post

@get()
def list_accounts() -> dict:
    return {"accounts": []}

@post()
def create_account(name: str) -> dict:
    return {"created": name}

accounts/urls.py

from ravyn import Gateway
from .controllers import list_accounts, create_account

route_patterns = [
    Gateway("/", handler=list_accounts),
    Gateway("/create", handler=create_account),
]

urls.py

from ravyn import Include

route_patterns = [
    Include("/accounts", namespace="myapp.accounts.urls"),
]

app.py

from ravyn import Ravyn

app = Ravyn(routes="myapp.urls")

Now your routes are organized:

  • GET /accounts/ → list_accounts
  • POST /accounts/create → create_account

Learn more in Routing.


Additional Installation Options

Testing Support

pip install ravyn[test]

Includes the RavynTestClient for testing your application.

JWT Support

pip install ravyn[jwt]

For JWT-based authentication.

Scheduler Support

pip install ravyn[schedulers]

For background task scheduling.

Interactive Shell

pip install ravyn[ipython]  # IPython shell
pip install ravyn[ptpython]  # ptpython shell

Learn more about the shell.


Start a Project with Scaffolding

!!! warning This is for users comfortable with Python project structures. If you're new to Ravyn, continue learning the basics first.

Generate a simple project scaffold:

ravyn createproject myproject --simple

Or generate a complete scaffold (recommended for enterprise apps):

ravyn createproject myproject

This creates a ready-to-go structure with:

  • Pre-configured application
  • Sample routes
  • Test setup

Learn more in Directives.


Next Steps

Now that you have Ravyn running, explore these topics:

Essential Concepts

Building Features

Going to Production

Documentation Development

# Build all documentation languages
hatch run docs:build

# Build one language
hatch run docs:build_lang en

# Serve default language (English)
hatch run docs:serve

# Serve all languages
hatch run docs:serve --all

# Serve a specific language
hatch run docs:serve --lang ru

For contributor docs workflow and translation steps, see Contributing.


Requirements

  • Python 3.10+

Ravyn is built on:

  • Lilya - High-performance ASGI framework
  • Pydantic - Data validation

About Ravyn

History

Ravyn is the evolution of Esmerald, rebranded to align with a growing ecosystem of tools. Esmerald continues to exist for its specific use cases, while Ravyn represents the next generation with improved consistency and future-focused design.

Motivation

While frameworks like FastAPI, Flask, and Django solve 99% of common problems, they sometimes leave gaps in structure and business logic organization. Ravyn was built to fill those gaps while keeping the best features from:

  • FastAPI - API design and automatic documentation
  • Django - Permissions and settings management
  • Flask - Simplicity and flexibility
  • NestJS - Controllers and dependency injection
  • Starlite - Transformers and signature models

Learn more in About Ravyn.


Join the Community

Ravyn is an open source project and we love your contribution!

GitHub stars Discord

  • Star us on GitHub to show your support! ⭐️
  • Join our Discord to ask questions and share your projects.
  • Follow us on X (Twitter) for the latest updates.

Sponsors

Currently there are no sponsors of Ravyn but you can financially help and support the author though GitHub sponsors and become a Special one or a Legend.

Powered by

Worth mentioning who is helping us.

JetBrains

JetBrains logo.

Metadata

Release files for ravyn 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ravyn 0.4.3
File Size Uploaded
ravyn-0.4.3.tar.gz 258.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ravyn 0.4.3
File Interpreter ABI Platform
ravyn-0.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 643.1 kB

Release files / ravyn-0.4.3.tar.gz

Download URL ravyn-0.4.3.tar.gz
Size 258.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b149c214d6a77364db4bc06e3802e50e9ac196f897cd5d143169e328dc4d5252
BLAKE2b-256 checksum
How to use checksums
d46fd7afedd398cfb306537ddc4967a9466c0a13cd5a0739aa20a2edf6b5fe96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.10.21"},"installer":{"name":"hatch","version":"1.18.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.10.21","system":{"name":"Linux","release":"6.17.0-1022-azure"}} HTTPX2/2.13.1

Release files / ravyn-0.4.3-py3-none-any.whl

Download URL ravyn-0.4.3-py3-none-any.whl
Size 384.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c912df2b185cc9d8442db7cd9c1ac8ce8ab62ab915e5741c3a17596989913f6
BLAKE2b-256 checksum
How to use checksums
8a88291ef2c70cf198a807e873845907945b85042891f57bcd81cf28ceb7dbc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.10.21"},"installer":{"name":"hatch","version":"1.18.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.10.21","system":{"name":"Linux","release":"6.17.0-1022-azure"}} HTTPX2/2.13.1

Release history Release notifications | RSS feed

This release

0.4.3 This release

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.12

2 release files

0.3.11

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page