This is a Next.js Templarte project bootstrapped with create-next-app
and configured further with Drizzle ORM
and Turso
.
- 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
andURL
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
- 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
insidedb
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.
- 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.
To learn more about Next.js, Drrizle ORM, Turso take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
- Drizzle ORM - Drizzle ORM documentation.
- Turso Documentation - Turso documentation
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your This app is to use the Vercel Platform
Check out our Next.js deployment documentation for more details.