Introducing the Turso Per-User Starter

Jamie BartonJamie Barton
Cover image for Introducing the Turso Per-User Starter

We're excited to announce the release of the Turso Per User Starter, a powerful Next.js boilerplate repository for building multi-tenant applications.

In today's SaaS world, multi-tenancy has become a crucial architectural pattern. However, implementing something that's robust and scalable can be challenging.

The boilerplate leverages Turso's unique multi-db schemas feature, allowing developers to create "Database per-user" or "Database per-tenant" experiences.

#Key Features

  1. Automatic Schema Migrations: Benefit from Turso's automatic propogation of schema changes from the parent to all child databases.
  2. Turso Platforms API: A powerful API for creating and managing databases for your users.
  3. Drizzle ORM: Use best-in-class ORM for interacting with your databases, and invoking migrations with the parent database.
  4. Authentication with Clerk: Secure your application with Clerk, a powerful user management platform with drop-in UI components for login, registration, and more.
  5. Next.js: Built on Next.js, providing a powerful and flexible frontend framework that handles database operations on the server, and processing webhook events from Clerk.
  6. Tailwind CSS: A utility-first CSS framework.

If you're curious how all of it works together, read the full tutorial.

#Flexibility and Scalability

The Turso Platforms Starter is designed with flexibility in mind. Developers can easily modify components to suit their needs, whether it's swapping out the ORM, changing the auth provider, or even adapting it to a differenf frontend framework.

This starter can efficiently scale up to millions of databases, making it suitable for applications of any size — all thanks to Turso's generous database allowances.

#The Power of libSQL

At the core of this starter is libSQL, the open contribution fork of SQLite by Turso. libSQL allows you to run databases locally, in the cloud, on the edge, or within your infrastructure, all using the same drivers.

The power of SQLite is that it's just a file. This means we can give users the ability to download their own data in a single click, without worrying about sharing data from neighboring users.

#Get Started Today

Deploy your own Turso powered platform in a few easy steps...

  • Create a Database
    • Once the database is created, you'll be presented with details about your database, and Connect details
    • Note down the following (you'll need these later):
      • Database name
      • Org name
      • Group Token (Create Group Token -> Create Token)
      • Platform API Token (Create Platform API Token -> Insert memorable name -> Create Token))
  • Sign up to Clerk
    • Create a new application from the dashboard
    • Note down the following (you'll need these later):
      • Public key
      • Secret key
  • Deploy with Vercel
    • Add the following environment variables (from the details you noted down earlier):
      • NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY - Clerk public key
      • CLERK_SECRET_KEY - Clerk secret key
      • TURSO_API_TOKEN - Platform API Token
      • TURSO_ORG - Org name
      • TURSO_DATABASE_NAME - Database name
      • TURSO_GROUP_AUTH_TOKEN - Group Token
    • Click Deploy and you're done!

#Extend and Contribute

The Turso Platforms Starter is available on GitHub, and you can try the demo.

We invite developers to explore, contribute, and build upon this boilerplate to create powerful, scalable multi-tenant applications.

We're excited to see what you build, so join us on Discord and share your projects!

scarf