Add Elysia API scaffold

This commit is contained in:
Asep Haryana Saputra
2026-05-22 12:25:41 +00:00
parent e543226209
commit 5e38c9276a
10 changed files with 110 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
import { env } from '../config/env';
import * as schema from './schema';
export function createDbClient() {
if (!env.databaseUrl) {
throw new Error('DATABASE_URL is required to create a database client');
}
const client = postgres(env.databaseUrl);
return drizzle(client, { schema });
}
+7
View File
@@ -0,0 +1,7 @@
import { pgTable, timestamp, uuid, varchar } from 'drizzle-orm/pg-core';
export const appEvents = pgTable('app_events', {
id: uuid('id').primaryKey().defaultRandom(),
name: varchar('name', { length: 120 }).notNull(),
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
});