Turso
Quoted from the Turso documentation,
It’s an easy database to setup, and SQLite can be used quite easily on local environments.
Here is how to setup and use Turso with KitForStartups:
Create a Turso database
Before creating a database, you’ll need to install Turso CLI on your machine. Steps to do so can be found here.
Next, you can create a logical database using the following commands:
Update environments variables
The next step is to update the environment variables in your .env
file. You can find the values for these variables in the Turso console.
For Turso, we need TURSO_DB_URL
and TURSO_AUTH_TOKEN
.
The token can be generated using the following command:
For the DB URL, on local environments, you can use turso dev
to invoke a libSQL server locally. This will open a websocket server that can be accessed on ws://127.0.0.1:8080
(this will be the value for TURSO_DB_URL
).
Push the database schema
Once you have your database setup, you can push the schema using the following command:
This will directly push the schema to the database without creating any migrations files.
If you want / need to create migrations files, you can use the following command:
Search and replace the database configuration
In order to switch, the current option is to search and replace occurences of drizzle/mysql
and lucia/mysql
with drizzle/turso
and lucia/turso
respectively.
If you are using VSCode, you can exclude the src/lib/drizzle
and src/lib/lucia
folders from the search.