asaka

module
v0.24.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2026 License: MIT

README

Asaka

CI Go Reference

The Go-native Server-Driven Admin for Laravel Go + PostgreSQL (MySQL and SQLite are experimental) + Inertia v3 + React.

Built for Go from day one — not ported from PHP abstractions. Declare a resource once as a plain Go struct and ship a single ~55 MB binary with goroutine-parallel dashboard widgets, O(1) constant-memory streaming CSV, zero-dependency native PDF export, real-time SSE notifications, and drop-in React extensibility.

Live Demo (10,000 PostgreSQL rows) · Website & Docs

Asaka Dashboard

Asaka Orders Table

Why Asaka?

  • Your model's hooks and events run when someone edits in the panel: Bind a resource to a Laravel for Go model (Model: asaka.Model[models.Order]()) and every create, edit, inline edit, delete, bulk delete, soft delete and restore goes through model.Create / model.Update / model.Delete. Your Creating / Updating / Deleting hooks run and your model.Created / Updated / Deleted listeners fire, just as they do for writes in your own handlers. Integer, UUID and ULID primary keys work. See Models, hooks and events for the writes that do not dispatch events.
  • Built for Go, not ported from PHP: No trait hierarchies, magic containers, or Livewire compatibility layers — just plain, type-safe Go structs you can read in minutes.
  • Single static binary: go build produces one binary with no PHP-FPM, Node runtime, headless Chromium, or Redis required for core features. The author runs it on a small VPS and has seen roughly 30–55 MB of idle RAM there; this is an observation, not something CI measures.
  • Young, PostgreSQL-first: First public release 2026-12-03. PostgreSQL is the primary target; MySQL and SQLite are experimental (see Status). Includes asaka:doctor schema checks and the asakatest helpers. The Playwright E2E suite lives in the separate asaka-demo repository and is not run by this repository's CI.
  • Built for AI-assisted development: Flat Go struct schemas, fast Go rebuilds, and a bundled Agent Skill (.agents/skills/asaka) let coding agents scaffold complete resources accurately.
  • Drop-in React ecosystem: Declare 90% of your admin in Go, and plug any React component (shadcn/ui, TanStack, Recharts, WarpUI) into fields, widgets, or custom pages in 10 lines via registerAsakaField / registerAsakaWidget.

Status and tested databases

Asaka is young: the first public release was on 2026-12-03, so expect rough edges and API changes between minor versions.

What CI runs on every push to main and every pull request:

  • go vet ./... and go test -race ./... (unit tests; no database is involved).
  • Real-database smoke tests (TestRealDB in asaka/realdb_test.go) against PostgreSQL 16, MySQL 8.4, and SQLite, each in its own job. They mount a panel on a real database and drive it over HTTP: list, search, sort, create, update, delete, soft delete, bulk delete, CSV export, CSV import, and database notifications. They are skipped unless ASAKA_TEST_DRIVER and ASAKA_TEST_DSN are set.

Measured coverage: as of 2026-12-05, go test -cover ./asaka/... reports 59.0% of statements for asaka and 97.7% for asaka/asakatest, without a database (the real-database tests are skipped). Treat these as a snapshot, not a guarantee.

Databases

Database Status Notes
PostgreSQL Primary target Smoke tests in CI (PostgreSQL 16). The author's demo and benchmarks run on PostgreSQL 14.
MySQL Experimental Smoke tests in CI (MySQL 8.4) cover only the features listed above.
SQLite Experimental Smoke tests in CI cover only the features listed above.

Known unsupported or untested on MySQL and SQLite. These features are not covered by the smoke tests, and their SQL is still written for PostgreSQL (RETURNING, unnest, to_regclass, ILIKE, NULLS LAST), so expect failures until they are ported and tested:

  • Built-in Auth and Profile pages, and opt-in RBAC tables
  • Relation managers
  • Async CSV export and import jobs (v0.18 ported the notification, export query and no-Model import SQL; they are covered by tests on MySQL and SQLite)
  • Query builder
  • Dashboard widgets that query your tables and global search (Cmd+K)
  • Live-form option creation, drag-and-drop reorder, and restoring soft-deleted rows
  • PDF export with search

Running anything beyond the smoke-tested features on MySQL or SQLite is at your own risk. Bug reports with the failing SQL are welcome.

Backup (experimental, opt-in). WithBackupEnabled(true) exposes GET {prefix}/backup.sql.gz, a gzipped data-only INSERT dump of your registered resource tables (no schema, sequences, indexes or other tables). It is not a replacement for pg_dump / mysqldump. With tenancy configured the dump contains only the current tenant's rows and SkipTenant (shared) resources are excluded; with RBAC enabled only the super-admin role can download it. Reads run in one read-only transaction; if anything fails the archive is left truncated and has no -- Asaka backup complete line. Its tests run on SQLite only.

Access control. Export downloads and per-user jobs (panel.StartJob) are visible only to the user and tenant that created them. Users are told apart by WithNotificationRecipient, else RBAC ResolveUserID, else the built-in Auth user; a panel that cannot tell users apart shares them. Uploaded files are public to anyone who has the (unguessable) URL, and fully public if your web server serves public/ directly.

