Skip to Content

Database Configuration

Auktiva supports two database options: SQLite for simple local deployments and Turso for cloud-based, distributed databases.

SQLite (Default)

SQLite is the simplest option, storing data in a local file. Perfect for:

  • Development environments
  • Single-server deployments
  • Small to medium workloads

Configuration

DATABASE_URL="file:./data/auktiva.db"

The path is relative to the project root. The directory will be created automatically.

Advantages

  • Zero configuration
  • No external dependencies
  • Fast for local access
  • Easy backups (just copy the file)

Limitations

  • Single server only (no horizontal scaling)
  • File must be on local filesystem
  • Not suitable for serverless deployments (Vercel, etc.)

Turso  is a distributed SQLite database built on libSQL. It provides:

  • Edge-replicated databases
  • Serverless-friendly
  • SQLite compatibility
  • Generous free tier

Setting Up Turso

  1. Create a Turso account at turso.tech 

  2. Install the Turso CLI:

# macOS brew install tursodatabase/tap/turso # Linux curl -sSfL https://get.tur.so/install.sh | bash
  1. Authenticate:
turso auth login
  1. Create a database:
turso db create auktiva
  1. Get the connection URL:
turso db show auktiva --url # Output: libsql://auktiva-yourusername.turso.io
  1. Create an auth token:
turso db tokens create auktiva # Output: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9...

Configuration

DATABASE_URL="libsql://auktiva-yourusername.turso.io" DATABASE_AUTH_TOKEN="eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9..."

Database Commands

Auktiva provides several npm scripts for database management:

CommandDescription
npm run db:generateGenerate Prisma client
npm run db:pushPush schema to database
npm run db:studioOpen Prisma Studio (GUI)
npm run seed:currenciesSeed currency data
npm run seedSeed sample data (development)

Initial Setup

After configuring your database:

# Generate the Prisma client npm run db:generate # Push the schema to your database npm run db:push # Seed required data npm run seed:currencies

Viewing Data

Use Prisma Studio to browse and edit data:

npm run db:studio

This opens a web interface at http://localhost:5555.

Schema Overview

Auktiva uses the following main tables:

  • users - User accounts
  • accounts - OAuth provider accounts (NextAuth)
  • sessions - Active sessions
  • auctions - Auction listings
  • auction_members - Auction membership and roles
  • auction_items - Items within auctions
  • item_images - Images for auction items
  • bids - Bid history
  • currencies - Supported currencies
  • notifications - User notifications
  • user_settings - User preferences

Backups

SQLite Backups

Simply copy the database file:

cp ./data/auktiva.db ./backups/auktiva-$(date +%Y%m%d).db

Turso Backups

Turso automatically handles backups. You can also export data:

turso db shell auktiva ".dump" > backup.sql
Last updated on