https://github.com/ryands17/libsql-server-test
My experimentations with LibSQL server
https://github.com/ryands17/libsql-server-test
libsql typescript
Last synced: 3 months ago
JSON representation
My experimentations with LibSQL server
- Host: GitHub
- URL: https://github.com/ryands17/libsql-server-test
- Owner: ryands17
- Created: 2023-11-29T15:40:24.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-21T08:30:31.000Z (almost 2 years ago)
- Last Synced: 2025-04-08T10:10:05.266Z (9 months ago)
- Topics: libsql, typescript
- Language: TypeScript
- Homepage:
- Size: 41 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LibSQL Server test
This is an understanding project on how LibSQL server works. You can use this sample to run a full fledged replicated SQLITE on Kubernetes. This example contains a [docker-compose.yml](./docker-compose.yml) for deploying a main and replica database and uses Drizzle ORM for querying the table. There's a simple `todos` table created to test the functionality out.
Authorisation has also been implemented using JWT signing and that can be found in the [utils](./utils) folder. This make sure that the database is protected.
## Prereequisites
- Node v18 LTS or above
- PNPM
- Docker
## Setup
Create a `keys` directory to store the public key. To create public and private keys, run the following script:
```
node utils/generate-keys.js
```
The keys in the public folder will be shared with the SQLite databases to verify calls. The private key will be used by our script to create the JWT.
Next, create a JWT to be used with Drizzle to talk to the DB:
```
node utils/generate-token.js
```
Rename the `.env.example` file to `.env` and add the token obtained in the output of the above script to the `DB_AUTH_TOKEN` key. This will make sure that Drizzle can connect to the database securely.
## Commands
- **dev**: Run the test project with Drizzle in watch mode
- **db:push** - Push changes to the database directly
- **build** - Build the app for production
- **start** - Start the built production app
- **studio** - UI to interact with your database
Things to experiment with:
- [ ] Check out S3 replication
- [ ] Load test with multiple replicas