What Database Does usekaneo/kaneo Use? PostgreSQL with Drizzle ORM Explained
Kaneo uses PostgreSQL as its sole database, accessed through the Drizzle ORM for type-safe SQL operations.
The open-source project management platform usekaneo/kaneo stores all persistent data in PostgreSQL, with every database interaction routed through Drizzle ORM. This architecture choice is explicitly documented in the project's technical stack and implemented consistently across the API codebase.
How Kaneo Configures PostgreSQL
Database Stack Overview
According to the project's CLAUDE.md file, Kaneo's backend is built on PostgreSQL with Drizzle ORM as the database layer. This is not a generic ORM abstraction—Kaneo uses Drizzle's PostgreSQL-specific helpers throughout.
The database connection is managed through a centralized client configured with the DATABASE_URL environment variable. In apps/api/src/database/resolve-database-url.ts, the application validates and resolves this connection string before establishing any database sessions.
Schema Definition with Drizzle pgTable
All PostgreSQL tables are defined in apps/api/src/database/schema.ts using Drizzle's pgTable helper. This file contains table definitions for:
userTable— user accounts and authentication dataworkspaceTable— project workspacesprojectTable— individual projectstaskTable— tasks and assignments- Additional entities for comments, attachments, and workspace memberships
Working with PostgreSQL in Kaneo: Code Examples
The following patterns demonstrate how Kaneo interacts with PostgreSQL via Drizzle ORM.
Connecting and Importing Schema
import { db } from "@/db"; // Drizzle client (DATABASE_URL configured)
import { userTable } from "@/database/schema"; // pgTable definitions
The db client is pre-configured with PostgreSQL connection settings and exported for use across the API.
Inserting Data
await db
.insert(userTable)
.values({
id: createId(), // CUID2-generated primary key
name: "Alice Example",
email: "alice@example.com",
emailVerified: false,
createdAt: new Date(),
updatedAt: new Date(),
});
This generates and executes a parameterized PostgreSQL INSERT statement.
Querying Records
const users = await db
.select()
.from(userTable)
.where(eq(userTable.email, "alice@example.com"));
console.log(users);
Drizzle compiles this to a PostgreSQL SELECT with a WHERE clause, returning typed results.
Updating Records
await db
.update(userTable)
.set({ emailVerified: true })
.where(eq(userTable.id, "cjn0z9e4kph6b6k2v4y4"));
This executes a PostgreSQL UPDATE with proper parameterization for security.
Database Startup and Connection Validation
Before the API accepts requests, Kaneo validates its PostgreSQL connection. In apps/api/src/database/prepare-database-startup.ts, the application:
- Resolves the
DATABASE_URLenvironment variable - Tests connectivity to the PostgreSQL server
- Verifies required tables exist or triggers migrations
This ensures the application fails fast if PostgreSQL is unavailable, rather than serving degraded responses.
Key Files for Database Operations
| File | Purpose |
|---|---|
CLAUDE.md |
Documents PostgreSQL + Drizzle as the database stack |
apps/api/src/database/schema.ts |
Drizzle pgTable definitions for all tables |
apps/api/src/database/resolve-database-url.ts |
DATABASE_URL resolution logic |
apps/api/src/database/prepare-database-startup.ts |
PostgreSQL connection validation on startup |
Summary
- Kaneo uses PostgreSQL exclusively—no other database engines are configured or supported
- Drizzle ORM provides type-safe PostgreSQL access with SQL-like query syntax
- Schema definitions in
apps/api/src/database/schema.tsusepgTablehelpers - Connection management relies on the
DATABASE_URLenvironment variable - Startup validation in
prepare-database-startup.tsensures PostgreSQL availability before serving traffic
Frequently Asked Questions
Does Kaneo support MySQL or SQLite?
No. The codebase uses Drizzle's PostgreSQL-specific APIs exclusively, including pgTable, serial, varchar, and other PostgreSQL column types. Migration to another database would require replacing all schema definitions and query patterns.
How does Kaneo handle database migrations?
The project uses Drizzle's migration system. Schema changes are defined in apps/api/src/database/schema.ts and applied through Drizzle's migration tooling, which generates and executes PostgreSQL-compatible SQL migration files.
What authentication does Kaneo use for PostgreSQL?
Authentication is handled entirely through the DATABASE_URL connection string. This standard PostgreSQL URI format includes username, password, host, port, database name, and optional SSL parameters. No additional authentication layer is implemented in the application code.
Can Kaneo run without PostgreSQL?
No. The application explicitly validates PostgreSQL connectivity at startup in prepare-database-startup.ts and will exit with an error if the database is unreachable. All core functionality—user management, workspaces, projects, and tasks—depends on PostgreSQL persistence.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →