Skip to content

Aksara Framework

Async Python Backend — ORM, Auto-REST, AI Console, and MCP Tools in One Framework

Aksara is a Python backend framework that ships with everything you need to go from an empty directory to a running, AI-ready API. Define your models, get a full REST API, an admin interface, a visual Studio dashboard, an interactive AI Console, and auto-generated MCP tools — all from the same codebase.

Get Started → View on GitHub

Aksara CLI demo — from scaffold to running app in seconds


What is Aksara?

Aksara gives you everything out of the box:

What You Get How
Async ORM Define Python models → Aksara creates database tables and handles all SQL
Auto REST API One ModelViewSet class → full CRUD endpoints with pagination and validation
Real-Time Streams Every ModelViewSet can expose GET /<prefix>/stream for live model events
Built-in Admin Browse and edit your data at /admin with zero configuration
Studio UI Visual dashboard at /studio/ui — inspect models, routes, queries, and migrations
AI Console Natural-language interface inside Studio — ask questions about your data, routes, and schema in plain English
AI Review Tools Run AI Debugger, Architecture Review, and Performance Analyzer against the same live project context
MCP Tools Your models become MCP tools automatically — connect any MCP-compatible AI agent
Doctor & Fix Plans aksara doctor checks app health and aksara doctor fix-plan prints the remediation path
Migration System Schema changes tracked and applied with aksara migrate
TypeScript SDKs aksara generate sdk --language typescript emits a fetch-ready frontend client
Native Multi-Tenancy TenantModel and PostgreSQL RLS keep tenant data isolated at the database layer

Who is Aksara For?

Aksara is for Python developers who:

  • ✅ Want a complete backend stack, not just a web framework
  • ✅ Need async PostgreSQL without writing raw SQL
  • ✅ Like Django's ergonomics but want FastAPI's async performance
  • ✅ Want their data instantly accessible to AI agents via MCP
  • ✅ Value built-in tooling (Studio, AI Console, Doctor) over plugin sprawl

You don't need:

  • ❌ Previous Django or FastAPI experience
  • ❌ Deep database knowledge
  • ❌ To configure AI integrations from scratch

How Does It Work?

You write this:                    You get this:

┌──────────────────────┐           ┌──────────────────────┐
│ class Task(Model):   │           │ Database table       │
│   title = String()   │    ──►    │ with columns         │
│   completed = Bool() │           │                      │
└──────────────────────┘           └──────────────────────┘

┌──────────────────────┐           ┌──────────────────────┐
│ class TaskViewSet(   │           │ REST API endpoints:  │
│   ModelViewSet):     │    ──►    │ GET  /tasks/         │
│   model = Task       │           │ POST /tasks/         │
└──────────────────────┘           │ GET  /tasks/{id}/    │
                                   │ PUT  /tasks/{id}/    │
                                   │ DELETE /tasks/{id}/  │
                                   └──────────────────────┘

In ~10 lines of code, you get:

  • A database table
  • A complete REST API
  • Input validation
  • Interactive documentation
  • Admin interface

Quick Example

Here's a complete working API:

# main.py
from aksara import Aksara, Model, fields
from aksara.api import ModelViewSet

# 1. Define your data structure
class Task(Model):
    """A task in a todo list."""
    title = fields.String(
        max_length=200,
        ai_description="Short title describing the task",
    )
    completed = fields.Boolean(
        default=False,
        ai_description="Whether the task has been finished",
    )
    created_at = fields.DateTime(auto_now_add=True)

# 2. Create the API
class TaskViewSet(ModelViewSet):
    model = Task

# 3. Start the app
app = Aksara(database_url="postgresql://localhost/myapp")
app.include_viewset(TaskViewSet, prefix="/tasks")

Run it:

aksara dbsetup    # Set up the database interactively
aksara migrate    # Create the database table
aksara dev        # Start the development server

Test it:

# Create a task
curl -X POST http://localhost:8000/tasks/ \
  -H "Content-Type: application/json" \
  -d '{"title": "Learn Aksara"}'

# List all tasks
curl http://localhost:8000/tasks/

Once running, open http://localhost:8000/studio/ui to explore your models and queries in the built-in Studio dashboard. The ai_description metadata you wrote above flows through to the AI Console and to the MCP tool catalog at /ai/tools/mcp — no second schema required.


Key Features

🗄️ Database Without SQL

Define your data as Python classes. Aksara handles the SQL.

class Article(Model):
    title = fields.String(max_length=200)
    content = fields.Text()
    published = fields.Boolean(default=False)
    created_at = fields.DateTime(auto_now_add=True)

# Query without SQL
articles = await Article.objects.filter(published=True).order_by("-created_at")

What this means: You work with Python objects, not database queries.

👉 Learn about Models


⚡ Fast Async Performance

Every database call is non-blocking. Your app can handle many requests at once.

# All database calls use await
article = await Article.objects.get(id=article_id)
articles = await Article.objects.filter(published=True)

What this means: Your server doesn't freeze while waiting for the database.


🔌 Automatic API Creation

One class creates a complete REST API with all standard operations.

class ArticleViewSet(ModelViewSet):
    model = Article
    permission_classes = [IsAuthenticated]

What you get automatically:

Method URL What It Does
GET /articles/ List all articles
POST /articles/ Create an article
GET /articles/{id}/ Get one article
PUT /articles/{id}/ Update an article
DELETE /articles/{id}/ Delete an article

👉 Learn about ViewSets


🔒 Built-in Security

Control who can access what with simple permission classes.

from aksara.permissions import IsAuthenticated, IsAdminUser

class ArticleViewSet(ModelViewSet):
    model = Article
    permission_classes = [IsAuthenticated]  # Must be logged in

What this means: Unauthorized requests are automatically rejected.

👉 Learn about Security


🤖 AI Agent Integration

Make your application accessible to AI assistants like ChatGPT.

from aksara.ai import build_full_ai_context

# Export your entire app as structured data for AI
context = await build_full_ai_context(app)

What this means: AI agents can understand and interact with your data.

The same AI layer also powers the built-in Studio AI Console, the Architecture Review, and the Performance Analyzer, so you do not have to maintain separate schemas for internal tooling and external agents.

👉 Learn about AI Mode


🛠️ Admin Dashboard

A built-in interface to view and manage your data.

app = Aksara(
    database_url="postgresql://localhost/myapp",
    enable_admin=True,  # Enable admin at /admin/
)

What you get: A web interface to browse, create, edit, and delete data.

👉 Learn about Admin


Installation

pip install aksara-framework

Requirements:

Tool Minimum Version What It's For
Python 3.11 Running Aksara
PostgreSQL 13 Storing your data

👉 Full Installation Guide


Next Steps


What's New in v0.5.54

  • Bulk write preparationbulk_create() now prepares rows before insert, applies auto-managed timestamps, runs field preparation hooks such as Slug(auto_from=...), and preserves mixed implicit/explicit auto_now_add values.
  • Explicit update timestamp policyQuerySet.update() now refreshes auto_now fields such as updated_at when regular fields change, while respecting explicit updated_at values.
  • Vector bulk updatesbulk_update() now casts Vector CASE branch values with CAST($n AS vector).
  • Relation action safetyForeignKey and OneToOne now normalize and validate on_delete actions before DDL generation.
  • SET_NULL compatibility noteSET_NULL / SET NULL now requires nullable=True.
  • Relation contracts — custom through models fail clearly while unsupported, and forward FK/O2O attributes are documented as stored id access; use explicit queries or select_related() plus get_related() for objects.

Full changelog →


Getting Help