Features
- Fast Performance - Built on asyncio for high performance
- ASGI Compatible - Full ASGI interface support for FastAPI
- Production Ready - Rate limiting, request validation, slowloris protection
- Multi-Worker - Support for multiple worker processes
- Auto-Reload - Development mode with file watching
- Clean Logging - Beautiful uvicorn-style console output
- Security - Header validation, body size limits, IP rate limiting
Security Features
- Max Body Size - Limits request body to prevent DoS attacks
- Header Validation - Validates HTTP headers and rejects invalid requests
- Slowloris Protection - Timeout for header and body reads
- IP Rate Limiting - Limits requests per IP address
Installation
pip install ncorn
Quick Start
ncorn example_app:app
With custom host and port:
ncorn example_app:app --host 0.0.0.0 --port 8080
Multiple workers:
ncorn example_app:app --workers 4
Auto-reload on file changes:
ncorn example_app:app --reload
Configuration
Create a config file:
ncorn config
This creates ncorn.json with default settings. You can edit this file and ncorn will use these settings by default.
Example configuration:
{
"host": "127.0.0.1",
"port": 8000,
"workers": 1,
"reload": false,
"max_body_size": 16777216,
"max_header_size": 8192,
"max_headers_total_size": 65536,
"header_timeout": 30.0,
"body_timeout": 60.0,
"request_timeout": 10.0,
"response_timeout": 10.0,
"keepalive_timeout": 5.0,
"keepalive_requests": 100,
"max_headers": 100,
"max_connections": 1000,
"max_connections_per_ip": 50,
"rate_limit_requests": 100,
"rate_limit_window": 60.0,
"write_buffer_limit": 65536,
"drain_timeout": 1.0,
"ip_whitelist": [],
"ip_blacklist": [],
"enable_security_headers": true,
"waf_max_query_length": 4096
}
Command line options override config file settings.
Example FastAPI App
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
app = FastAPI(title="Example App")
class Item(BaseModel):
name: str
price: float
tax: float | None = None
@app.get("/")
async def root():
return {"message": "Hello from ncorn!"}
@app.get("/health")
async def health():
return {"status": "healthy"}
@app.post("/items")
async def create_item(item: Item):
total = item.price + (item.tax or 0)
return {"name": item.name, "total": total}
Run it:
ncorn example_app:app
License
MIT License - see LICENSE file for details.
Metadata
Release files for ncorn 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ncorn-1.0.2.tar.gz | 21.2 kB | Without provenance | Details for ncorn-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ncorn-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for ncorn-1.0.2-py3-none-any.whl |
Total release size: 47.6 kB
Release files / ncorn-1.0.2.tar.gz
| Download URL | ncorn-1.0.2.tar.gz |
|---|---|
| Size | 21.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
332ad7e68b880d2062f89734a4c23d70f55ec36725ed49315b7326cbd0e9d0d8
|
|
BLAKE2b-256 checksum How to use checksums |
ff35dd87f58da7f875d970945f592426285eb11bae4a9b1af55a66540282c4a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / ncorn-1.0.2-py3-none-any.whl
| Download URL | ncorn-1.0.2-py3-none-any.whl |
|---|---|
| Size | 26.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25f7c685cb6e730f1f0680c3576250fe953cf707ec1177f268d7b0a15da8376f
|
|
BLAKE2b-256 checksum How to use checksums |
749f1493d5e9a63f9917cb37e178cac6b0960c74c815559fb2952169f758ff51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for ncorn 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.