Add PostgreSQL database layer with Kysely and migrations
- Add database.ts with connection pool, Kysely query builder, and migration runner - Create migrations for users and sessions tables (0001, 0002) - Implement PostgresAuthStore to replace InMemoryAuthStore - Wire up database service in services/index.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
// services.ts
|
||||
|
||||
import { AuthService, InMemoryAuthStore } from "../auth";
|
||||
import { AuthService } from "../auth";
|
||||
import { config } from "../config";
|
||||
import { db, migrate, migrationStatus, PostgresAuthStore } from "../database";
|
||||
import { getLogs, log } from "../logging";
|
||||
import { AnonymousUser, anonymousUser, type User } from "../user";
|
||||
|
||||
//const database = Client({
|
||||
|
||||
//})
|
||||
|
||||
const database = {};
|
||||
const database = {
|
||||
db,
|
||||
migrate,
|
||||
migrationStatus,
|
||||
};
|
||||
|
||||
const logging = {
|
||||
log,
|
||||
@@ -34,8 +35,8 @@ const session = {
|
||||
},
|
||||
};
|
||||
|
||||
// Initialize auth with in-memory store
|
||||
const authStore = new InMemoryAuthStore();
|
||||
// Initialize auth with PostgreSQL store
|
||||
const authStore = new PostgresAuthStore();
|
||||
const auth = new AuthService(authStore);
|
||||
|
||||
// Keep this asciibetically sorted
|
||||
|
||||
Reference in New Issue
Block a user