Models and migrations
A Django-style ORM with lazy, chainable QuerySets, __ lookups across relations,
F/Q expressions, aggregation and autodetected migrations. One codebase runs on
D1, SQLite and Postgres.
Ghuri gives you the shape of Django (settings, installed apps, models with managers,
migrations, urls.ts, class-based views, an admin, a REST framework, GraphQL) written in strict
TypeScript and built on Hono and Drizzle.
A new project runs on Cloudflare Workers with D1, R2 and KV. That costs close to nothing
while you find out whether anyone wants what you are building. When you outgrow it, point
DATABASES at Postgres, run ghuri migrate, copy your data with ghuri dumpdata and
ghuri loaddata, and deploy the same code to Node on any VPS or container platform.
import { Model, CharField, TextField, DateTimeField, ForeignKey, CASCADE } from '@ghuri/orm'import { User } from '@ghuri/auth'
export class Post extends Model({ title: new CharField({ maxLength: 200 }), body: new TextField({ blank: true }), author: new ForeignKey(() => User, { onDelete: CASCADE, relatedName: 'posts' }), createdAt: new DateTimeField({ autoNowAdd: true }),}) { static Meta = { ordering: ['-createdAt'] } toString() { return this.title }}
const recent = await Post.objects .filter({ author__username: 'rifat', title__icontains: 'workers' }) .selectRelated('author') .slice(0, 10)Models and migrations
A Django-style ORM with lazy, chainable QuerySets, __ lookups across relations,
F/Q expressions, aggregation and autodetected migrations. One codebase runs on
D1, SQLite and Postgres.
The admin
admin.site.register(Post) gives you a server-rendered admin with search, filters,
inlines, bulk actions and permissions. It runs on Workers with no build step.
REST framework
Serializers, viewsets, routers, permissions, pagination, filtering, throttling and an OpenAPI 3.1 schema. If you know DRF you already know the API.
GraphQL
graphene-django style types from your models, Relay connections with filters, mutations that reuse your REST serializers and permissions, DataLoaders and GraphiQL.
Auth
Users, groups and permissions, sessions, tokens and JWT. Password hashes use Django’s
pbkdf2_sha256 format, so you can bring your existing users with you.
Storage
FileField and ImageField backed by R2 on Cloudflare, or S3, MinIO or the local
filesystem anywhere else.
Social login
Log in with GitHub, Google, Facebook, Microsoft and any OpenID Connect provider, like django-allauth, or build your own flows with Passport-style strategies.
WebSockets
Channels-style consumers routed in urls.ts, with rooms on Durable Objects that hibernate
while idle. Send to any room from a view, a signal or a cron job.
sendMail() and EmailMessage from django.core.mail, sent through Cloudflare Email
Service, Resend or SMTP, with a test outbox.
Multi-tenancy
Tenant-scoped models and QuerySets that fail closed, with the tenant found from a subdomain, a custom domain or a header.
AI agents and MCP
Turn models and viewsets into agent tools that respect your permissions, and expose them to any MCP client with one URL pattern.
Create a project. The default template targets Cloudflare Workers with D1 and R2.
npm create ghuri@latest mysitecd mysiteCreate the database tables and an admin user. This runs against a local D1 database that Wrangler simulates on your machine.
npx ghuri migratenpx ghuri createsuperuserStart the development server.
npm run devOpen http://localhost:8787/admin/ and sign in. Add your first app with
npx ghuri startapp blog; it is added to INSTALLED_APPS for you.
The only lines that change when you leave Cloudflare are in settings.ts and the entry file.
DATABASES: { default: d1('DB') },STORAGES: { default: r2('MEDIA') },CACHES: { default: env.CACHE ? kvCache('CACHE') : memoryCache() },DATABASES: { default: postgres({ url: env.DATABASE_URL }) },STORAGES: { default: s3({ endpoint, bucket, accessKeyId, secretAccessKey }) },CACHES: { default: memoryCache() },