Using the Drizzle client

Learn how to use the Drizzle client to interact with the database.

The Drizzle client is defined in the packages/database/src/client.ts file, which can be imported in your application to interact with the database.

The client is imported as db:

import { db } from '@kit/database';

From the @kit/database module, you can also import the schema:

import { user, organization } from '@kit/database';

You can then use the client to interact with the database:

import { db, user, organization } from '@kit/database';
// select all users
const allUsers = await db.select().from(user);
// insert a new organization
const newOrganization = await db.insert(organization).values({
name: 'New Organization',
});

For more information on how to use the Drizzle client, please refer to the Drizzle documentation.


Next: Authentication Configuration →