Highlights

  • Go-Native Superpowers: Built-in asaka.RuntimeWidget() (live heap RAM, goroutines, GC pause, uptime at 0 ms SQL cost), concurrent goroutine widget resolution, O(1) constant-memory streaming CSV export (up to 50k rows via web.Stream), and single-binary deployment (go build).
  • Built for Real Data Volume: Measured once by the author on a VPS running PostgreSQL 14 with 10,000 rows, at up to 1,000 rows per page: ~9 ms LEFT JOIN query, ~11 ms full Dashboard aggregation, ~3.9 ms Cmd+K global search. These numbers are not produced by CI and are not guaranteed on other hardware or databases. Supports O(log N) Cursor / Keyset Pagination (asaka.PaginationCursor) and COUNT(*)-free PaginationSimple, plus experimental DialectMySQL and DialectSQLite dialects.
  • Zero-External-Daemon Stack: Real-time SSE Notifications (EventSource, no polling/Redis required), Native PDF 1.4 Export (table reports & single-record sheets with optional TrueType CJK/UTF-8 embedding, no Chromium/wkhtmltopdf), column-mapped async CSV imports (SAVEPOINTs), built-in Auth/Profile, opt-in RBAC, per-record Policy, Multi-Panel, and Multi-Tenancy UI.
  • Declarative Schema & All 20 Form Fields: Familiar declarative model if you know Filament — CRUD tables, dedicated Create/View (Infolists)/Edit pages, Action Modals & Slide-Overs, Soft Deletes, Relation Managers, Clusters, all 20 form fields (Builder, Repeater, FileUpload, RichEditor, MarkdownEditor, CodeEditor, CustomField, etc.), and server-driven live() reactivity.
  • Global-Ready RTL & Custom i18n: First-class RTL layout (Panel.WithRTL(true) + header LTR/RTL toggle), built-in en / ja / ar dictionaries, and server-side translation overrides.
  • Drop-in React Extensibility: Register any custom React field (registerAsakaField) or dashboard widget (registerAsakaWidget) in 10 lines without touching Asaka core.

Defining a Resource

func OrdersResource() *asaka.Resource {
	statuses := []asaka.Option{
		{Value: "pending", Label: "Pending", Color: "amber"},
		{Value: "processing", Label: "Processing", Color: "sky"},
		{Value: "shipped", Label: "Shipped", Color: "indigo"},
		{Value: "completed", Label: "Completed", Color: "emerald"},
		{Value: "cancelled", Label: "Cancelled", Color: "rose"},
	}

	return &asaka.Resource{
		Slug:          "orders",
		Model:         asaka.Model[models.Order](), // the table, key and timestamps come from the model
		Label:         "Orders",
		SingularLabel: "Order",
		Icon:          "shopping-cart",
		Group:         "Sales & Operations",
		PerPage:       25,
		Columns: []asaka.Column{
			asaka.TextColumn("order_number", "Order #").MakeSortable().MakeSearchable(),
			asaka.BelongsToColumn("customer_id", "Customer", "customers", "company_name").MakeSortable().MakeSearchable(),
			asaka.TextColumn("item_summary", "Line Item").MakeSearchable(),
			asaka.BadgeColumn("status", "Status", statuses).MakeSortable(),
			asaka.MoneyColumn("amount", "Amount").MakeSortable().MakeEditable(),
			asaka.DateColumn("due_date", "Due Date").MakeSortable().MakeEditable(),
		},
		Filters: []asaka.Filter{
			asaka.SelectFilter("status", "Status", statuses),
		},
		Fields: []asaka.Field{
			asaka.TextInput("order_number", "Order Number").MakeRequired().MakeUnique().InSection("Order Information"),
			asaka.BelongsToSelect("customer_id", "Customer", "customers", "company_name").MakeRequired().InSection("Order Information"),
			asaka.TextInput("item_summary", "Line Item").MakeRequired().InSection("Order Information"),
			asaka.SelectInput("status", "Status", statuses).MakeRequired().InSection("Order Information"),
			asaka.NumberInput("amount", "Amount (USD)").MakeRequired().WithMin(1).InSection("Schedule & Notes"),
			asaka.DateInput("due_date", "Due Date").InSection("Schedule & Notes"),
			asaka.TextareaInput("notes", "Delivery Notes").InSection("Schedule & Notes"),
		},
	}
}

System pages

Show what the framework keeps about workflow runs, failed jobs and feature flags (v0.17+). Off by default:

panel.WithSystemPages(asaka.SystemPages{
	Workflows:  true,
	FailedJobs: true,
	Features:   true,
	Authorize: func(r *web.Request, ability string) bool { // required
		return currentUser(r).IsAdmin
	},
	FeatureStore: featureStore, // optional: the same store as FEATURE_STORE, to show stored values
})

Each screen and button has its own ability (system.workflows.cancel, system.jobs.payload, ...). A panel with tenants must say AcrossTenants: true, because these pages show every tenant's data (or, for Workflows only, TenantAttribute: "tenant" to filter runs by an attribute). Batches and the schedule are not shown: the framework has no function to read them from a request.

Approvals with workflows

A row action can resume a Laravel for Go workflow that waits for a decision (v0.16+):

