Skip to main content

FastAPI sizzles, Django dazzles. The best of both worlds in one framework.

Project description

🚀 Raystack: Where FastAPI Speed Meets Django Elegance

PyPI Version Python Versions Python 3.6+ License Downloads

Raystack is a modern, high-performance Python web framework that merges the asynchronous power of FastAPI with the battle-tested structure and development convenience inspired by Django. Forget the compromises between speed and ease of development — with Raystack, you get the best of both worlds!

✨ Why Choose Raystack?

Do you love FastAPI's speed but miss Django's organized project structure? Do you want a powerful ORM with built-in async support and a familiar admin panel? Raystack is built for you! It's ideal for:

  • High-Performance APIs and Microservices: Leverage FastAPI's capabilities for blazing-fast and concurrent request handling.
  • Rapid Development of Full-Featured Web Applications: Benefit from a ready-to-use project structure, templating, admin panel, and CLI tools.
  • Developers Transitioning from Django: Get up to speed instantly with familiar "app" concepts, ORM, and management commands.
  • Projects Requiring a Flexible and Robust ORM: SQLAlchemy under the hood gives you full control over your database.

🌟 Key Features

  • FastAPI at its Core: Experience incredible speed and asynchronous performance for your web applications.
  • Django-Inspired Project Structure: Organize your project with "apps" for clean, modular, and maintainable code.
  • Universal SQLAlchemy ORM: A powerful and flexible ORM with a unified API for both synchronous and asynchronous operations.
  • Smart Database Management (Alembic): Seamless database migrations for effortless schema evolution.
  • Jinja2 Templating: A robust and flexible templating engine for dynamic HTML rendering.
  • Built-in Admin Panel: A ready-to-use, customizable administrative interface for easy data management.
  • Convenient CLI Commands: Create projects and apps, run the server, manage migrations, and more—all from your command line.
  • Async-First Design: Full support for asynchronous views and database operations with minimal effort.
  • Multi-Database Support: Connect to SQLite, PostgreSQL, MySQL, and other databases with easy switching between sync and async drivers.
  • Extensible Architecture: Easily integrate your own apps, middleware, and commands to tailor the framework to your needs.

⚡ Quick Start

Get your project up and running in minutes!

1. Install Raystack

pip install raystack

2. Create a New Project

raystack startproject myproject
cd myproject

3. Run the Development Server

raystack runserver

Open your browser and navigate to: http://127.0.0.1:8000

🏗️ Project Structure

Raystack offers a clear and modular project structure, inspired by Django:

graph TD
    A[Raystack Project] --> B[myproject/];
    B --> C[apps/];
    C --> D[home/];
    D --> D1[models.py];
    D --> D2[views.py];
    D --> D3[urls.py];
    D --> D4[admin.py];
    B --> E[config/];
    E --> E1[settings.py];
    E --> E2[urls.py];
    B --> F[core/];
    F --> F1[__init__.py];
    B --> G[templates/];
    G --> G1[base.html];
    G --> G2[home/];
    B --> H[requirements.txt];
    B --> I[README.md];

🌐 URL-Based Async/Sync Mode Detection

Raystack introduces a unique approach to database interaction, allowing you to explicitly control whether to use synchronous or asynchronous operations by simply specifying the appropriate driver in your database URL.

How It Works:

The mode is determined by the presence of async drivers in your database URL within your config/settings.py file.

# Synchronous mode (default)
DATABASES = {
    'default': {
        'ENGINE': 'raystack.core.database.sqlalchemy',
        'URL': 'sqlite:///db.sqlite3',  # Sync mode
    }
}

# Asynchronous mode
DATABASES = {
    'default': {
        'ENGINE': 'raystack.core.database.sqlalchemy',
        'URL': 'sqlite+aiosqlite:///' + str(BASE_DIR / 'db.sqlite3'),  # Async mode
    }
}

Supported Drivers:

Synchronous:

  • SQLite: sqlite:///db.sqlite3
  • PostgreSQL: postgresql://user:pass@localhost/dbname
  • MySQL: mysql://user:pass@localhost/dbname

Asynchronous:

  • SQLite: sqlite+aiosqlite:///db.sqlite3 (requires aiosqlite)
  • PostgreSQL: postgresql+asyncpg://user:pass@localhost/dbname (requires asyncpg)
  • MySQL: mysql+aiomysql://user:pass@localhost/dbname (requires aiomysql)

Benefits:

  • Explicit Control: You explicitly choose the mode in settings, not based on execution context.
  • Predictable Behavior: Database operations are always clear and predictable.
  • Framework Agnostic: Works consistently with FastAPI, Django, Flask, or any other framework.
  • Easy Switching: Simply change the URL to switch between sync and async modes.
  • Clear Intent: The URL clearly indicates whether you're using sync or async database drivers.

🛠️ ORM Usage Examples

Raystack's ORM automatically detects the mode based on your database configuration and adapts accordingly. No need for separate sync/async methods!

Basic CRUD Operations

# Create
article = await Article.objects.create(title="Hello", content="World", author_id=1)

# Get a single object
user = await UserModel.objects.get(id=1)

# Filter
users = await UserModel.objects.filter(age__gte=25).execute()

# Update
user.name = "Jane Doe"
await user.save()

# Delete
await user.delete()

# Count
count = await UserModel.objects.count()

# Check existence
exists = await UserModel.objects.filter(email="john@example.com").exists()

🖼️ Screenshots

Home Page: Home Page

Login Page: Login Page

Admin Panel: Admin Page

📚 Documentation

🤝 Contributing

Pull requests and issues are welcome! See GitHub.

📜 License

MIT License. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

raystack-0.1.3.tar.gz (36.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

raystack-0.1.3-py3-none-any.whl (36.8 MB view details)

Uploaded Python 3

File details

Details for the file raystack-0.1.3.tar.gz.

File metadata

  • Download URL: raystack-0.1.3.tar.gz
  • Upload date:
  • Size: 36.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for raystack-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c81d01fba4b137bb6393e8c7b72aef8c1cc873560aa5963457114f11e4729c10
MD5 e603536332b6f00bbd111704ebe020b5
BLAKE2b-256 2bb7c0e97028891636c54010241761bd0437022abfa016fb379552500a1789d7

See more details on using hashes here.

File details

Details for the file raystack-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: raystack-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 36.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for raystack-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 613b5f52d0ed1a332619552c67bfd6252a3b037d5508d3aa60a3132e2d571cb7
MD5 3b0c18c67acce1f81bb0fe5075a9d381
BLAKE2b-256 4931958323a98ed90dfda7eea3bd46fb1ff58f4d55ca7492b7341dc263f3abc7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page