datatable
Server-side tables for Go + React. TanStack Table–aligned query parsing, filtering, sorting, and pagination — with a matching React UI for production list pages.
What you get
| Layer | Package | Role |
|---|---|---|
| Go | github.com/izetmolla/datatable | Column defs, URL → TableQuery, SQL helpers, GORM / raw PostgreSQL |
| Fiber | …/adapters/fiberv3query | Extract table state from Fiber requests |
| React | Admin Console components/datatable | <DataTable />, hooks, URL state (nuqs), React Query |
One []Column slice is the source of truth: it validates inbound query params, maps SQL expressions, and is returned by GET …/columns so the frontend can build TanStack ColumnDefs.
Why it exists
List pages usually reinvent the same contract:
- URL state for page / sort / filters
- Backend parsing into safe SQL
- Column metadata for the UI
datatable standardizes that contract on both sides so Go handlers and React pages stay in sync.
Feature highlights
- Column defs — sorting, filtering, visibility, pinning, async select options, editable cells
- Query parsing — JSON + bracket params (
pagination,sorting,columnFilters, advancedfilters) - Operators —
iLike,eq,inArray, date ranges, empty checks, joinand/or, nested groups - PostgreSQL —
Find(GORM) andFindRaw(dynamic SELECT + joins) - React — server or client mode, simple & advanced filter toolbars, row selection, action bars, cell editing
Install the React block (CLI)
bunx shadcn@latest add https://raw.githubusercontent.com/izetmolla/datatable/main/registry/v1.json
Or: bunx shadcn@latest add izetmolla/datatable/datatable — see shadcn CLI.
Choose your path
- Getting started — install Go and wire a minimal list API + React page
- Use cases — admin lists, advanced filters, exports, dialogs, proxies, …
- Architecture — request flow from UI action to SQL and back
- Go quick start — columns,
ExtractQuery, andpostgresql.Find - React quick start —
useBackendColumns+ serverDataTable - End-to-end — full Users list walkthrough
Author
Izet Molla · pkg.go.dev · MIT License