RowActions: []asaka.Action{
	asaka.ResumeAction("approve", "Approve",
		func(rec map[string]any) workflow.Token[workflows.Decision] {
			return workflows.DecisionFor(asaka.RecordInt(rec, "id"))
		},
		workflows.Approved,
	).WithTone("emerald").WithConfirm("Approve this order?").
		WithAuthorize(func(r *web.Request, rec map[string]any) bool { return canApprove(r) }),
},

The button appears on the record's View and Edit pages only while a run waits for that token. Pressing it checks the tenant, the record policy, Authorize and that the run still waits, then calls workflow.Resume. Wait for each token once in your workflow (or put run.ID() in it): with an asynchronous queue, two quick presses can deliver two values. Production needs workflow.CreateTables in a migration and a queue worker.

Queued CSV import & export

By default the asynchronous CSV import and export run in a goroutine of the web process, so a restart loses them. With WithQueuedCSV (v0.18+) they run as jobs of the Laravel for Go queue (asaka.import_csv, asaka.export_csv):

laravel.Options{
	Packages: []laravel.Package{
		asaka.Package(admin.NewPanel().WithQueuedCSV()), // Package, not Mount
	},
}

What you need

  • asaka.Package. Mount alone panics, because only a package can register jobs. Use one asaka.Package for all panels.
  • A queue worker (queue:work) on a real connection. On QUEUE_CONNECTION=sync the job runs inside the request and the request still answers 202.
  • A storage disk shared by the web servers and the workers, and private. The uploaded CSV (asaka/imports/<id>.csv), exports and error-row CSVs (asaka/exports/<name>) live there.
  • schedule:run in cron, for the daily asaka-csv-cleanup that deletes files older than 7 days.
Goroutine (default) Queued (WithQueuedCSV)
Survives a restart or deploy No Yes, the job waits in the queue
Where the CSV and exports live Local folder storage/app/private/asaka-exports The default storage disk, asaka/imports and asaka/exports
Payload In memory Path, mapping and tenant; never the CSV text
Failure Notification only Notification, and the job fails into failed_jobs (retryable)
Retry None queue:retry; a failed import keeps its CSV, a successful one deletes it
Attempts and time One, 2 minutes One (Tries: 1), 2 minutes (Timeout)
Old files Stay Deleted after 7 days by asaka-csv-cleanup
Download route and its checks Owner and tenant, else 404 The same; an older local export is still served

