diff --git a/bun.lockb b/bun.lockb index 66641e4..13ce365 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index b99c3e9..e9054d9 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "module": "src/main.ts", "type": "module", "scripts": { - "dev": "concurrently \"bun run --hot src/main.ts\" \"bun run uno:dev\" \"bun run liveReload\"", + "dev": "concurrently \"bun run --hot src/main.ts\" \"bun run uno:dev\"", "liveReload": "bun run --hot src/dev/liveReload.ts", "start": "bun run uno && bun run src/main.ts", "db:push": "bunx drizzle-kit push:sqlite", @@ -27,11 +27,13 @@ "@elysiajs/swagger": "^0.6.2", "@kitajs/html": "^2.1.2", "@libsql/client": "^0.3.4", + "@lucia-auth/adapter-sqlite": "^2.0.0", "@t3-oss/env-core": "^0.6.1", "chokidar": "^3.5.3", "drizzle-orm": "^0.28.6", "drizzle-typebox": "^0.1.1", "elysia": "^0.6.22", + "lucia": "^2.6.0", "pino-pretty": "^10.2.0", "zod": "^3.22.2" } diff --git a/src/auth/index.ts b/src/auth/index.ts new file mode 100644 index 0000000..d16052c --- /dev/null +++ b/src/auth/index.ts @@ -0,0 +1,27 @@ +import { lucia } from "lucia"; +import { web } from "lucia/middleware"; +import { libsql } from "@lucia-auth/adapter-sqlite"; +import { config } from "../config"; +import { client } from "../db"; + +const envAliasMap = { + production: "PROD", + development: "DEV", +} as const; + +const envAlias = envAliasMap[config.env.NODE_ENV]; + +export const auth = lucia({ + env: envAlias, + middleware: web(), + sessionCookie: { + expires: false, + }, + adapter: libsql(client, { + user: "user", + key: "user_key", + session: "user_session", + }), +}); + +export type Auth = typeof auth; diff --git a/src/components/base.tsx b/src/components/base.tsx index 34288b4..7d29839 100644 --- a/src/components/base.tsx +++ b/src/components/base.tsx @@ -14,34 +14,6 @@ export const BaseHtml = ({ children }: Html.PropsWithChildren) => ( href="https://cdn.jsdelivr.net/npm/@unocss/reset/tailwind.min.css" /> - -
- - - {children} - + {children}