Set up Turso

Your app works locally — the database lives on your laptop. Before you deploy, you need a production database that lives on the internet so your live app can use it. Turso hosts SQLite databases for free — the same engine your app already uses.

Sign up for Turso

Go to Turso and click Get Started. On the next screen, click Sign Up for Turso Cloud on the right side, then choose Continue with GitHub — same account you've been using.

Turso signup

Create your production database

Turso organizes databases into groups. A group has a region, and every database in that group lives in that region. Think of it like a folder — the folder decides the location, and the databases inside inherit it.

Click Create Group and name it something like aws-virginia. For the region, pick AWS US East (Virginia) — this is the same region where Vercel hosts your app.

?Why your code and database should live close together

Turso create group

Once the group is created, click Create Database. Name it something like ssr and pick aws-virginia as the group.

Turso create new database

After it's created, you'll land on the database detail page. Now proceed to click Create Token. Expires Never, authorization level Read & Write.

Turso db created

Turso create new token

Turso credentials

Copy both values now — the token is only shown once.

Auth token — This is a long string starting with eyJ....

Database URL — It looks like libsql://ssr-username.aws-us-east-1.turso.io.

Keep both values handy — you'll need them in the next two steps.

?Keeping secrets safe

Push your schema to production

Your local database already has the right tables from section 3. The production database is empty — you need to push the same schema to it, otherwise your app will try to query tables that don't exist.

Your project's atlas.hcl has a prod environment ready for this.

Run each line one at a time, replacing the values with the ones you copied:

# paste your Database URL
export DB_URL="libsql://ssr-xxxxxxxx.aws-us-east-1.turso.io"
# paste your Auth Token, the very long one
export DB_AUTH_TOKEN="eyJhbG..."
# push the schema
atlas schema apply --env prod

Atlas will show the planned changes — Hit Enter to approve and apply.

Atlas applied

Now your production database is ready and has the right tables.

?Optional: Install the Turso CLI