Limits

  • The tenant value must be a string or an integer up to int64 (it travels as text with its kind, so ids above 2^53 are exact). Another type makes the request fail and queues nothing.
  • The job has no request. The tenant is restored for the model hooks and the unique-field checks; the logged-in user and other request context values are not.
  • A job rejects a changed payload (a path that is not asaka/imports/<32 hex>.csv, a tenant column that is not the panel's) and fails permanently without touching storage.
  • A notification that cannot be stored after the import committed is logged and is not a job error, so a retry never imports rows twice.

Uploads on a storage disk

By default the upload route (POST {prefix}/upload, used by FileUploadInput) writes to public/uploads/asaka of the machine that got the request, so a second web server does not have the file. With WithUploadDisk (v0.19+) the files go to a Laravel for Go storage disk, such as s3:

asaka.New("Admin", "/admin").WithUploadDisk("s3") // a name from config.Filesystems.Disks

The file is stored at asaka/uploads/<name> on that disk. The URL does not change: the route still returns /uploads/asaka/<name>, so records and front ends made before the switch keep working, and so does a later change of disk. Files are still served by the same route, behind the panel guard, so a visitor who is not logged in gets neither the file nor a redirect.

What Served how Why
Images and PDF (png, jpg, jpeg, gif, webp, pdf) on a bucket (S3, Laravel Cloud) 302 to Disk.TemporaryURL, valid for 5 minutes The bytes go straight from the bucket, not through your app
Images and PDF on a local disk Streamed by the app, no CSP The framework serves a local disk's temporary URL with a sandbox policy, which stops a PDF from showing
SVG, CSV, txt, json Streamed by the app, never redirected, with attachment, Content-Security-Policy: sandbox and nosniff A bucket cannot send those headers, and an SVG that a browser showed from the bucket would run its script there
A bucket whose TemporaryURL fails Streamed by the app, images and PDF too There is nothing to redirect to
A file that is not on the disk, or a disk that cannot say (S3 403 without ListBucket) Looked for in public/uploads/asaka Files uploaded before the switch
  • One disk per app. Panels share one uploads route, and the first panel serves it. Every panel that sets WithUploadDisk must name the first panel's disk, or asaka.Package refuses to start. With Mount nothing checks this: use the same upload disk on every panel you mount.
  • The disk must be private. A public local disk (Public: true, such as the default public) serves its files at its mount with no guard and no signature, so asaka.Package refuses it. Use local or a disk of your own with Public: false.
  • asaka.Package also refuses a disk name that config.Filesystems.Disks does not have. With Mount there is no config to check, so the first upload or download fails with an error that names WithUploadDisk.
  • The route takes a form of up to 21 MiB (a file is at most 20 MB, so Asaka's own size check answers 422); a bigger one gets 413 from the framework, and the upload field shows "the file is too large".
  • Old local files are served until you copy public/uploads/asaka/* to asaka/uploads/ on the disk. Nothing is moved for you.
  • A temporary URL of a bucket lets whoever holds it fetch the file for 5 minutes.

Sending to the bell from your notifications

If your application already notifies users with Laravel for Go notification (mail, SMS), add the bell as one more channel (v0.20+). asaka.Package registers the channel "asaka"; there is nothing to configure.

// notifications/invoice_paid.go
func (n InvoicePaid) Messages(user *models.User) (notification.Messages, error) {
	return notification.Messages{
		Mail: mails.InvoicePaidEmail{Name: user.Name, InvoiceID: n.Invoice.ID},
		Channels: []any{
			asaka.Bell{
				Title: "Invoice paid",
				Body:  fmt.Sprintf("Invoice #%d", n.Invoice.ID),
				Tone:  "success",
				URL:   fmt.Sprintf("/admin/invoices/%d", n.Invoice.ID), // one action, labelled Label (default "Open")
			},
		},
	}, nil
}

// models/user.go: the same value as the panel's NotificationRecipient
func (u User) AsakaRecipient() string { return strconv.FormatInt(u.ID, 10) }

It is stored like asaka.Notify(...).SendToDatabase(ctx, recipient): a row in asaka_notifications for that user, and a push to the bell.

  • It never goes to everyone. In Asaka an empty recipient means "everyone". A user whose AsakaRecipient() is "" gets no bell message. To notify everyone, call asaka.Notify(...).SendToDatabase(ctx, "") yourself.
  • Refused before it is sent (Bell.Validate): a blank or over 200 character Title, a Body over 65535 bytes, a Label over 100 characters, text that is not UTF-8 or has a NUL, a Tone other than success, warning, danger, info (or empty), an Icon over 64 characters, and a URL that is not empty, a path starting with a single /, or http(s):// (at most 2048 bytes, no user name, no . or .. segment). javascript:, //host and whitespace in a URL are refused, because the bell renders the URL as a link.
  • Run laravel migrate first. In a transaction the table is not created for you (MySQL would commit the transaction), so the send fails until asaka_notifications exists. A panel needs WithNotificationRecipient to show messages for users: asaka:doctor notes a panel without it.
  • Icon is stored, but the bell does not draw it yet.
  • The live toast needs the web process. With notification.Send in a request (or QUEUE_CONNECTION=sync) the user sees the toast at once. From a queue worker the row is stored and appears the next time the user opens the bell or changes page.
  • Test it with notificationtest.New(client): sent.AssertSentTo(user, func(s notificationtest.Sent[notifications.InvoicePaid]) bool { b, ok := s.Message[asaka.Bell](); return ok && b.Tone == "success" }).

Models, hooks and events

Model: asaka.Model[models.Order]() binds a resource to a Laravel for Go model. The table name, primary key type and timestamps are read from the struct, so Table can be left out (if you set it and it differs, Register panics). Without Model, a resource keeps writing with plain SQL, exactly as before.

Panel action With Model Hook Event
Create model.Create Creating model.Created
Edit, inline edit model.Update (only changed columns) Updating model.Updated (none when nothing changed)
Delete, bulk delete model.Delete, one transaction for the bulk delete Deleting model.Deleted for each row
Soft delete, restore model.Update on deleted_at Updating model.Updated (not Deleted)
Force delete model.Delete Deleting model.Deleted
CSV import (sync and async) model.Create per row Creating none by default; set ImportDispatchesEvents: true to dispatch Created
Drag-and-drop reordering plain SQL none none
Relation manager create, edit, attach plain SQL none none
Row and bulk actions your own function whatever it calls whatever it calls
  • Only the columns declared in the resource's Fields are written, plus the tenant column. Form values are converted to the struct's field types (date.Date, numeric.Decimal, uuid.UUID, db.JSON[T], pointers for nullable columns); a value that does not convert is a validation error on that field.
  • Columns of the model that are not in Fields are written by model.Create as the struct's zero value (that is how the framework creates models). Tag columns that should keep their database default db:",default", or make them pointers.
  • A hook that returns an error stops the write. The panel shows the error above the form (HTTP 422), unless the error has a StatusCode() int method, which then decides the status.
  • The tenant scope and the record lookup are one query (model.Query[T]().WhereEq(tenantColumn, tenant).Find(ctx, id)), so another tenant's id is a 404 on the model path too. Per-record policies run as before.
  • With EnableActivityLog, edits, deletes and restores write the activity log in the same transaction as the change. If your activity_logs table has a changes column (text or JSON), each entry also stores the changed columns with their old and new values (updated_at is left out).
  • Primary keys: integer keys work everywhere. UUID (uuid.UUID) and string keys (db:",uuid", db:",ulid") work for the list, view, create, edit, delete, bulk delete, soft delete, restore and cursor pagination. On those resources Register panics if you also use the int64-based Hooks (AfterCreate, BeforeUpdate, AfterUpdate, BeforeDelete, AfterDelete), RowActions, BulkActions, Relations or ReorderColumn; use the model's hooks and events instead.
  • The key column must be named id (the framework's default for the ID field).
  • asaka:doctor lists the resources without a Model as information, not as errors.

Register resources (with optional auth guard, opt-in RBAC, SQLite dialect, and multi-tenant scoping):

p := asaka.New("Asaka", "/admin").
	WithAuthGuard(requireAuth). // or .WithAuth(asaka.AuthConfig{...}); Mount panics without one of them
	// Optional: .WithTenantScope("tenant_id", resolveTenant)
	// Optional: .WithPDFRenderer(customPDFRenderer)
	// Optional: .WithNotificationRecipient(func(r *web.Request) string { ... })
	// Optional: .WithRBAC(asaka.RBACConfig{Enabled: true, RegisterRolesResource: true})
	// Optional: .WithRTL(true)
	// Optional: .WithLocale("ar").WithTranslations("fr", map[string]string{"dashboard": "Tableau de bord"})
	// Optional: .WithDialect(asaka.DialectMySQL) // or asaka.DialectSQLite
	// Optional: .WithPDFFontFile("/path/to/NotoSansJP-Regular.ttf") // or .WithPDFFont(ttfBytes) for UTF-8/CJK PDFs
	Register(
		OrdersResource(),
		CustomersResource(),
	)
p.Mount(route)

Mount panics unless the panel has WithAuthGuard(...) or an enabled WithAuth(...). For demos and local development only, WithoutAuth() mounts the panel publicly (every route, including CRUD, import, bulk delete, uploads and backup, is open to anyone).

Using your app's policies

If your application already has auth.Ability policies for a model (the ones you call with auth.Can in handlers), use them as the Policy of the Resource (v0.21+) instead of writing the rule again over a map[string]any:

&asaka.Resource{
	Slug:  "orders",
	Model: asaka.Model[models.Order](),
	Policy: asaka.ModelPolicy(asaka.Abilities[models.Order, models.User]{
		ViewAny: policies.ViewAnyOrder, // func() auth.Ability[models.User]
		View:    policies.ViewOrder,    // func(*models.Order) auth.Ability[models.User]
		Create:  policies.CreateOrder,
		Update:  policies.UpdateOrder,
		Delete:  policies.DeleteOrder,
	}),
}
Abilities field Policy field Asked for
ViewAny CanView the list, exports, every page of the Resource
View CanViewRecord the view page and PDF of a record, can_view of a row
Create CanCreate the create page, create, CSV import
Update CanUpdateRecord the edit page, update, inline edit, restore, can_update of a row
Delete CanDeleteRecord delete, bulk delete, permanent delete, can_delete of a row
  • A nil field allows the action. ModelPolicy returns a plain Policy, so you can still set the other fields of it, and the roles of WithRBAC and an Action's Authorize still have to allow too.
  • The panel reads every column of the model for the rows it asks about (list, view, edit, delete, bulk delete, restore), builds the *models.Order once per row from the values as the database returned them (JSON, bytes, times with their zone and "" are exact; an encrypted column is decrypted), without another query, and removes those columns before it sends the row or gives it to an Action's callbacks. So policies.UpdateOrder can read order.UserID although the table does not show it.
  • Everything but an allow denies. A denial, an error from auth.Can that is not a denial (it is logged), a panic in an ability (logged), a row that cannot be turned into a model, and a guest (an auth.Ability never runs for a visitor who is not logged in, so a WithoutAuth() panel with no auth.Session denies all).
  • A bulk delete, a row or bulk Action, or a reorder that includes one row the policy refuses is refused as a whole (403), and nothing is changed. A relation manager follows its parent: View for reading, Update for writing. An ability that denies with auth.DenyAsNotFound() answers 404 on the record's pages.
  • View does not filter rows. The list, the CSV and PDF exports and the global search still show every row; use the tenant scope or a query scope to hide rows. View guards the view page and the record's PDF.
  • Use the framework's auth. ModelPolicy runs auth.Can, which sees the users of auth.Session (or a request guard), not the ones of Asaka's own WithAuth(...): such a panel is refused at startup (Mount panics, asaka.Package errors). Use WithAuthGuard with auth.Session.
  • To decide for guests, as a public demo does, write the abilities as auth.GuestAbility and use asaka.GuestAbilities[models.Order, models.User] (the same fields). A Resource uses one of the two types; to put an Ability among them, wrap it in a function that returns auth.Allow(false) for a nil user and calls it otherwise.
  • The Resource must have Model: asaka.Model[T]() of the same T. Mount panics and asaka.Package stops the application for a ModelPolicy with no Model or with another one.
  • An ability that queries the database runs once per row of the list.
  • Test it as your own handlers: client.ActingAs(&user).Get("/admin/orders").

Cmd+K through your search engine

Cmd+K (v0.22+) matches the Searchable columns of each Resource with ILIKE, which cannot use an index and ranks nothing (newest first). If your application already makes the model searchable with the framework's search package, let Cmd+K use it, with the engine's ranking and, on an engine that keeps an index, its speed:

&asaka.Resource{
	Slug:         "orders",
	Model:        asaka.Model[models.Order](),
	GlobalSearch: asaka.SearchEngine, // the default is asaka.SearchColumns
}

It needs the same things as search.Query[models.Order](q) in your own handlers: search tags on the model (search:"text,weight=3"), the model in Searchable of bootstrap/app.go, and the engine you chose with SEARCH_ENGINE (database, the default, runs on PostgreSQL, MySQL, MariaDB and SQLite, but it also scans the table with LIKE unless a field is fulltext, and ignores weight; Meilisearch, Typesense and Turbopuffer keep an index that you create with search:index).

  • Asaka's SQL has the last word. The engine only returns keys (search.Query[T](q) with Limit(20), best match first). Asaka reads those rows again with its own query: id IN (...), the tenant and the soft delete filter, as the list does, and shows the first 5 in the engine's order. A stale index, or an engine that ignores a filter, cannot show another tenant's row or a deleted one. Policy.CanView still decides if the Resource is searched at all.
  • A tenant-scoped panel needs a filterable tenant column. The engine is asked WhereEq(tenantColumn, tenant), so the top 20 are the tenant's own. The model's tenant field needs search:"filterable"; without it, Mount panics and asaka.Package stops the application (it also does for SearchEngine with no Model). A Resource with SkipTenant is not asked to filter.
  • If the engine fails (Meilisearch is down, the model is not in Searchable, the tenant cannot be given to the engine, it takes more than 2 seconds), or if none of the 20 keys is a row that can be shown (a stale index whose top keys are deleted rows), that Resource is searched with its columns as before, and the rest of Cmd+K is not stopped. The error is logged once per Resource and process, not on every keystroke. An engine that finds nothing shows nothing, and so does SEARCH_ENGINE=discard, which finds nothing and has no fallback.
  • What the engine does not know, Cmd+K does not find. A row that SearchIndexed leaves out (drafts) is not found, and neither is a relation's label (a column that shows the customer's name is not searched, as it is with SearchColumns). For a Resource with SoftDeletes, have SearchIndexed return q.WhereNull("deleted_at"), so that deleted rows do not fill the 20 keys.
  • The tenant is given in the type of its field. The tenant of WithTenancy is a string; the engine is asked for the field's type (an int64 column gets an int64), and a tenant that does not fit makes that Resource fall back. A model with a SearchDocument takes its tags (and its filterable tenant) from the document struct.
  • Only Cmd+K changes. The search box of a list, the exports and SearchColumns Resources work as before. Rows that your app writes outside the model (raw SQL, a muted import) are not in a dedicated engine's index until you search:import; the database engine always sees the table.
  • Test it with the database engine, as the framework's testing guide says.

Bulk actions: selecting everything and per-record results

Since v0.24 a list can select every row that it matches, and a bulk delete or action says what happened to each row.

  • Select all N matching. Select the rows of the page and a link offers "Select all N matching" (N is the server's count). The request then does not carry ids: it carries {"selection":{"mode":"all","query":{...},"except":[...]}}, and the server reads the rows again with the list's own filters (tenant, soft deletes, filters, tab, search). A row unchecked after that goes into except. The picked-rows form is {"selection":{"mode":"ids","ids":[...]}}; the older {"ids":[...]} still works. The body cannot widen the selection: the tenant and the soft delete rule are not read from it. Ids may be numbers or strings (a uuid key).
  • A limit. At most 10,000 rows per run; panel.WithBulkLimit(n) or Resource.BulkLimit changes it. More is a 422 and nothing runs.
  • What happened to each row. Each row is done, rejected (the policy, Action.Authorize or asaka.Reject refused it), failed or skipped (not found, or not run). After the run the list shows a banner with the counts and the first 100 refused or failed rows with their reason. A reason is the text of auth.Deny("...") from your ModelPolicy ability, or "You do not have permission."
  • Run and bulk delete stay all-or-nothing. If one selected row is refused, nothing is changed; the banner names the row and offers "Continue without the refused rows", which sends the request again with those rows in except. The response is a redirect with the result (it used to be 403).
  • WithEach goes row by row. A refused row is skipped and the rest go on:
asaka.NewAction("confirm_sla", "Check SLA").WithEach(
	func(ctx context.Context, rec map[string]any, data map[string]any) error {
		if rec["status"] == "shipped" {
			return asaka.Reject("Already shipped") // rejected: shown with this reason
		}
		return db.Transaction(ctx, func(ctx context.Context) error { // the transaction is yours
			_, err := db.Table("orders").WhereEq("id", rec["id"]).Update(ctx, db.Values{"sla_checked": true})
			return err // any other error: failed ("failed" on screen, the error in the log)
		})
	},
).StopOnFailure() // optional: skip the rows after the first failure
  • The rows of the result are kept in your application's cache (go.laravel.com/cache, CACHE_STORE) for 15 minutes, tied to the session (the session cookie cannot hold them). With the discard store, or a memory store that another instance does not share, the banner shows the counts only and says that the list of rows is gone, and "Continue without the refused rows" is not offered. The button is also not offered after a full reload (the request it resends is kept in memory, never in storage) or when more than 1,000 rows were refused.
  • Action.WithBulkLimit(n) gives one action its own limit (a read-only action may take 10,000 while bulk delete keeps the Resource's smaller one).
  • If more rows match than the list showed when you selected them, the server answers 409 ("The list changed since you selected it; review and try again") and runs nothing.
  • A row of another tenant, a missing row and a row that an ability hides with auth.DenyAsNotFound() are "skipped: not found" and the other rows still run, so the result does not say that they exist; a row that is soft deleted already is "skipped: already deleted". A header action takes no selection.
  • A bulk run reads and checks the rows 500 at a time (10,000 rows are about 21 SELECTs).

Serving Asaka's own UI (no Node)

By default (asaka install) the pages are copied into resources/js/ and built by your Vite. From v0.23 a panel can serve its screens from the bundle that ships inside Asaka (/vendor/asaka/asaka.js and asaka.css, built from the same asaka/stubs), so an upgrade is go get and the application needs no Node for Asaka's screens:

asaka.Package(admin.NewPanel().WithBundledUI())

Nothing is copied, npm run build is not needed for the panel, and the panel does not load your /build/ assets. A panel without WithBundledUI works as before.

Your own fields, widgets and pages. asaka install --extensions writes vite.asaka.ts and resources/js/asaka-extensions.ts (and copies no UI files). Add the plugin and the entry to vite.config.ts (plugins: [asaka(), ...], and resources/js/asaka-extensions.ts in the input of the laravel plugin), then:

admin.NewPanel().WithBundledUI(asaka.UIExtensions("resources/js/asaka-extensions.ts"))

The page loads Asaka's bundle first (it sets window.Asaka), then your entry, then a small script that starts Asaka, so every registration is done before the first render (the bundle never starts by itself when you declare extensions). In the entry call Asaka.registerAsakaField, registerAsakaWidget and registerAsakaPage(name, component). react, react-dom, react/jsx-runtime and @inertiajs/react come from window.Asaka (the plugin redirects them for the entry and for every file it imports, also lazily or from node_modules), so there is one React on the page and hooks work in any file of your extension. If you register after an await, pass the promise to Asaka.ready(...). The entry is looked up in your Vite manifest at startup: outside debug mode an entry that a manifest lacks stops the application with an error naming it; with no build at all it only logs a warning, and the panel loads no extension until you build.

Your Inertia settings. The panel runs an inertia.Middleware of its own: it removes the one of your application from the panel's routes (a middleware in m.Global cannot be removed, and the panel's then runs inside it). The framework offers no way to read your middleware's state, so hand it over:

admin.NewPanel().WithBundledUI(asaka.UIInertia(inertia.Middleware{
	Share:          share,   // your shared props reach Asaka's pages
	Version:        version, // optional: your own version function
	EncryptHistory: true,
}))

Asaka copies your value (Share, EncryptHistory, PreserveBigIntegers, AllErrors, RootID, ...) and sets its own RootView, ErrorPage (Asaka's error page, in English, Japanese and Arabic) and Version: your Version function, or the hash of your Vite manifest, followed by the hash of Asaka's bundle, so a go get that brings a new bundle makes open pages reload (no 409 loop, and no stale bundle). Without UIInertia the defaults apply and your Share props do not reach Asaka's pages. The pages are not server-side rendered. The scripts and styles carry your CSP nonce (cspNonce).

What you lose.

  • Editing Asaka's page files. They are inside the module. To change one, keep the asaka install way (copy the files, build them with your Vite).
  • Tailwind classes of your own in extensions. Asaka's CSS holds only the classes its pages use, so a new class in your extension has no style. Style extensions with a CSS file of your own (imported from the extension entry).
  • Colors. Asaka's CSS reads the Tailwind palette through CSS variables, so you can override them from your own CSS (imported by your extension entry): --color-slate-50..950, --color-cyan-50..950 (the default accent), --color-emerald-*, --color-rose-*, --color-amber-*, --color-sky-* (all 50..950), --color-indigo- and --color-violet- (300, 500, 600, 700), --color-gray- (50, 200, 300, 400, 700, 900), --color-white, --color-black, and --font-sans. A color that the bundle does not use is not in its CSS: a new color you add to your own @theme does not reach Asaka's pages.
  • Translations added to your own resources/js/lib/i18n.ts. The bundle has Asaka's own en, ja and ar messages only. Translate your resource, column, field and group labels from Go with panel.WithLabelTranslations("ja", map[string]string{...}), and give each Resource a Group (an empty one shows as General).
  • Hot reload of Asaka's pages. Only your extension entry reloads in development.
  • Your own root view and ErrorPage. The panel uses Asaka's (resources/views/vendor/asaka/root.html overrides the root view).

Behind a proxy that terminates TLS (nginx, a load balancer), list it in m.Proxies (Laravel for Go's Trusting proxies). The panel links /vendor/asaka/asaka.js with an absolute URL built from the request, so without it the page asks for http://… and an HTTPS browser blocks the bundle. Once forwarded hosts are trusted, also list every host the binary serves in middleware.TrustHosts.

The bundle is 662 kB of JavaScript (178 kB gzip) and 81 kB of CSS (12.5 kB gzip), about 0.73 MB embedded in every binary that lists WithBundledUI (the files are embedded in the module either way). To replace a file of the bundle, put your copy in public/vendor/asaka/: it overrides the embedded file and survives go get upgrades (so check it after one: it also hides the new bundle's file). To change the root view, resources/views/vendor/asaka/root.html. Maintainers: cd asaka/ui && npm ci && npm run build:asaka-ui (or npm --prefix asaka/ui run build:asaka-ui), then commit asaka/ui/dist (a Go test fails when it is older than asaka/stubs).

Prerequisites

  • Go 1.27+
  • Node.js 22+
  • PostgreSQL (MySQL and SQLite are experimental, see Status)

Quick Start

A. Add to an existing Laravel Go app
go get github.com/qalainau/asaka
go run github.com/qalainau/asaka/cmd/asaka install
npm install lucide-react
  1. Enable class-based dark mode in resources/css/app.css:
@custom-variant dark (&:where(.dark, .dark *));
  1. Build the panel and list it in Packages in bootstrap/app.go:
import "github.com/qalainau/asaka/asaka"

func Options() laravel.Options {
	return laravel.Options{
		Packages: []laravel.Package{
			asaka.Package(admin.NewPanel()), // several panels: asaka.Package(admin.NewPanel(), ops.NewPanel())
		},
		// ...
	}
}

// admin/panel.go
func NewPanel() *asaka.Panel {
	return asaka.New("Admin", "/admin").
		WithAuthGuard(requireAuth). // or .WithAuth(asaka.AuthConfig{...})
		Register(OrdersResource())
}

The package mounts the panel's routes, adds the migrations of Asaka's own tables (asaka_notifications, asaka_roles, asaka_user_roles) and the asaka:doctor command. If there is no panel, two panels share a prefix, a panel has no access control, or a public (WithoutAuth()) panel is listed before a guarded one, the application refuses to start with an error naming the problem. A resource whose Model the panel cannot serve still panics in Panel.Register, when the panel is built.

activity_logs stays your application's table: create it in your own migration (columns id, resource_slug, record_id, action, summary, created_at, and optionally changes).

If you mounted the panel inside a route group with extra middleware (an IP allowlist, your own auth) and used WithoutAuth() because the group protected it, the package path does not have that group: give the panel its own guard (WithAuthGuard) before you switch.

  1. Run laravel migrate (the migrations skip Asaka tables that already exist), build your frontend assets (npm run build or npm run dev) and open /admin.

The older way still works: call panel.Mount(route) in routes/web.go instead of listing the package (asaka install --mount prints those steps). Mount panics where the package returns an error, and creates its tables at runtime.

Pass --force to asaka install to overwrite existing UI files when upgrading.

CLI Generators & Schema Doctor
go run github.com/qalainau/asaka/cmd/asaka install --force
go run github.com/qalainau/asaka/cmd/asaka make:resource Invoice
go run github.com/qalainau/asaka/cmd/asaka make:resource Invoice --from-db --table=invoices
go run github.com/qalainau/asaka/cmd/asaka make:page GeneralSettings
go run github.com/qalainau/asaka/cmd/asaka make:widget RevenueTrend --type=chart
go run github.com/qalainau/asaka/cmd/asaka make:relation-manager Customer Order

# Verify all registered resources against your live PostgreSQL schema
go run . asaka:doctor
B. Try the standalone 10,000-row demo locally

The full runnable demo application (10,000 PostgreSQL rows, Dashboard, Orders, Customers, Activity Logs, CSV/PDF exports, SSE notifications, and Playwright E2E suite) lives in its own repository: qalainau/asaka-demo.

git clone https://github.com/qalainau/asaka-demo.git
cd asaka-demo
cp .env.example .env
# Point DATABASE_URL in .env to your PostgreSQL database

npm install && npm run build
go run . migrate --seed
go run .

Open http://127.0.0.1:8000/admin.

Testing

# Go unit tests, asakatest helpers, CLI tests, and embedded stub verification
go test -race ./...

Use github.com/qalainau/asaka/asaka/asakatest to assert panel registration, route wiring, and policy enforcement in Go tests without booting a full server.

Project Structure

  • asaka/ — Core server-driven panel package (schema, CRUD/JOIN/inline handlers, global search, dashboard metrics, policy/guard, RBAC, multi-tenant scoping, native PDF/CSV exports, SSE notifications, unit tests).
  • asaka/asakatest/ — Testing helpers for asserting panel registration, routes, and policies.
  • asaka/stubs/ — Embedded React/TypeScript UI stubs installed by cmd/asaka install (the single source of the pages).
  • asaka/ui/ — Vite config and entry that build the stubs into asaka/ui/dist, the bundle served at /vendor/asaka/ by WithBundledUI (cd asaka/ui && npm ci && npm run build:asaka-ui).
  • cmd/asaka/ — CLI installer & code generators (install, make:resource, make:page, make:widget, make:relation-manager).
  • .agents/skills/asaka/ — Official Agent Skill for AI coding assistants.

License

MIT


Built in Asaka, Japan.

Directories

Path Synopsis
Package asaka provides a Filament-inspired, server-driven admin panel framework for Laravel Go (go.laravel.com) + PostgreSQL/MySQL/SQLite + Inertia v3 + React.
Package asaka provides a Filament-inspired, server-driven admin panel framework for Laravel Go (go.laravel.com) + PostgreSQL/MySQL/SQLite + Inertia v3 + React.
cmd
asaka command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL