You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SQLite Admin provides a lightweight web server to interact with a SQLite database. It allows you to:
5
+
SQLite Admin is a Golang library and binary which enables you to easily interact with a SQLite database. It allows you to:
6
6
7
7
- Browse tables and their schemas.
8
8
- View table data along with adding filters, limits and offsets.
9
9
- Modify individual columns in existing rows.
10
10
11
-
It can either by installed as a binary or embedded into an existing Golang backend as a library.
11
+

12
+
13
+
It can either be integrated into an existing Golang backend as a library or installed as a binary.
12
14
13
15
The web server can be interacted with by going to https://sqliteadmin.dev.
14
16
15
17
The source code for the web UI can be found at https://github.com/joelseq/sqliteadmin-ui
16
18
17
-
18
19
## Motivation
19
20
20
21
SQLite is very easy to add as an embedded database but it's difficult to manage the database once it's deployed in an application.
@@ -23,7 +24,41 @@ Existing tools primarily focus on local SQLite files, requiring manual interacti
23
24
24
25
The alternative is to use a cloud-hosted version like those provided by [Turso](https://turso.tech/) which enables interacting with the database using tools like [Drizzle Studio](https://orm.drizzle.team/drizzle-studio/overview). This adds complexity to the setup and deployment of your application and you lose out on the value of having an embedded database.
25
26
26
-
This project fills that gap by providing an easy way to view and manage an embedded SQLite database via a web UI—no need to migrate to a cloud provider or use ad-hoc solutions.
27
+
This project fills that gap by providing an easy way to view and manage an embedded SQLite database via a web UI — no need to migrate to a cloud provider or use ad-hoc solutions.
28
+
29
+
## Using as a library
30
+
31
+
```go
32
+
config:= sqliteadmin.Config{
33
+
DB: db, // *sql.DB
34
+
Username: "username", // username to use to login from https://sqliteadmin.dev
35
+
Password: "password", // password to use to login from https://sqliteadmin.dev
36
+
Logger: logger, // optional, implements the Logger interface
37
+
}
38
+
admin:= sqliteadmin.New(config)
39
+
40
+
// HandlePost is a HandlerFunc that you can pass in to your router
41
+
router.Post("/admin", admin.HandlePost)
42
+
```
43
+
44
+
Check out the full code at `examples/chi/main.go`.
45
+
46
+
You can also run the example to test out the admin UI:
47
+
48
+
```bash
49
+
go run examples/chi/main.go
50
+
```
51
+
52
+
This will spin up a server on `http://localhost:8080`. You can then interact with your local server by going to `https://sqliteadmin.dev` and passing in the following credentials:
53
+
54
+
```
55
+
username: user
56
+
password: password
57
+
endpoint: http://localhost:8080/admin
58
+
```
59
+
60
+
> [!NOTE]
61
+
> If you are seeing "An unexpected error occurred" when trying to connect, try disabling your adblock.
27
62
28
63
## Installing as a binary
29
64
@@ -38,13 +73,15 @@ go install github.com/joelseq/sqliteadmin-go/cmd/sqliteadmin@latest
38
73
```bash
39
74
make build
40
75
```
76
+
41
77
This will add the `sqliteadmin` binary to `/tmp/bin`
42
78
43
79
### Usage
44
80
45
81
In order to add authentication, the following environment variables are required: `SQLITEADMIN_USERNAME`, `SQLITEADMIN_PASSWORD`.
Your SQLite database can now be accessed by visiting https://sqliteadmin.dev and providing the credentials and endpoint (including port).
60
97
61
-
## Using as a library
62
-
63
-
Check out the `examples/` directory to see how to integrate it into an existing Golang backend.
64
-
65
-
You can also run the examples to test out the admin UI:
66
-
67
-
```bash
68
-
go run examples/chi/main.go
69
-
```
70
-
71
-
This will spin up a server on `http://localhost:8080`. You can then interact with your local server by going to `https://sqliteadmin.dev` and passing in the following credentials:
72
-
73
-
```
74
-
username: user
75
-
password: password
76
-
endpoint: http://localhost:8080/admin
77
-
```
78
-
79
-
> [!NOTE]
80
-
> If you are seeing "An unexpected error occurred" when trying to connect, try disabling your adblock.
81
-
82
98
## Inspiration
83
99
84
100
The UI is heavily inspired by [Drizzle Studio](https://orm.drizzle.team/drizzle-studio/overview).
0 commit comments