Database client
Use database client to interact with the database.
The database client is an export of the Drizzle client. It is automatically typed by Drizzle based on the schema and is exposed as the db object from the database package (@turbostarter/db
) in the monorepo.
This guide covers how to initialize the client and also basic operations, such as querying, creating, updating, and deleting records. To learn more about the Drizzle client, check out the official documentation.
Initializing the client
Pass the validated DATABASE_URL
to the client to initialize it.
Now it's exported from the @turbostarter/db
package and can be used across the codebase (server-side).
Querying data
To query data, you can use the db
object and its methods:
Mutating data
You can use the exported utilities to mutate data. Insert, update or delete records in fast and fully type-safe way:
Last updated on