asaka

command module
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Asaka

CI Go Reference

A server-driven admin panel framework for Laravel Go + PostgreSQL + Inertia v3 + React.

Declare a resource once in Go — get a complete, blazing-fast admin panel with live Dashboard charts, Cmd+K global search, BelongsTo relations, inline cell editing, sectioned modals, relation manager tabs, authorization policies, multi-tenant scoping, and EN/JA i18n — without writing per-resource React.

Live Demo (10,000 PostgreSQL rows + Pro views preview)

Asaka Dashboard

Asaka Orders Table

Highlights

  • Full Filament Parity in Go: Declare a resource once in Go (asaka.Resource) and get CRUD tables, dedicated Create / View (Infolists) / Edit pages, Action Modal & Slide-Over Forms, List Page Tabs, Soft Deletes (Restore / Force Delete), Row Reordering, CRUD & Many-to-Many Relation Managers, Pluggable Widgets, Custom Pages & Clusters, Real-time SSE + Database Notifications, Async CSV Import/Export, Built-in Auth & Profile, Opt-in RBAC, Multi-Panel, and Multi-Tenancy UI.
  • All 20 Filament Form Fields + Layouts + Reactivity: Complete 20-field catalog (Builder, Repeater, FileUpload, RichEditor, MarkdownEditor, CodeEditor, ColorPicker, Slider, Tags, KeyValue, ToggleButtons, CustomField, etc.), Wizard / Split / Fieldset / Tabs / Collapsible Section / Callout, plus server-driven live() reactivity and async BelongsToSelect with CreateOptionForm.
  • Real-Time SSE Notifications, Async CSV & Native PDF Exports: Live toast & bell-drawer delivery over GET {prefix}/notifications/stream (EventSource), background CSV exports (up to 100k rows) with downloadable notification links, column-mapped async CSV imports (up to 50k rows) using per-row SAVEPOINTs, plus built-in Native PDF Export (GET {prefix}/{slug}/export.pdf table reports & GET {prefix}/{slug}/{id}/pdf single-record detail sheets) with zero-config PDF 1.4 generation, optional TrueType font embedding (Panel.WithPDFFont(ttfBytes) / Panel.WithPDFFontFile(path)) for full Japanese/CJK/UTF-8 output, and a Panel.PDFRenderer hook.
  • Built for real data volume + SQLite support: Tested with 10,000 PostgreSQL rows and up to 1,000 rows per page (~9 ms LEFT JOIN query, ~11 ms full Dashboard aggregation, ~3.9 ms Cmd+K global search on a standard VPS), plus Panel.WithDialect(asaka.DialectSQLite) for zero-setup local dev and lightweight testing.
  • Production foundations: Panel-level Guard & built-in Auth, opt-in RBAC (Panel.WithRBAC(...), default OFF / zero overhead), per-resource & per-record Policy, lifecycle Hooks, automatic multi-tenant scoping + Tenant Switcher UI, asaka make:resource --from-db PostgreSQL introspection, asaka:doctor schema verification, and asakatest + Playwright E2E smoke tests.
  • Single binary: Compiles with go build into a self-contained binary alongside Vite+ assets.

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",
		Table:         "orders",
		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"),
		},
	}
}

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

p := asaka.New("Asaka", "/admin").
	// Optional: .WithRBAC(asaka.RBACConfig{Enabled: true, RegisterRolesResource: true})
	// Optional: .WithDialect(asaka.DialectSQLite)
	// Optional: .WithPDFFontFile("/path/to/NotoSansJP-Regular.ttf") // or .WithPDFFont(ttfBytes) for UTF-8/CJK PDFs
	Register(
		OrdersResource(),
		CustomersResource(),
	)
// Optional: p.Guard = requireAuth
// Optional: p.TenantColumn = "tenant_id"; p.TenantResolver = resolveTenant
// Optional: p.PDFRenderer = customPDFRenderer
p.Mount(route)

Prerequisites

  • Go 1.27+
  • Node.js 22+
  • PostgreSQL

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. Register your resources and mount the panel in routes/web.go:
import "github.com/qalainau/asaka/asaka"

asaka.New("Admin", "/admin").Register(
	OrdersResource(),
).Mount(route)
  1. Build your frontend assets (npm run build or npm run dev) and open /admin.

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. Run the standalone 10,000-row demo locally
git clone https://github.com/qalainau/asaka.git
cd asaka
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:8080/admin.

Testing

# Go unit tests, asakatest helpers, embedded stub byte-parity, and feature tests
go test ./...

# Frontend typecheck & production build
npm run types:check && npm run build

# Playwright E2E smoke tests against a running app (defaults to http://127.0.0.1:8000)
E2E_BASE_URL=http://127.0.0.1:8000 npm run test:e2e

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, multi-tenant scoping, unit tests) and asaka/stubs/ (embedded React UI stubs).
  • cmd/asaka/ — CLI installer (go run github.com/qalainau/asaka/cmd/asaka install).
  • admin/resources.go — Example Orders, Customers, and ActivityLogs resource declarations.
  • resources/js/ — Generic pages/Admin/Dashboard.tsx, pages/Admin/ResourceIndex.tsx, components/GlobalSearchModal.tsx, components/SchemaRenderer.tsx, and lib/i18n.ts.
  • database/migrations/ & database/seeders/ — PostgreSQL schema and 10,000-row seeder.

License

MIT


Built in Asaka, Japan.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
asaka command
database
schema
Package schema embeds the schema dumps that schema:dump writes, such as default-schema.sql, so migrate can build a new database from the binary after schema:dump --prune deletes the migrations.
Package schema embeds the schema dumps that schema:dump writes, such as default-schema.sql, so migrate can build a new database from the binary after schema:dump --prune deletes the migrations.
handlers

Jump to

Keyboard shortcuts

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