app-at-the-polls Svelte Themes

App At The Polls

A poll making website built with Sveltekit, Turso, and Drizzle.

Turso at the polls

An poll-making website.

Technologies used.

Database Setup

Install the Turso CLI.

Create a new turso database.

turso db create turso-at-the-polls

Note

We use turso-at-the-polls as the database name in this command, but you can give it any name.

To access the data stored inside your database, you need the Turso database url and an authentication token.

To obtain the database url, run the following command:

turso db show turso-at-the-polls --url

And, to create an authentication token for your database, run:

turso db tokens create turso-at-the-polls

Add a .env file with the following variables, populating them with the values obtained above.

VITE_TURSO_DB_AUTH_TOKEN=<AUTH-TOKEN>
VITE_TURSO_DB_URL=<DB-URL>

Schema generation and migration

To generate the database schema with Drizzle, run:

npm run drizzle:generate

Migrate the generated database schema by running:

npm run drizzle:migrate

Developing

Once you've created a database, generated, and migrate the schema by following the instructions above, install the project's dependencies by running:

npm install

To start a development server, run:

npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open

Note

Do not stage the .env file used in local development.

Building

To create a production version of your app:

npm run build

You can preview the production build with npm run preview.

To deploy your app, you may need to install an adapter for your target environment.

Top categories

Loading Svelte Themes