# NeutronAPI
**High-performance Python framework built directly on uvicorn with built-in database models, migrations, and background tasks. If you want Django if it was built async-first, this is for you.**
Batteries included async API framework with command-line management.
## Installation
```bash
pip install neutronapi
```
## Quick Start
```bash
# 1. Create project
neutronapi startproject blog
cd blog
# 2. Create an app
python manage.py startapp posts
# 3. Start server
python manage.py start # Dev mode (auto-reload)
# 4. Test
python manage.py test
```
## Getting Started Tutorial
**1. Create Project**
```bash
neutronapi startproject blog
cd blog
```
**2. Create App Module**
```bash
python manage.py startapp posts
```
**3. Configure in `apps/settings.py`**
```python
import os
# ASGI application entry point (required for server)
ENTRY = "apps.entry:app" # module:variable format
# Database
DATABASES = {
'default': {
'ENGINE': 'aiosqlite',
'NAME': 'db.sqlite3',
}
}
```
**4. Create API in `apps/posts/api.py`**
```python
from neutronapi.base import API
class PostAPI(API):
resource = "/posts"
name = "posts"
@API.endpoint("/", methods=["GET"])
async def list_posts(self, scope, receive, send, **kwargs):
posts = [{"id": 1, "title": "Hello World"}]
return await self.response(posts)
@API.endpoint("/", methods=["POST"])
async def create_post(self, scope, receive, send, **kwargs):
# Get request data from scope["body"]
return await self.response({"id": 2, "title": "New Post"})
```
**5. Register API in `apps/entry.py`**
```python
from neutronapi.application import Application
from apps.posts.api import PostAPI
app = Application(apis=[
PostAPI() # resource = "/posts" defined in class
])
```
**6. Start Server**
```bash
python manage.py start
# Visit: http://127.0.0.1:8000/posts
```
## Project Structure
```
myproject/
├── manage.py # Management commands
├── apps/
│ ├── __init__.py
│ ├── settings.py # Configuration
│ └── entry.py # ASGI application
└── db.sqlite3 # Database
```
## Background Tasks
```python
from neutronapi.background import Task, TaskFrequency
from neutronapi.base import API
from neutronapi.application import Application
class CleanupTask(Task):
name = "cleanup"
frequency = TaskFrequency.MINUTELY
async def run(self, **kwargs):
print("Cleaning up logs...")
class PingAPI(API):
resource = "/ping"
@API.endpoint("/", methods=["GET"])
async def ping(self, scope, receive, send, **kwargs):
return await self.response({"status": "ok"})
# Add to application
app = Application(
apis=[PingAPI()],
tasks={"cleanup": CleanupTask()}
)
```
## Database Models
```python
from neutronapi.db.models import Model
from neutronapi.db.fields import CharField, IntegerField, DateTimeField
class User(Model):
name = CharField(max_length=100)
age = IntegerField()
created_at = DateTimeField(auto_now_add=True)
```
## Server Commands
```bash
# Development (auto-reload, localhost)
python manage.py start
# Production (multi-worker, optimized)
python manage.py start --production
# Custom configuration
python manage.py start --host 0.0.0.0 --port 8080 --workers 4
```
## Testing
```bash
# SQLite (default)
python manage.py test
# Specific tests
python manage.py test app.tests.test_models.TestUser.test_creation
```
## Commands
```bash
python manage.py start # Start server
python manage.py test # Run tests
python manage.py migrate # Run migrations
python manage.py startapp posts # Create new app
```
Raw data
{
"_id": null,
"home_page": null,
"name": "neutronapi",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "api, framework, async, django, fastapi, uvicorn, orm, migrations, background-tasks",
"author": null,
"author_email": "Aaron Kazah <aaron@neutronapi.com>",
"download_url": "https://files.pythonhosted.org/packages/7e/e5/131b83f12b1011fd3b340ac508ad490d176780d0b13cc792da77492eca96/neutronapi-0.1.2.tar.gz",
"platform": null,
"description": "# NeutronAPI\n\n**High-performance Python framework built directly on uvicorn with built-in database models, migrations, and background tasks. If you want Django if it was built async-first, this is for you.**\n\nBatteries included async API framework with command-line management.\n\n## Installation\n\n```bash\npip install neutronapi\n```\n\n## Quick Start\n\n```bash\n# 1. Create project\nneutronapi startproject blog\ncd blog\n\n# 2. Create an app\npython manage.py startapp posts\n\n# 3. Start server \npython manage.py start # Dev mode (auto-reload)\n\n# 4. Test\npython manage.py test\n```\n\n## Getting Started Tutorial\n\n**1. Create Project**\n```bash\nneutronapi startproject blog\ncd blog\n```\n\n**2. Create App Module** \n```bash\npython manage.py startapp posts\n```\n\n**3. Configure in `apps/settings.py`**\n```python\nimport os\n\n# ASGI application entry point (required for server)\nENTRY = \"apps.entry:app\" # module:variable format\n\n# Database\nDATABASES = {\n 'default': {\n 'ENGINE': 'aiosqlite',\n 'NAME': 'db.sqlite3',\n }\n}\n```\n\n**4. Create API in `apps/posts/api.py`**\n```python\nfrom neutronapi.base import API\n\nclass PostAPI(API):\n resource = \"/posts\"\n name = \"posts\"\n \n @API.endpoint(\"/\", methods=[\"GET\"])\n async def list_posts(self, scope, receive, send, **kwargs):\n posts = [{\"id\": 1, \"title\": \"Hello World\"}]\n return await self.response(posts)\n \n @API.endpoint(\"/\", methods=[\"POST\"])\n async def create_post(self, scope, receive, send, **kwargs):\n # Get request data from scope[\"body\"]\n return await self.response({\"id\": 2, \"title\": \"New Post\"})\n```\n\n**5. Register API in `apps/entry.py`**\n```python\nfrom neutronapi.application import Application\nfrom apps.posts.api import PostAPI\n\napp = Application(apis=[\n PostAPI() # resource = \"/posts\" defined in class\n])\n```\n\n**6. Start Server**\n```bash\npython manage.py start\n# Visit: http://127.0.0.1:8000/posts\n```\n\n## Project Structure\n\n```\nmyproject/\n\u251c\u2500\u2500 manage.py # Management commands\n\u251c\u2500\u2500 apps/\n\u2502 \u251c\u2500\u2500 __init__.py\n\u2502 \u251c\u2500\u2500 settings.py # Configuration \n\u2502 \u2514\u2500\u2500 entry.py # ASGI application\n\u2514\u2500\u2500 db.sqlite3 # Database\n```\n\n## Background Tasks\n\n```python\nfrom neutronapi.background import Task, TaskFrequency\nfrom neutronapi.base import API\nfrom neutronapi.application import Application\n\nclass CleanupTask(Task):\n name = \"cleanup\"\n frequency = TaskFrequency.MINUTELY\n \n async def run(self, **kwargs):\n print(\"Cleaning up logs...\")\n\nclass PingAPI(API):\n resource = \"/ping\"\n \n @API.endpoint(\"/\", methods=[\"GET\"])\n async def ping(self, scope, receive, send, **kwargs):\n return await self.response({\"status\": \"ok\"})\n\n# Add to application \napp = Application(\n apis=[PingAPI()],\n tasks={\"cleanup\": CleanupTask()}\n)\n```\n## Database Models\n\n```python\nfrom neutronapi.db.models import Model\nfrom neutronapi.db.fields import CharField, IntegerField, DateTimeField\n\nclass User(Model):\n name = CharField(max_length=100)\n age = IntegerField()\n created_at = DateTimeField(auto_now_add=True)\n```\n\n## Server Commands\n\n```bash\n# Development (auto-reload, localhost)\npython manage.py start\n\n# Production (multi-worker, optimized) \npython manage.py start --production\n\n# Custom configuration\npython manage.py start --host 0.0.0.0 --port 8080 --workers 4\n```\n\n## Testing\n\n```bash\n# SQLite (default)\npython manage.py test\n\n\n# Specific tests\npython manage.py test app.tests.test_models.TestUser.test_creation\n```\n\n## Commands\n\n```bash\npython manage.py start # Start server\npython manage.py test # Run tests \npython manage.py migrate # Run migrations\npython manage.py startapp posts # Create new app\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "High-performance Python framework built directly on uvicorn with built-in database models, migrations, and background tasks. Django if it was built async-first.",
"version": "0.1.2",
"project_urls": null,
"split_keywords": [
"api",
" framework",
" async",
" django",
" fastapi",
" uvicorn",
" orm",
" migrations",
" background-tasks"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "5c0432efc6ad97ae3fbdc91a2b9a2d262185ae1b75b82f6d68ad7e511429efa8",
"md5": "b343035f4b5a0c3b986622bac8b3ffc8",
"sha256": "acd321d848fa1fbe519ae61bfd72ca10753549ba68d8ad72a689ba0a4a1108b5"
},
"downloads": -1,
"filename": "neutronapi-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b343035f4b5a0c3b986622bac8b3ffc8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 88984,
"upload_time": "2025-08-20T12:50:10",
"upload_time_iso_8601": "2025-08-20T12:50:10.238392Z",
"url": "https://files.pythonhosted.org/packages/5c/04/32efc6ad97ae3fbdc91a2b9a2d262185ae1b75b82f6d68ad7e511429efa8/neutronapi-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7ee5131b83f12b1011fd3b340ac508ad490d176780d0b13cc792da77492eca96",
"md5": "c934926a2dff5cd4ab791c8dcd6013e9",
"sha256": "6a7a9a093cfd764746654ba7ee00effeb1baecf813983353a29f220458e0561e"
},
"downloads": -1,
"filename": "neutronapi-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "c934926a2dff5cd4ab791c8dcd6013e9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 76879,
"upload_time": "2025-08-20T12:50:12",
"upload_time_iso_8601": "2025-08-20T12:50:12.434196Z",
"url": "https://files.pythonhosted.org/packages/7e/e5/131b83f12b1011fd3b340ac508ad490d176780d0b13cc792da77492eca96/neutronapi-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-20 12:50:12",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "neutronapi"
}