@@ -10,13 +10,13 @@ A powerful Elysia plugin for SQLite database management with a beautiful built-i
1010
1111## ✨ Features
1212
13- - 📊 ** Smart DataGrid** — Interactive table with pagination, sorting, and inline editing
14- - 🔗 ** Foreign Key Preview** — Intelligently resolves and displays foreign key relationships
15- - 🔐 ** Secure Admin** — Built-in authentication with session management and 2FA/TOTP
16- - ⚡ ** Zero Config** — Auto-detects database schema and provides instant CRUD interface
17- - 📤 ** Easy Export** — Export your data to CSV or JSON with a single click
18- - 🧭 ** Guided Onboarding** — Simple setup wizard for initial configuration
19- - 🤖 ** AI SQL** — Generate SQL queries using natural language (requires OpenRouter key)
13+ - 📊 ** Smart DataGrid** — Interactive table with pagination, sorting, and inline editing
14+ - 🔗 ** Foreign Key Preview** — Intelligently resolves and displays foreign key relationships
15+ - 🔐 ** Secure Admin** — Built-in authentication with session management and 2FA/TOTP
16+ - ⚡ ** Zero Config** — Auto-detects database schema and provides instant CRUD interface
17+ - 📤 ** Easy Export** — Export your data to CSV or JSON with a single click
18+ - 🧭 ** Guided Onboarding** — Simple setup wizard for initial configuration
19+ - 🤖 ** AI SQL** — Generate SQL queries using natural language (requires OpenRouter key)
2020
2121## 📦 Installation
2222
@@ -33,20 +33,20 @@ bun add elysia
3333## 🚀 Quick Start
3434
3535``` javascript
36- import { Elysia } from ' elysia'
37- import { sqliteAdmin } from ' @riligar/elysia-sqlite'
36+ import { Elysia } from " elysia" ;
37+ import { sqliteAdmin } from " @riligar/elysia-sqlite" ;
3838
3939const app = new Elysia ()
40- .use (
41- sqliteAdmin ({
42- dbPath: ' demo.db' ,
43- prefix: ' /sqlite' , // Optional: defaults to /sqlite
44- })
45- )
46- .listen (3000 )
47-
48- console .log (' 🦊 Server running at http://localhost:3000' )
49- console .log (' 📊 Admin Dashboard at http://localhost:3000/sqlite' )
40+ .use (
41+ sqliteAdmin ({
42+ dbPath: " demo.db" ,
43+ prefix: " /sqlite" , // Optional: defaults to /sqlite
44+ })
45+ )
46+ .listen (3000 );
47+
48+ console .log (" 🦊 Server running at http://localhost:3000" );
49+ console .log (" 📊 Admin Dashboard at http://localhost:3000/sqlite" );
5050```
5151
5252On first run, navigate to ` /sqlite ` (or your configured prefix) to start the onboarding wizard and configure your admin credentials.
@@ -57,21 +57,21 @@ On first run, navigate to `/sqlite` (or your configured prefix) to start the onb
5757
5858These options are passed to the ` sqliteAdmin ` plugin at initialization.
5959
60- | Option | Type | Default | Description |
61- | ------------ | ------ | ----------------------------- | --------------------------------------------------------------- |
62- | ` dbPath ` | string | ** Required** | Path to the SQLite database file |
63- | ` prefix ` | string | ` "/sqlite" ` | URL prefix for the admin dashboard and API |
64- | ` configPath ` | string | Same directory as ` dbPath ` | Path to save the runtime authentication config (JSON). Defaults to ` sqlite-admin -config.json ` in the same directory as your database file |
60+ | Option | Type | Default | Description |
61+ | ------------ | ------ | -------------------------- | -------------------------------------------------------------------- --------------------------------------------------------------- |
62+ | ` dbPath ` | string | ** Required** | Path to the SQLite database file |
63+ | ` prefix ` | string | ` "/sqlite" ` | URL prefix for the admin dashboard and API |
64+ | ` configPath ` | string | Same directory as ` dbPath ` | Path to save the runtime authentication config (JSON). Defaults to ` sqlite-config.json ` in the same directory as your database file |
6565
6666### Runtime Configuration (via UI)
6767
6868The following settings are managed via the ** Settings** tab in the dashboard and stored in the JSON file defined by ` configPath ` .
6969
70- | Option | Description |
71- | ----------------- | -------------------------------------------------------- |
72- | ` username ` | Admin username for accessing the dashboard |
73- | ` password ` | Admin password (stored in plain text in config file - protect this file!) |
74- | ` totpSecret ` | Secret key for Two-Factor Authentication (managed automatically) |
70+ | Option | Description |
71+ | ------------ | ----------------- -------------------------------------------------------- |
72+ | ` username ` | Admin username for accessing the dashboard |
73+ | ` password ` | Admin password (stored in plain text in config file - protect this file!) |
74+ | ` totpSecret ` | Secret key for Two-Factor Authentication (managed automatically) |
7575
7676> ** Note:** The configuration file contains sensitive credentials. Ensure it is included in your ` .gitignore ` if necessary or secured appropriately in production environments.
7777
@@ -91,9 +91,9 @@ When deploying to cloud platforms with ephemeral filesystems, ensure your databa
9191``` javascript
9292// Your app
9393sqliteAdmin ({
94- dbPath: ' /data/app.db' ,
95- // configPath automatically uses /data/sqlite-admin -config.json
96- })
94+ dbPath: " /data/app.db" ,
95+ // configPath automatically uses /data/sqlite-config.json
96+ });
9797```
9898
9999The config file is automatically stored alongside your database, so both will persist across deployments when using the same volume.
@@ -104,32 +104,32 @@ The plugin adds the following routes under your configured `prefix` (default `/s
104104
105105### Authentication
106106
107- | Method | Path | Description |
108- | ------ | ---------------- | ------------------------------------------------ |
109- | POST | ` /auth/login ` | Authenticate user (username, password, 2FA code) |
110- | POST | ` /auth/logout ` | End session |
111- | GET | ` /auth/status ` | Check if system is configured and user authenticated |
112- | POST | ` /api/setup ` | Initial setup (create admin credentials) |
107+ | Method | Path | Description |
108+ | ------ | -------------- | ---- ------------------------------------------------ |
109+ | POST | ` /auth/login ` | Authenticate user (username, password, 2FA code) |
110+ | POST | ` /auth/logout ` | End session |
111+ | GET | ` /auth/status ` | Check if system is configured and user authenticated |
112+ | POST | ` /api/setup ` | Initial setup (create admin credentials) |
113113
114114### Data Operations
115115
116- | Method | Path | Description |
117- | ------ | ------------------------ | -- ------------------------------------------- |
118- | GET | ` /api/tables ` | List all tables in database |
119- | GET | ` /api/table/:name/rows ` | Get rows for a table (pagination support) |
120- | POST | ` /api/table/:name/insert ` | Insert new record |
121- | POST | ` /api/table/:name/update ` | Update record (inline edit) |
122- | POST | ` /api/table/:name/delete ` | Delete record |
123- | GET | ` /api/table/:name ` | Get table schema (columns and foreign keys) |
116+ | Method | Path | Description |
117+ | ------ | ------------------------- | ------------------------------------------- |
118+ | GET | ` /api/tables ` | List all tables in database |
119+ | GET | ` /api/table/:name/rows ` | Get rows for a table (pagination support) |
120+ | POST | ` /api/table/:name/insert ` | Insert new record |
121+ | POST | ` /api/table/:name/update ` | Update record (inline edit) |
122+ | POST | ` /api/table/:name/delete ` | Delete record |
123+ | GET | ` /api/table/:name ` | Get table schema (columns and foreign keys) |
124124
125125### Advanced Features
126126
127- | Method | Path | Description |
128- | ------ | ------------------------ | --------------------------------------------- |
129- | POST | ` /api/query ` | Execute raw SQL query |
130- | POST | ` /api/ai/sql ` | Generate SQL from natural language prompt |
131- | POST | ` /api/resolve-fk ` | Resolve IDs to display labels for foreign keys|
132- | GET | ` /api/meta/schema ` | Get full database schema for ERD |
127+ | Method | Path | Description |
128+ | ------ | ------------------ | - --------------------------------------------- |
129+ | POST | ` /api/query ` | Execute raw SQL query |
130+ | POST | ` /api/ai/sql ` | Generate SQL from natural language prompt |
131+ | POST | ` /api/resolve-fk ` | Resolve IDs to display labels for foreign keys |
132+ | GET | ` /api/meta/schema ` | Get full database schema for ERD |
133133
134134## 🤝 Contributing
135135
0 commit comments