๐ NasirPy Framework
๐ฏ Purpose
NasirPy was created with the goal of deeply understanding how Python web frameworks work internally. Every component is built from scratch to demonstrate core concepts that power modern web frameworks.
Perfect for Learning
This framework is designed for developers who want to understand the internals of web frameworks like FastAPI, Flask, and Django.
โจ What You'll Learn
-
HTTP Server Implementation
Learn how web servers handle HTTP requests and responses at the protocol level.
-
Routing Mechanisms
Understand URL pattern matching, parameter extraction, and route registration.
-
Middleware Architecture
Discover how middleware chains process requests and responses.
-
ASGI/WSGI Concepts
Compare synchronous and asynchronous web server interfaces.
๐ Quick Example
Here's how simple it is to create an API with NasirPy:
from nasirpy import App, Response
app = App()
@app.get("/")
async def hello_world():
return Response({"message": "Hello, World!"})
@app.get("/users/{user_id}")
async def get_user(request):
user_id = request.path_params["user_id"]
return Response({"user_id": user_id, "name": f"User {user_id}"})
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="127.0.0.1", port=8000)
๐ Educational Components
Core Features Implemented
- [x] HTTP Server - Built from scratch to understand request handling
- [x] Routing System - URL pattern matching and parameter extraction
- [x] Middleware Chain - Request/response processing pipeline
- [x] Request Parsing - HTTP request body and header parsing
- [x] Response Formatting - JSON and HTML response generation
- [x] Error Handling - Exception management and error responses
Learning Resources
Each component comes with detailed explanations:
- ๐ Inline Documentation - Every function and class is documented
- ๐ Code Comments - Explaining the "why" behind implementation choices
- ๐ Conceptual Guides - Understanding web framework patterns
- ๐งช Working Examples - Real applications you can run and modify
๐ ๏ธ Installation
Get started in seconds:
Or for development:
๐ Documentation Structure
-
Getting Started
Installation, quick start, and your first application
-
Core Concepts
Deep dive into framework architecture and design patterns
Coming soon - Core concepts documentation
-
API Reference
Complete reference for all classes and methods
Coming soon - API reference documentation
-
Examples
Real-world applications and use cases
Coming soon - Example applications
๐ค Contributing
This is an educational project! Contributions are welcome:
- ๐ Bug Reports - Help improve the framework
- ๐ Documentation - Make learning easier for others
- ๐ก Examples - Share your educational use cases
- ๐ Learning Content - Add tutorials and explanations
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.