This guide takes you from zero to a running Kirak API in about five minutes. By the end, you will have a project with CRUD endpoints, JWT authentication, and a working database migration.
Kirak includes FastAPI, JWT authentication, GraphQL, and the CLI out of the box. Database drivers are optional extras so you only install what you need.
Run one of the following commands based on your chosen database:
For SQLite (Zero setup / local file):
Terminal window
pipinstallkirak
— or —
For PostgreSQL (Production):
Terminal window
pipinstall"kirak[postgres]"
— or —
For MySQL (Production):
Terminal window
pipinstall"kirak[mysql]"
— or —
For All Database Drivers (CI / Testing):
Terminal window
pipinstall"kirak[all-databases]"
Verify your installation:
Terminal window
kirak--help
[!IMPORTANT]
Database Drivers Are Not Bundled by Plain pip install kirak (Except SQLite)
Running a plain pip install kirak installs the core framework and CLI, but does not bundle network database drivers.
SQLite is the only database that works out of the box with plain pip install kirak (its driver is built into the Python standard library).
For PostgreSQL or MySQL, you MUST explicitly install your preferred database driver. If you run a plain pip install kirak, you must explicitly install the corresponding driver extra (pip install "kirak[postgres]" or pip install "kirak[mysql]") before running migrations or connecting to your database. Otherwise, Kirak halts with database_driver_not_installed.
kirak.json is your application’s control plane. It configures the runtime environment, enabled modules, network security, authentication behavior, and database connection settings.
Activate Production Features Without Boilerplate:
Want cloud file storage, background jobs, or AI chat? Add "storage", "scheduler", or "ai" to "modules": []. Kirak automatically mounts their endpoints, runs required internal migrations, and exposes their Python SDK methods.
Control Security & Access Centrally:
Keep all non-secret security rules in one place: CORS whitelists, rate-limit thresholds, and JWT expiration windows. No scattered middleware files to maintain.
Customize URL Routes:
Add a "routes" block to prefix all CRUD endpoints (e.g. "crud_prefix": "/api/v1"), rebrand auth endpoints ("auth_prefix": "/auth"), or remap module paths (e.g. "module_prefixes": {"payments": "/billing"}).
Environment Overrides with kirak.local.json:kirak.json is committed to version control and shared across your team. For settings that differ on your local machine (such as a local database port or frontend test URL), create an optional kirak.local.json next to it. Kirak merges kirak.local.json over kirak.json at startup.
Tip (Using SQLite): If you selected SQLite, the database file is managed locally. You can leave DB_PASSWORD blank or omit it entirely; SQLite only requires KIRAK_AUTH_JWT_SECRET_KEY and KIRAK_AUTH_VERIFICATION_KEY.
Kirak is a declarative runtime, not a code generator. You describe your models and permissions in JSON, and Kirak mounts the entire API dynamically:
flowchartLR
subgraphRepo["Your Repository"]
M["models/*.json<br/>(Schema & Access)"]
K["kirak.json<br/>(Config & Modules)"]
H["src/*.py<br/>(Custom Logic)"]
end
subgraphRuntime["Kirak Engine (FastAPI)"]
E["CRUD & GraphQL Engine"]
A["Built-in Auth System"]
R["Row-Level Security (RLS)"]
end
subgraphOutput["Auto-Served API"]
API["REST Endpoints<br/>(/fetch, /create, etc.)"]
DOCS["GET /docs & /openapi.json"]
end
Repo -->Runtime
Runtime -->Output
Runtime-Managed Fields: Never define id, created_at, updated_at, or deleted_at. Kirak automatically creates and maintains these columns on every table.
Built-in Auth Tables: users, auth_tokens, auth_social, and auth_mfa are managed by Kirak Core. You do not define them in models/.
Data Schema vs. Access Policy:
"schema" declares data types and constraints.
"access" declares granular role-based permissions and row-level security (RLS).
Ownership Injection: Notice "condition": "user_id = {user_id}" on create. Kirak automatically reads user_id from the caller’s verified JWT and injects it into the insert statement, preventing callers from spoofing other users’ IDs.
The migration generates DDL sections for MySQL, PostgreSQL, and SQLite; Kirak automatically runs only the section matching your configured database.type.
Important — Check Your Server Terminal Log:
Kirak requires email verification before allowing a user to log in (403 EMAIL_NOT_VERIFIED).
In a newly scaffolded project without a cloud notification provider enabled, Kirak automatically prints the verification link to the terminal running Uvicorn:
[kirak] No verification email was sent for alice@example.com. Open this link to verify the account:
http://localhost:8000/auth/verify-email?token=...
Copy and open that link in your browser, then press Verify my email to mark Alice’s account as verified before logging in.
Hooks allow you to execute custom Python code before or after any CRUD or authentication event without modifying framework internals.
Open src/hooks.py and implement an after_create hook:
defregister(kirak):
@kirak.on("posts").hook("after_create")
asyncdefafter_post_created(result):
# result contains the full response dict
post_id = result["data"]["id"]
print(f"[HOOK] Post {post_id} was successfully created!")
return result # Always return the result to continue the pipeline
main.py already runs it: it passes register from src/__init__.py as on_kirak_ready, and that calls hooks.register(kirak). New modules (agent tools, routes, scheduler tasks) go next to hooks.py and are called from the same register.
Restart the server and create a post. You will see the hook output logged in your terminal.
Kirak runs anywhere Python does. To share the API without setting up a server, kirak deploy puts the
project on Kirak’s hosting in one command, with no account and no email:
Terminal window
kirakdeploy
Deployed: https://<your-app>...
Claim URL: https://...
Run 'kirak deploy claim-code' to retrieve your claim code.
The deploy runs kirak validate first, sends the project’s files (never .env or kirak.local.json) and
its secrets from .env, and prints the public URL. It also prints:
A claim link. An unclaimed instance is temporary. Open the link, sign in, and enter the 8-character
claim code from kirak deploy claim-code to make the instance yours and keep it running. After five
wrong codes the claim locks; kirak deploy claim-code --new makes a new code and unlocks it.
Custom Python, when the project has Python files other than main.py: until the claim, custom endpoints answer 403 INSTANCE_NOT_CLAIMED, and hooks, tools and tasks do not run. The output gives the file count.
When it expires, while it is unclaimed, and anything an unclaimed instance does not run yet.
Run kirak deploy again from the same folder to update the same instance: the CLI keeps its state in
.kirak/project.json (commit it) and its credentials in .kirak/deploy.json (never commit it; the CLI
adds it to .gitignore). After claiming, kirak login lets you deploy from any machine.
How long an unclaimed instance lives, and what the free tier includes: kirak.io/deploy.
Every option of the command: kirak deploy.