https://github.com/lukefx/stardust
A minimalist Python web framework inspired by serverless architectures. Build APIs with a single function, powered by Starlette and Uvicorn. 🌟
https://github.com/lukefx/stardust
api async backend fastapi lambda microservices minimalist python python3 rest-api serverless starlette uvicorn web-framework webdev
Last synced: 6 months ago
JSON representation
A minimalist Python web framework inspired by serverless architectures. Build APIs with a single function, powered by Starlette and Uvicorn. 🌟
- Host: GitHub
- URL: https://github.com/lukefx/stardust
- Owner: lukefx
- License: mit
- Created: 2020-11-14T09:43:44.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-11-09T19:31:43.000Z (11 months ago)
- Last Synced: 2025-03-28T17:36:14.233Z (7 months ago)
- Topics: api, async, backend, fastapi, lambda, microservices, minimalist, python, python3, rest-api, serverless, starlette, uvicorn, web-framework, webdev
- Language: Python
- Homepage:
- Size: 91.8 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Stardust 🌟
[](https://badge.fury.io/py/stardust)
[](https://pypi.org/project/stardust/)
[](https://opensource.org/licenses/MIT)A micro web framework inspired by serverless and lambda deployments, designed for simplicity and efficiency.
## Table of Contents
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Features](#features)
- [Usage Examples](#usage-examples)
- [Development](#development)
- [Contributing](#contributing)
- [License](#license)## Installation
Install Stardust using pip:
```bash
pip install stardust
```Requires Python 3.10 or higher.
## Quick Start
Create a simple API in seconds with `app.py`:
```python
async def serve(req):
return {"hello": "world"}
```Run your application:
```bash
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
```python
async def serve(req):
return {"message": "Hello, World!"}
```### Plain Text Response
```python
from starlette.responses import PlainTextResponseasync def serve(req):
return PlainTextResponse("Hello, World!")
```### Query Parameters
```python
async def serve(req):
name = req.query_params.get("name", "world")
return {"hello": name}
```### POST Request Handler
```python
async def serve(req):
body = await req.json()
return body # Echo back the request body
```### Custom Status Codes
```python
from starlette.responses import Responseasync def serve(req):
return Response(status_code=204)
```## Command Line Options
```bash
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:
```bash
# 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:
- [Starlette](https://www.starlette.io/)
- [Uvicorn](https://www.uvicorn.org/)---
Created by [Luca Simone](mailto:info@lucasimone.info)