Skip to content

A template repository to quick start working with Next.Js, Drizzle ORM with Turso DB

Notifications You must be signed in to change notification settings

Navin-Jethwani-76/nextjs-turso-drizzle-template

Repository files navigation

Nextjs-Turso-Drizzle-Template

This is a Next.js Templarte project bootstrapped with create-next-app and configured further with Drizzle ORM and Turso.

Getting Started

  • First, clone this repository and open the project in a code editor.
git clone https://github.com/Navin-Jethwani-76/nextjs-turso-drizzle-template
cd nextjs-turbo-drizzle-template && code .
  • Sign-up on Turso and Create a Database.

  • Create a new TOKEN which will be used to connect to the database using drizzle orm.

  • Move .env to .env.local .

mv .env .env.local
  • Copy the TOKEN and URL displayed in the turso console and paste the values in .env.local file.
TURSO_DATABASE_URL=libsql://db-name-user-name.turso.io
TURSO_DATABASE_AUTH_TOKEN=SECURE_TOKEN_VALUE

Setting up the Database

  • Install the dependencies
npm install
  • The template is already configured with a default table named users. To push the table in your database, run below commands in a terminal at root of the project

  • below command will generate a folder migrations inside db

npm run db:generate
  • below command will migrate the schema to your turso database
npm run db:migrate
  • below command will seed the database with some initial values (only required once)
npm run db:seed

NOTE: You can create new Tables Schema inside db/schema.ts and run above commands (except npm run db:seed) to migrate the new changes.

Starting the Server

  • Now, run the development server:
npm run dev
  • Open http://localhost:3000 with your browser to see the result.

  • You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

  • This project uses next/font to automatically optimize and load Inter, a custom Google Font.

Learn More

To learn more about Next.js, Drrizle ORM, Turso take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your This app is to use the Vercel Platform

Vercel

Check out our Next.js deployment documentation for more details.

About

A template repository to quick start working with Next.Js, Drizzle ORM with Turso DB

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published