Init repo

This commit is contained in:
2026-02-26 18:27:38 +01:00
commit 27cc177cc2
32 changed files with 6465 additions and 0 deletions

14
src/lib/server/auth.ts Normal file
View File

@@ -0,0 +1,14 @@
import { betterAuth } from 'better-auth/minimal';
import { drizzleAdapter } from 'better-auth/adapters/drizzle';
import { sveltekitCookies } from 'better-auth/svelte-kit';
import { env } from '$env/dynamic/private';
import { getRequestEvent } from '$app/server';
import { db } from '$lib/server/db';
export const auth = betterAuth({
baseURL: env.ORIGIN,
secret: env.BETTER_AUTH_SECRET,
database: drizzleAdapter(db, { provider: 'sqlite' }),
emailAndPassword: { enabled: true },
plugins: [sveltekitCookies(getRequestEvent)] // make sure this is the last plugin in the array
});

View File

@@ -0,0 +1 @@
// If you see this file, you have not run the auth:schema script yet, but you should!

View File

@@ -0,0 +1,10 @@
import { drizzle } from 'drizzle-orm/libsql';
import { createClient } from '@libsql/client';
import * as schema from './schema';
import { env } from '$env/dynamic/private';
if (!env.DATABASE_URL) throw new Error('DATABASE_URL is not set');
const client = createClient({ url: env.DATABASE_URL });
export const db = drizzle(client, { schema });

View File

@@ -0,0 +1,11 @@
import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core';
export const task = sqliteTable('task', {
id: text('id')
.primaryKey()
.$defaultFn(() => crypto.randomUUID()),
title: text('title').notNull(),
priority: integer('priority').notNull().default(1)
});
export * from './auth.schema';