Skip to content

Repository files navigation

Ellar - Modern Python ASGI Framework

Ellar Logo

TestCoveragePyPI versionPyPI versionPyPI version

Overview

Ellar is a modern, fast, and lightweight ASGI framework for building scalable web applications and APIs with Python. Built on top of Starlette and inspired by the best practices of frameworks like NestJS, Ellar combines the power of async Python with elegant architecture patterns.

✨ Key Features

  • 🚀 High Performance: Built on ASGI standards for maximum performance and scalability
  • 💉 Dependency Injection: Built-in DI system for clean and maintainable code architecture
  • 🔍 Type Safety: First-class support for Python type hints and Pydantic validation
  • 📚 OpenAPI Integration: Automatic Swagger/ReDoc documentation generation
  • 🏗️ Modular Architecture: Organize code into reusable modules inspired by NestJS
  • 🔐 Built-in Security: Comprehensive authentication and authorization system
  • 🎨 Template Support: Integrated Jinja2 templating for server-side rendering
  • 🔌 WebSocket Support: Real-time bidirectional communication capabilities
  • 🧪 Testing Utilities: Comprehensive testing tools for unit and integration tests

🚀 Quick Start

Installation

pip install ellar

Basic Example

fromellar.commonimportget, Controller, ControllerBasefromellar.appimportAppFactoryimportuvicorn@Controller()classHomeController(ControllerBase):
@get('/')asyncdefindex(self):
return {'message': 'Welcome to Ellar Framework!'}
app=AppFactory.create_app(controllers=[HomeController])
if__name__=="__main__":
uvicorn.run("main:app", port=5000, reload=True)

📚 Complete Example

fromellar.commonimportBody, Controller, ControllerBase, delete, get, post, put, Serializerfromellar.diimportinjectable, request_scopefromellar.appimportAppFactoryfrompydanticimportField# Define Data ModelclassCreateCarSerializer(Serializer):
name: stryear: int=Field(..., gt=0)
model: str# Define Service@injectable(scope=request_scope)classCarService:
def__init__(self):
self.detail='car service'# Define Controller@ControllerclassCarController(ControllerBase):
def__init__(self, service: CarService):
self._service=service@post()asyncdefcreate(self, payload: Body[CreateCarSerializer]):
result=payload.dict()
result.update(message='Car created successfully')
returnresult@get('/{car_id:str}')asyncdefget_one(self, car_id: str):
returnf"Retrieved car #{car_id}"app=AppFactory.create_app(
controllers=[CarController],
providers=[CarService]
)

🔧 Requirements

  • Python >= 3.8
  • Starlette >= 0.27.0
  • Pydantic >= 2.0
  • Injector >= 0.19.0

📖 Documentation

🤝 Contributing

We welcome contributions! Here's how you can help:

  • Create an issue for bugs or feature requests
  • Submit pull requests for improvements
  • Create third-party modules
  • Share your experience with Ellar
  • Build and showcase your applications

See CONTRIBUTING.md for detailed guidelines.

📝 License

Ellar is MIT Licensed.

👤 Author

Ezeudoh Tochukwu @eadwinCode

About

Ellar is a lightweight ASGI framework for building efficient and scalable server-side python applications. It supports both OOP (Object-Oriented Programming) and FP (Functional Programming). Built with passion for programming

Topics

Resources

Code of conduct

Stars

68 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages