turso-extended / app-turso-notes

A multi-platform note-taking desktop application built with Tauri, Turso, Qwik, and TailwindCSS.
MIT License
8 stars 1 forks source link
qwik rust tailwind tauri turso typescript

Turso Notes ⚡️

A multi-platform note-taking desktop application built with Tauri, Turso, Qwik, and TailwindCSS.

Prerequisites

Database Setup

Install the Turso CLI.

Create a new turso database.

turso db create turso-notes

Get the database URL.

turso db show turso-notes --url

Create an authentication token for your database.

turso db tokens create turso-notes

Create a .env file inside /src-tauri adding the acquired values from the two commands above as environment variables.

# /src-tauri/.env

TURSO_SYNC_URL=<OBTAINED_URL>
TURSO_TOKEN=<CREATED_TOKEN>

Add a DB_PATH key with the path to the local SQLite database (embedded replica) that this app is going to sync with Turso and perform reads on. (Turso will automatically create the file database on first run)

# /src-tauri/.env

DB_PATH=../turso-notes.db

Open the created Turso database on the Turso CLI shell to issue SQLite statements:

turso db shell turso-notes

On the Turso CLI shell, issue the following statement to create a "notes" table.

create table notes(
 id varchar not null,
 title varchar not null,
 `text` text default ('Write something here...'),
 created_at integer default (cast(unixepoch() as int)),
 updated_at integer default (cast(unixepoch() as int))
);

Development

Install project's dependencies.

npm install

Run the following command to run a development preview of the application.

cargo tauri dev