Database
How the database and ORM are configured in SuperDir.
By default, SuperDir uses Neon as its database provider and Drizzle as its ORM. Allow you to query the database with ease using Javascript/Typescript
Fell free to use any provider you like , such as:
Setup
Create a Neon DB Account
-
Go to the Neon and sign up for an account.
-
Create a New Database: Once logged in, create a new database instance. Note down the connection details (host, database name, username, password).
Get your URI
postgresql://username:password@hostname:port/database?sslmode=require
It is just a sample, please replace the values with your own
Schema Definition
The database schema is defined in /drizzle/db/schema.ts
. This schema file uses Prisma's schema definition language to describe your database tables, relationships, and types.
Adding a new model
Let's say we want to add a new model called Post
, describing a blog post. To do this, we would add the following to your schema:
Deploying changes
To deploy your schema changes, run the following command:
Visual database editor
SuperDir includes Drizzle Studio, which is a visual editor for your database. To start it, run the following command:
studio
application runs on https://local.drizzle.studio
.