Skip to content

Commit 2ecf768

Browse files
authored
Merge branch 'frectonz:main' into main
2 parents 58d4143 + e861787 commit 2ecf768

26 files changed

Lines changed: 1469 additions & 228 deletions

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build SQLite Studio
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20'
23+
24+
- name: Install npm dependencies
25+
run: |
26+
cd ui
27+
npm install
28+
29+
- name: Build npm project
30+
run: |
31+
cd ui
32+
npm run build
33+
34+
- name: Build Rust project
35+
run: cargo build --release

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Release
2+
on:
3+
release:
4+
types: [created]
5+
jobs:
6+
release:
7+
name: release ${{ matrix.target }}
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
include:
13+
- target: x86_64-pc-windows-gnu
14+
archive: zip
15+
- target: x86_64-unknown-linux-musl
16+
archive: zip
17+
- target: x86_64-apple-darwin
18+
archive: zip
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '20'
27+
28+
- name: Install UI dependencies
29+
run: |
30+
cd ui
31+
npm install
32+
33+
- name: Build UI
34+
run: |
35+
cd ui
36+
npm run build
37+
38+
- name: Compile and release
39+
uses: rust-build/rust-build.action@v1.4.5
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
with:
43+
RUSTTARGET: ${{ matrix.target }}
44+
ARCHIVE_TYPES: ${{ matrix.archive }}
45+
MINIFY: true
46+
TOOLCHAIN_VERSION: 1.74

Cargo.lock

Lines changed: 28 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
[package]
22
name = "sqlite-studio"
3-
version = "0.1.0"
3+
version = "0.1.3"
44
edition = "2021"
55

6-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7-
86
[dependencies]
97
chrono = { version = "0.4.38", features = ["serde"] }
108
clap = { version = "4.5.6", features = ["derive"] }
@@ -14,6 +12,13 @@ rusqlite = { version = "0.31.0", features = ["bundled"] }
1412
serde = { version = "1.0.203", features = ["derive"] }
1513
serde_json = "1.0.117"
1614
tokio = { version = "1.38.0", features = ["full"] }
15+
tokio-rusqlite = "0.5.1"
1716
tracing = "0.1.40"
1817
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
1918
warp = "0.3.7"
19+
20+
[profile.release]
21+
strip = true
22+
opt-level = "z"
23+
lto = true
24+
codegen-units = 1

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 frectonz <fraol0912@gmail.com>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,68 @@
11
# SQLite Studio
22

3-
SQLite database explorer
3+
Single binary, single command SQLite database explorer.
4+
5+
```bash
6+
sqlite-studio <sqlite_db>
7+
```
8+
9+
## Features
10+
11+
- Overview page with common metadata.
12+
- Tables page with each table's metadata, including the disk size being used by each table.
13+
- Infinite scroll rows view.
14+
- A custom query page that gives you more access to your db.
15+
16+
More features available on the [releases page](https://github.com/frectonz/sqlite-studio/releases).
17+
18+
## Screenshots
19+
20+
### Home Page
21+
22+
![homepage](./screenshots/homepage.png)
23+
24+
### Tables Page
25+
26+
![tables](./screenshots/tables.png)
27+
![infinite scroll](https://github.com/frectonz/sqlite-studio/assets/53809656/b6d8f627-4a21-46c2-bef7-8dea206b3689)
28+
29+
### Query Page
30+
31+
![query](./screenshots/query.png)
32+
![query gif](https://github.com/frectonz/sqlite-studio/assets/53809656/3e47a890-ddd9-4c7f-be88-53e30cc23b15)
433

534
## How To Run It
635

7-
If you are using [Nix](https://nixos.org/).
36+
### Pre-Built Binaries
37+
38+
You can find pre-built binaries for the following targets on the [releases](https://github.com/frectonz/sqlite-studio/releases) page.
39+
40+
- Linux `sqlite-studio_<release>_x86_64-unknown-linux-musl.zip`
41+
- Windows `sqlite-studio_<release>_x86_64-pc-windows-gnu.zip`
42+
- MacOS x86 `sqlite-studio_<release>_x86_64-apple-darwin.zip`
43+
44+
After downloading the ZIP archive, you can extract it and get the binary.
45+
46+
### Nix
47+
48+
If you are using [Nix](https://nixos.org/), to build it from source.
849

950
```bash
1051
nix shell github:frectonz/sqlite-studio
11-
sqlite-studio
52+
sqlite-studio <sqlite_db>
53+
```
54+
55+
## Contributing
56+
57+
Before executing `cargo run` you need to build the UI because the rust app statically embedded the UI files in the binary.
58+
59+
```bash
60+
git clone git@github.com:frectonz/sqlite-studio.git
61+
cd sqlite-studio
62+
nix develop # if you use nix
63+
cd ui
64+
npm install
65+
npm run build
66+
cd ..
67+
cargo run <sqlite_db>
1268
```

flake.nix

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
(pkgs.lib.hasSuffix "\.css" path) ||
3434
(pkgs.lib.hasSuffix "\.js" path) ||
3535
(pkgs.lib.hasSuffix "\.svg" path) ||
36+
(pkgs.lib.hasSuffix "\.sqlite3" path) ||
3637
(craneLib.filterCargoSources path type)
3738
;
3839
};
@@ -42,7 +43,7 @@
4243
pname = "ui";
4344
version = "0.0.0";
4445
src = ./ui;
45-
npmDepsHash = "sha256-fIz4WWvzPzQS4CCXvXtf87+ailmDDri1ACnzaB5TP7Y=";
46+
npmDepsHash = "sha256-Q7AVCPU+rZhsMRts3Sn/P2G22pePOI0BAnMrcXkUgUo=";
4647
installPhase = ''
4748
cp -pr --reflink=auto -- dist "$out/"
4849
'';
@@ -55,10 +56,19 @@
5556
cp -pr --reflink=auto -- ${ui} ui/dist
5657
'';
5758
});
59+
60+
docker = pkgs.dockerTools.buildLayeredImage {
61+
name = "sqlite-studio";
62+
tag = "latest";
63+
created = "now";
64+
config.Cmd = [ "${bin}/bin/sqlite-studio" "preview" "--address=0.0.0.0:3030" ];
65+
config.Expose = "3030";
66+
};
5867
in
5968
{
6069
packages = {
6170
default = bin;
71+
docker = docker;
6272
};
6373

6474
devShells.default = pkgs.mkShell {
@@ -68,13 +78,13 @@
6878
pkgs.rust-analyzer
6979
rustToolchain
7080

81+
pkgs.nodejs
7182
pkgs.nodePackages.typescript-language-server
7283
pkgs.nodePackages.vscode-langservers-extracted
7384
pkgs.nodePackages."@tailwindcss/language-server"
7485

75-
pkgs.nodejs
76-
7786
pkgs.httpie
87+
pkgs.sqlite
7888
];
7989
};
8090

sample.sqlite3

864 KB
Binary file not shown.

screenshots/homepage.png

130 KB
Loading

screenshots/query.png

50.9 KB
Loading

0 commit comments

Comments
 (0)