database-orm
Interaction with NeonDB Postgres using Drizzle ORM.
Installation
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
View source ↗GuidesSkill instructions
Database Logic
Stack
- Database: Neon (Serverless Postgres)
- ORM: Drizzle ORM
-
Driver:
@neondatabase/serverless
Connection
The database connection is initialized in db/index.ts.
import { neon } from '@neondatabase/serverless';
import { drizzle } from 'drizzle-orm/neon-http';
const sql = neon(process.env.DATABASE_URL!);
export const db = drizzle(sql);
Schema
Schema definitions are in db/schema.ts.
-
users,sessions,accounts,verifications: Auth tables. -
analyses,chatbot_history: App specific tables.
Operations
Example of a database query:
import { db } from "@/db";
import { users } from "@/db/schema";
import { eq } from "drizzle-orm";
// Select
const user = await db.select().from(users).where(eq(users.email, "test@example.com"));
// Insert
await db.insert(users).values({ ... });
Migrations
- Generate:
npx drizzle-kit generate - Push:
npx drizzle-kit push(or migrate script)
Examples
Read the usage examples in the source repository.
View source ↗Source history
- Indexed on
- 2026-01-20
- Index updated
- 2026-01-28
- Branch
- main
Index and sync dates describe this directory. View the source repository for code history.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!