Skip to content

A minimalist Python web framework inspired by serverless architectures. Build APIs with a single function, powered by Starlette and Uvicorn. 🌟

License

Notifications You must be signed in to change notification settings

lukefx/stardust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Stardust 🌟

PyPI version Python Versions License: MIT

A micro web framework inspired by serverless and lambda deployments, designed for simplicity and efficiency.

Table of Contents

Installation

Install Stardust using pip:

pip install stardust

Requires Python 3.10 or higher.

Quick Start

Create a simple API in seconds with app.py:

async def serve(req):
    return {"hello": "world"}

Run your application:

stardust app.py

Your API will be available at http://localhost:8000

Features

  • πŸš€ Minimal Setup: Create APIs with just a single function
  • πŸ›  Modern Python: Built for Python 3.10+ with full async support
  • πŸ”Œ CORS Enabled: Built-in CORS middleware for web applications
  • ⚑ Fast: Powered by Starlette and Uvicorn
  • 🧩 Flexible Responses: Support for JSON, Plain Text, and custom Response objects
  • πŸ” Developer Friendly: Debug mode and customizable logging

Usage Examples

JSON Response

async def serve(req):
    return {"message": "Hello, World!"}

Plain Text Response

from starlette.responses import PlainTextResponse

async def serve(req):
    return PlainTextResponse("Hello, World!")

Query Parameters

async def serve(req):
    name = req.query_params.get("name", "world")
    return {"hello": name}

POST Request Handler

async def serve(req):
    body = await req.json()
    return body  # Echo back the request body

Custom Status Codes

from starlette.responses import Response

async def serve(req):
    return Response(status_code=204)

Command Line Options

stardust [options] [file]

Options:
  --port PORT        Port number (default: 8000)
  --host HOST        Host address (default: 0.0.0.0)
  --log-level LEVEL  Logging level (default: error)
  --debug           Enable debug mode

Development

To set up the development environment:

# Clone the repository
git clone https://github.com/lukefx/stardust
cd stardust

# Install development dependencies
uv sync --all-extras --dev

# Run tests
uv run pytest

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

Built with:


Created by Luca Simone

About

A minimalist Python web framework inspired by serverless architectures. Build APIs with a single function, powered by Starlette and Uvicorn. 🌟

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages