tabulita

package module
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: GPL-3.0 Imports: 16 Imported by: 0

README

Tabulita

A lightweight, self-hosted web interface for managing SQLite databases. Written in Go, it provides a robust, CGO-free solution for inspecting and modifying SQLite files through a modern, responsive web browser interface.

Designed for simplicity and portability, Tabulita serves as both a graphical user interface and a JSON API endpoint, making it an ideal tool for embedded systems, rapid prototyping, or lightweight database administration.

Features

  • Database Management: Create, rename, copy, and drop tables.
  • Schema Modification: Add, rename, and remove columns dynamically.
  • Data Manipulation: Full CRUD (Create, Read, Update, Delete) support for table rows.
  • Advanced Viewing: Integrated search and column sorting (ASC/DESC).
  • Security: Optional HTTP Basic Authentication.
  • Responsive UI: A clean interface built with Beer CSS and Material Design icons.
  • Zero Dependencies: Built with modernc.org/sqlite, requiring no CGO or external C libraries. It compiles to a single static binary.

Installation

Building from Source

To build the application, clone the repository and run the provided Makefile:

git clone https://github.com/eja/tabulita.git
cd tabulita
make tabulita

This will generate the binary in the build/ directory. For a statically linked binary suitable for minimal environments, run:

make static

Usage

Start the server by pointing it to the directory containing your SQLite files:

./build/tabulita -file-path /path/to/your/databases
Command Line Arguments
Flag Default Description
-file-path . Path to the SQLite database or a directory of db files
-web-host localhost The interface to bind the web server to.
-web-port 35248 The port to serve the application on.
-web-path /tabulita/ The HTTP path prefix for the interface.
-web-auth None Basic Auth credentials in user:password or Base64 format.
-log false Enable verbose logging.
-log-file None Path to a file for log output.

Once running, access the interface at http://localhost:35248/tabulita/.

API Documentation

Tabulita exposes a single endpoint (defaulting to /tabulita/) that accepts POST requests containing a JSON payload. The server determines the operation based on the action field.

General Response Structure

All API responses follow this format:

{
  "success": true,
  "data": { ... },
  "error": "Error message if success is false"
}
Action: list-rows

Retrieves rows from a specific table, with optional searching and sorting.

Request:

{
  "action": "list-rows",
  "table": "users",
  "start": 0,
  "stop": 19,
  "query": "search_term_optional",
  "sort_col": "username",
  "sort_dir": "ASC"
}
  • start/stop: The zero-based index range for pagination.
  • sort_dir: "ASC" or "DESC".

Response Data:

{
  "tableName": "users",
  "columns": [{"name": "id", "type": "INTEGER"}, ...],
  "rows": [
    { "id": "1", "values": ["1", "John Doe", "admin"] }
  ],
  "start": 0,
  "stop": 19,
  "totalRows": 154,
  "totalPages": 8
}
Table Operations
Action: list-tables

Lists all non-system tables in the database.

{ "action": "list-tables" }
Action: create-table

Creates a new table with a primary key column.

{
  "action": "create-table",
  "table": "new_table_name",
  "col_name": "id",
  "col_type": "INTEGER PRIMARY KEY AUTOINCREMENT"
}
Action: rename-table

Renames an existing table.

{
  "action": "rename-table",
  "table": "old_name",
  "new_name": "new_name"
}
Action: copy-table

Creates a copy of a table (schema + data).

{
  "action": "copy-table",
  "table": "source_table",
  "new_name": "destination_table"
}
Column Operations
Action: add-column

Adds a new column to an existing table.

{
  "action": "add-column",
  "table": "users",
  "col_name": "email",
  "col_type": "TEXT",
  "is_not_null": false
}
Action: rename-column

Renames a column in a table.

{
  "action": "rename-column",
  "table": "users",
  "col_name": "old_col_name",
  "new_name": "new_col_name"
}
Action: drop-column

Removes a column from a table.

{
  "action": "drop-column",
  "table": "users",
  "col_name": "col_to_remove"
}
Row Operations
Action: add-row
{
  "action": "add-row",
  "table": "users",
  "data": {
    "username": "jdoe",
    "email": "[email protected]"
  }
}
Action: edit-row
{
  "action": "edit-row",
  "table": "users",
  "rowid": "1",
  "data": {
    "email": "[email protected]"
  }
}
Action: delete-row
{
  "action": "delete-row",
  "table": "users",
  "rowid": "1"
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiRequest

type ApiRequest struct {
	Action  string            `json:"action"`
	Table   string            `json:"table,omitempty"`
	NewName string            `json:"new_name,omitempty"`
	RowID   string            `json:"rowid,omitempty"`
	Data    map[string]string `json:"data,omitempty"`

	Start int    `json:"start"`
	Stop  int    `json:"stop"`
	Query string `json:"query,omitempty"`

	SortCol string `json:"sort_col,omitempty"`
	SortDir string `json:"sort_dir,omitempty"`

	ColName   string `json:"col_name,omitempty"`
	ColType   string `json:"col_type,omitempty"`
	IsNotNull bool   `json:"is_not_null,omitempty"`
}

type ApiResponse

type ApiResponse struct {
	Success bool        `json:"success"`
	Error   string      `json:"error,omitempty"`
	Data    interface{} `json:"data,omitempty"`
}

type ColumnInfo

type ColumnInfo struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func New

func New(urlPrefix, baseDir, authHash string) *Handler

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RowData

type RowData struct {
	ID     string   `json:"id"`
	Values []string `json:"values"`
}

type TableResponse

type TableResponse struct {
	TableName  string       `json:"tableName"`
	Columns    []ColumnInfo `json:"columns"`
	Rows       []RowData    `json:"rows"`
	Start      int          `json:"start"`
	Stop       int          `json:"stop"`
	TotalPages int          `json:"totalPages"`
	TotalRows  int          `json:"totalRows"`
}

type TemplateData

type TemplateData struct {
	RootPath string
}

Directories

Path Synopsis
cmd
tabulita command

Jump to

Keyboard shortcuts

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