create-fate 0.0.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +24 -0
- package/bin/create-fate.mjs +412 -0
- package/package.json +26 -3
- package/templates/fate/README.md +8 -0
- package/templates/fate/drizzle/.github/workflows/push.yml +27 -0
- package/templates/fate/drizzle/.oxfmtrc.jsonc +23 -0
- package/templates/fate/drizzle/.vite-hooks/pre-commit +1 -0
- package/templates/fate/drizzle/.vscode/extensions.json +12 -0
- package/templates/fate/drizzle/.vscode/settings.json +25 -0
- package/templates/fate/drizzle/AGENTS.md +55 -0
- package/templates/fate/drizzle/README.md +112 -0
- package/templates/fate/drizzle/_gitignore +20 -0
- package/templates/fate/drizzle/client/package.json +58 -0
- package/templates/fate/drizzle/client/pages/index.tsx +96 -0
- package/templates/fate/drizzle/client/pages/layout.tsx +104 -0
- package/templates/fate/drizzle/client/pages/login.tsx +107 -0
- package/templates/fate/drizzle/client/pages/post/[id].tsx +22 -0
- package/templates/fate/drizzle/client/pages/search.tsx +95 -0
- package/templates/fate/drizzle/client/public/icon.svg +1 -0
- package/templates/fate/drizzle/client/src/App.css +153 -0
- package/templates/fate/drizzle/client/src/lib/AvailableLanguages.tsx +5 -0
- package/templates/fate/drizzle/client/src/lib/cx.tsx +6 -0
- package/templates/fate/drizzle/client/src/lib/env.tsx +5 -0
- package/templates/fate/drizzle/client/src/ui/Badge.tsx +31 -0
- package/templates/fate/drizzle/client/src/ui/Button.tsx +108 -0
- package/templates/fate/drizzle/client/src/ui/Card.tsx +32 -0
- package/templates/fate/drizzle/client/src/ui/CommentCard.tsx +75 -0
- package/templates/fate/drizzle/client/src/ui/Error.tsx +19 -0
- package/templates/fate/drizzle/client/src/ui/H2.tsx +15 -0
- package/templates/fate/drizzle/client/src/ui/H3.tsx +20 -0
- package/templates/fate/drizzle/client/src/ui/Header.tsx +96 -0
- package/templates/fate/drizzle/client/src/ui/Input.tsx +17 -0
- package/templates/fate/drizzle/client/src/ui/Link.tsx +11 -0
- package/templates/fate/drizzle/client/src/ui/LocaleSwitcher.tsx +52 -0
- package/templates/fate/drizzle/client/src/ui/PostCard.tsx +284 -0
- package/templates/fate/drizzle/client/src/ui/Section.tsx +23 -0
- package/templates/fate/drizzle/client/src/ui/UserCard.tsx +131 -0
- package/templates/fate/drizzle/client/src/user/AuthClient.tsx +6 -0
- package/templates/fate/drizzle/client/translations/de_DE.json +689 -0
- package/templates/fate/drizzle/client/translations/ja_JP.json +689 -0
- package/templates/fate/drizzle/client/vite.config.ts +39 -0
- package/templates/fate/drizzle/client/void.json +29 -0
- package/templates/fate/drizzle/docker-compose.yml +11 -0
- package/templates/fate/drizzle/package.json +46 -0
- package/templates/fate/drizzle/pnpm-workspace.yaml +36 -0
- package/templates/fate/drizzle/public/fate-logo-dark.svg +4 -0
- package/templates/fate/drizzle/public/fate-logo.svg +4 -0
- package/templates/fate/drizzle/server/.env.example +5 -0
- package/templates/fate/drizzle/server/drizzle.config.ts +11 -0
- package/templates/fate/drizzle/server/package.json +48 -0
- package/templates/fate/drizzle/server/src/__tests__/index.test.tsx +5 -0
- package/templates/fate/drizzle/server/src/app.tsx +44 -0
- package/templates/fate/drizzle/server/src/drizzle/db.ts +25 -0
- package/templates/fate/drizzle/server/src/drizzle/queries.ts +89 -0
- package/templates/fate/drizzle/server/src/drizzle/schema.ts +174 -0
- package/templates/fate/drizzle/server/src/drizzle/seed.tsx +77 -0
- package/templates/fate/drizzle/server/src/drizzle/seedData.ts +205 -0
- package/templates/fate/drizzle/server/src/index.tsx +24 -0
- package/templates/fate/drizzle/server/src/lib/auth.ts +33 -0
- package/templates/fate/drizzle/server/src/lib/env.ts +3 -0
- package/templates/fate/drizzle/server/src/lib/origins.ts +18 -0
- package/templates/fate/drizzle/server/src/router.ts +15 -0
- package/templates/fate/drizzle/server/src/trpc/connection.ts +4 -0
- package/templates/fate/drizzle/server/src/trpc/context.ts +22 -0
- package/templates/fate/drizzle/server/src/trpc/init.ts +51 -0
- package/templates/fate/drizzle/server/src/trpc/routers/comment.ts +146 -0
- package/templates/fate/drizzle/server/src/trpc/routers/post.ts +99 -0
- package/templates/fate/drizzle/server/src/trpc/routers/user.ts +68 -0
- package/templates/fate/drizzle/server/src/trpc/views.ts +75 -0
- package/templates/fate/drizzle/server/src/user/SessionUser.tsx +17 -0
- package/templates/fate/drizzle/server/vite.config.ts +8 -0
- package/templates/fate/drizzle/tsconfig.json +33 -0
- package/templates/fate/drizzle/vite.config.ts +71 -0
- package/templates/fate/http/.github/workflows/push.yml +27 -0
- package/templates/fate/http/.oxfmtrc.jsonc +23 -0
- package/templates/fate/http/.vite-hooks/pre-commit +1 -0
- package/templates/fate/http/.vscode/extensions.json +12 -0
- package/templates/fate/http/.vscode/settings.json +25 -0
- package/templates/fate/http/AGENTS.md +55 -0
- package/templates/fate/http/README.md +112 -0
- package/templates/fate/http/_gitignore +20 -0
- package/templates/fate/http/client/package.json +56 -0
- package/templates/fate/http/client/pages/index.tsx +96 -0
- package/templates/fate/http/client/pages/layout.tsx +89 -0
- package/templates/fate/http/client/pages/login.tsx +107 -0
- package/templates/fate/http/client/pages/post/[id].tsx +22 -0
- package/templates/fate/http/client/pages/search.tsx +95 -0
- package/templates/fate/http/client/public/icon.svg +1 -0
- package/templates/fate/http/client/src/App.css +153 -0
- package/templates/fate/http/client/src/lib/AvailableLanguages.tsx +5 -0
- package/templates/fate/http/client/src/lib/cx.tsx +6 -0
- package/templates/fate/http/client/src/lib/env.tsx +5 -0
- package/templates/fate/http/client/src/ui/Badge.tsx +31 -0
- package/templates/fate/http/client/src/ui/Button.tsx +108 -0
- package/templates/fate/http/client/src/ui/Card.tsx +32 -0
- package/templates/fate/http/client/src/ui/CommentCard.tsx +75 -0
- package/templates/fate/http/client/src/ui/Error.tsx +19 -0
- package/templates/fate/http/client/src/ui/H2.tsx +15 -0
- package/templates/fate/http/client/src/ui/H3.tsx +20 -0
- package/templates/fate/http/client/src/ui/Header.tsx +96 -0
- package/templates/fate/http/client/src/ui/Input.tsx +17 -0
- package/templates/fate/http/client/src/ui/Link.tsx +11 -0
- package/templates/fate/http/client/src/ui/LocaleSwitcher.tsx +52 -0
- package/templates/fate/http/client/src/ui/PostCard.tsx +281 -0
- package/templates/fate/http/client/src/ui/Section.tsx +23 -0
- package/templates/fate/http/client/src/ui/UserCard.tsx +131 -0
- package/templates/fate/http/client/src/user/AuthClient.tsx +6 -0
- package/templates/fate/http/client/translations/de_DE.json +689 -0
- package/templates/fate/http/client/translations/ja_JP.json +689 -0
- package/templates/fate/http/client/vite.config.ts +40 -0
- package/templates/fate/http/client/void.json +29 -0
- package/templates/fate/http/docker-compose.yml +11 -0
- package/templates/fate/http/package.json +46 -0
- package/templates/fate/http/pnpm-workspace.yaml +36 -0
- package/templates/fate/http/public/fate-logo-dark.svg +4 -0
- package/templates/fate/http/public/fate-logo.svg +4 -0
- package/templates/fate/http/server/.env.example +5 -0
- package/templates/fate/http/server/drizzle.config.ts +11 -0
- package/templates/fate/http/server/package.json +46 -0
- package/templates/fate/http/server/src/__tests__/index.test.tsx +5 -0
- package/templates/fate/http/server/src/app.tsx +36 -0
- package/templates/fate/http/server/src/drizzle/db.ts +25 -0
- package/templates/fate/http/server/src/drizzle/queries.ts +89 -0
- package/templates/fate/http/server/src/drizzle/schema.ts +174 -0
- package/templates/fate/http/server/src/drizzle/seed.tsx +77 -0
- package/templates/fate/http/server/src/drizzle/seedData.ts +205 -0
- package/templates/fate/http/server/src/fate/context.ts +20 -0
- package/templates/fate/http/server/src/fate/server.ts +285 -0
- package/templates/fate/http/server/src/fate/views.ts +75 -0
- package/templates/fate/http/server/src/index.tsx +24 -0
- package/templates/fate/http/server/src/lib/auth.ts +33 -0
- package/templates/fate/http/server/src/lib/env.ts +3 -0
- package/templates/fate/http/server/src/lib/origins.ts +18 -0
- package/templates/fate/http/server/src/router.ts +2 -0
- package/templates/fate/http/server/src/user/SessionUser.tsx +17 -0
- package/templates/fate/http/server/vite.config.ts +8 -0
- package/templates/fate/http/tsconfig.json +33 -0
- package/templates/fate/http/vite.config.ts +71 -0
- package/templates/fate/prisma/.github/workflows/push.yml +27 -0
- package/templates/fate/prisma/.oxfmtrc.jsonc +23 -0
- package/templates/fate/prisma/.vite-hooks/pre-commit +1 -0
- package/templates/fate/prisma/.vscode/extensions.json +12 -0
- package/templates/fate/prisma/.vscode/settings.json +25 -0
- package/templates/fate/prisma/AGENTS.md +55 -0
- package/templates/fate/prisma/README.md +126 -0
- package/templates/fate/prisma/_gitignore +20 -0
- package/templates/fate/prisma/client/package.json +58 -0
- package/templates/fate/prisma/client/pages/index.tsx +96 -0
- package/templates/fate/prisma/client/pages/layout.tsx +94 -0
- package/templates/fate/prisma/client/pages/login.tsx +107 -0
- package/templates/fate/prisma/client/pages/post/[id].tsx +22 -0
- package/templates/fate/prisma/client/pages/search.tsx +95 -0
- package/templates/fate/prisma/client/public/icon.svg +1 -0
- package/templates/fate/prisma/client/src/App.css +153 -0
- package/templates/fate/prisma/client/src/lib/AvailableLanguages.tsx +5 -0
- package/templates/fate/prisma/client/src/lib/cx.tsx +6 -0
- package/templates/fate/prisma/client/src/lib/env.tsx +5 -0
- package/templates/fate/prisma/client/src/ui/Badge.tsx +31 -0
- package/templates/fate/prisma/client/src/ui/Button.tsx +108 -0
- package/templates/fate/prisma/client/src/ui/Card.tsx +32 -0
- package/templates/fate/prisma/client/src/ui/CommentCard.tsx +75 -0
- package/templates/fate/prisma/client/src/ui/Error.tsx +19 -0
- package/templates/fate/prisma/client/src/ui/H2.tsx +15 -0
- package/templates/fate/prisma/client/src/ui/H3.tsx +20 -0
- package/templates/fate/prisma/client/src/ui/Header.tsx +96 -0
- package/templates/fate/prisma/client/src/ui/Input.tsx +17 -0
- package/templates/fate/prisma/client/src/ui/Link.tsx +11 -0
- package/templates/fate/prisma/client/src/ui/LocaleSwitcher.tsx +52 -0
- package/templates/fate/prisma/client/src/ui/PostCard.tsx +281 -0
- package/templates/fate/prisma/client/src/ui/Section.tsx +23 -0
- package/templates/fate/prisma/client/src/ui/UserCard.tsx +131 -0
- package/templates/fate/prisma/client/src/user/AuthClient.tsx +6 -0
- package/templates/fate/prisma/client/translations/de_DE.json +689 -0
- package/templates/fate/prisma/client/translations/ja_JP.json +689 -0
- package/templates/fate/prisma/client/vite.config.ts +39 -0
- package/templates/fate/prisma/client/void.json +29 -0
- package/templates/fate/prisma/docker-compose.yml +11 -0
- package/templates/fate/prisma/package.json +47 -0
- package/templates/fate/prisma/pnpm-workspace.yaml +39 -0
- package/templates/fate/prisma/public/fate-logo-dark.svg +4 -0
- package/templates/fate/prisma/public/fate-logo.svg +4 -0
- package/templates/fate/prisma/server/.env.example +5 -0
- package/templates/fate/prisma/server/package.json +42 -0
- package/templates/fate/prisma/server/prisma.config.ts +21 -0
- package/templates/fate/prisma/server/src/__tests__/index.test.tsx +5 -0
- package/templates/fate/prisma/server/src/app.tsx +40 -0
- package/templates/fate/prisma/server/src/index.tsx +24 -0
- package/templates/fate/prisma/server/src/lib/auth.ts +31 -0
- package/templates/fate/prisma/server/src/lib/env.ts +3 -0
- package/templates/fate/prisma/server/src/lib/origins.ts +18 -0
- package/templates/fate/prisma/server/src/prisma/prisma.ts +9 -0
- package/templates/fate/prisma/server/src/prisma/schema.prisma +98 -0
- package/templates/fate/prisma/server/src/prisma/seed.tsx +71 -0
- package/templates/fate/prisma/server/src/prisma/seedData.ts +205 -0
- package/templates/fate/prisma/server/src/router.ts +14 -0
- package/templates/fate/prisma/server/src/trpc/connection.ts +4 -0
- package/templates/fate/prisma/server/src/trpc/context.ts +22 -0
- package/templates/fate/prisma/server/src/trpc/init.ts +8 -0
- package/templates/fate/prisma/server/src/trpc/routers/comment.ts +176 -0
- package/templates/fate/prisma/server/src/trpc/routers/post.ts +154 -0
- package/templates/fate/prisma/server/src/trpc/routers/user.ts +71 -0
- package/templates/fate/prisma/server/src/trpc/views.ts +77 -0
- package/templates/fate/prisma/server/src/user/SessionUser.tsx +17 -0
- package/templates/fate/prisma/server/vite.config.ts +8 -0
- package/templates/fate/prisma/tsconfig.json +33 -0
- package/templates/fate/prisma/vite.config.ts +72 -0
- package/templates/fate/void/.oxfmtrc.jsonc +14 -0
- package/templates/fate/void/README.md +55 -0
- package/templates/fate/void/auth.ts +22 -0
- package/templates/fate/void/db/migrations/20260508073357_initial_schema.sql +133 -0
- package/templates/fate/void/db/migrations/20260508120500_seed_void_demo.sql +170 -0
- package/templates/fate/void/db/migrations/meta/20260508073357_snapshot.json +868 -0
- package/templates/fate/void/db/migrations/meta/_journal.json +20 -0
- package/templates/fate/void/db/queries.ts +211 -0
- package/templates/fate/void/db/schema.ts +325 -0
- package/templates/fate/void/db/seed-auth.ts +31 -0
- package/templates/fate/void/db/seed.ts +163 -0
- package/templates/fate/void/middleware/01.shared.ts +29 -0
- package/templates/fate/void/package.json +65 -0
- package/templates/fate/void/pages/category/[id].tsx +23 -0
- package/templates/fate/void/pages/index.tsx +153 -0
- package/templates/fate/void/pages/layout.tsx +46 -0
- package/templates/fate/void/pages/login.tsx +103 -0
- package/templates/fate/void/pages/post/[id].tsx +20 -0
- package/templates/fate/void/pages/search.tsx +81 -0
- package/templates/fate/void/pnpm-workspace.yaml +31 -0
- package/templates/fate/void/public/.assetsignore +1 -0
- package/templates/fate/void/public/icon.svg +1 -0
- package/templates/fate/void/routes/fate-live.ts +8 -0
- package/templates/fate/void/routes/fate.ts +8 -0
- package/templates/fate/void/seedData.ts +535 -0
- package/templates/fate/void/src/App.css +130 -0
- package/templates/fate/void/src/fate/__tests__/commentPermissions.test.ts +31 -0
- package/templates/fate/void/src/fate/commentPermissions.ts +17 -0
- package/templates/fate/void/src/fate/context.ts +15 -0
- package/templates/fate/void/src/fate/live.ts +6 -0
- package/templates/fate/void/src/fate/server.ts +401 -0
- package/templates/fate/void/src/fate/views.ts +164 -0
- package/templates/fate/void/src/lib/cx.tsx +6 -0
- package/templates/fate/void/src/lib/formatLabel.tsx +6 -0
- package/templates/fate/void/src/lib/shared.ts +10 -0
- package/templates/fate/void/src/ui/Badge.tsx +31 -0
- package/templates/fate/void/src/ui/Button.tsx +92 -0
- package/templates/fate/void/src/ui/Card.tsx +29 -0
- package/templates/fate/void/src/ui/CategoryCard.tsx +105 -0
- package/templates/fate/void/src/ui/CommentCard.tsx +80 -0
- package/templates/fate/void/src/ui/CreatePost.tsx +111 -0
- package/templates/fate/void/src/ui/Error.tsx +19 -0
- package/templates/fate/void/src/ui/EventCard.tsx +152 -0
- package/templates/fate/void/src/ui/H2.tsx +15 -0
- package/templates/fate/void/src/ui/H3.tsx +20 -0
- package/templates/fate/void/src/ui/Header.tsx +96 -0
- package/templates/fate/void/src/ui/Input.tsx +33 -0
- package/templates/fate/void/src/ui/Link.tsx +11 -0
- package/templates/fate/void/src/ui/Number.tsx +5 -0
- package/templates/fate/void/src/ui/PostCard.tsx +294 -0
- package/templates/fate/void/src/ui/Section.tsx +23 -0
- package/templates/fate/void/src/ui/TagBadge.tsx +23 -0
- package/templates/fate/void/src/ui/UserCard.tsx +129 -0
- package/templates/fate/void/src/user/AuthClient.tsx +1 -0
- package/templates/fate/void/src/user/SessionUser.tsx +17 -0
- package/templates/fate/void/tsconfig.json +34 -0
- package/templates/fate/void/vite.config.ts +83 -0
- package/templates/fate/void/void.json +32 -0
- package/templates/fate/void/wrangler.jsonc +16 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import fbteePreset from '@nkzw/babel-preset-fbtee';
|
|
3
|
+
import babel from '@rolldown/plugin-babel';
|
|
4
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
5
|
+
import { reactCompilerPreset } from '@vitejs/plugin-react';
|
|
6
|
+
import { voidReact } from '@void/react/plugin';
|
|
7
|
+
import dotenv from 'dotenv';
|
|
8
|
+
import { fate } from 'react-fate/vite';
|
|
9
|
+
import { defineConfig, lazyPlugins } from 'vite-plus';
|
|
10
|
+
import { voidPlugin } from 'void';
|
|
11
|
+
|
|
12
|
+
const root = process.cwd();
|
|
13
|
+
const isDevelopment = process.env.NODE_ENV === 'development' || process.env.DEV;
|
|
14
|
+
|
|
15
|
+
dotenv.config({
|
|
16
|
+
path: join(root, '../server', isDevelopment ? '.env' : '.prod.env'),
|
|
17
|
+
quiet: true,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
if (!process.env.VITE_SERVER_URL) {
|
|
21
|
+
throw new Error(`client-build, vite.config: 'VITE_SERVER_URL' is missing.`);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default defineConfig({
|
|
25
|
+
build: { outDir: join(root, '../dist/client') },
|
|
26
|
+
plugins: [
|
|
27
|
+
...(lazyPlugins(() => [
|
|
28
|
+
babel({
|
|
29
|
+
presets: [fbteePreset, reactCompilerPreset()],
|
|
30
|
+
}),
|
|
31
|
+
tailwindcss(),
|
|
32
|
+
voidPlugin(),
|
|
33
|
+
voidReact(),
|
|
34
|
+
]) ?? []),
|
|
35
|
+
fate({
|
|
36
|
+
module: '@app/server/src/router.ts',
|
|
37
|
+
}),
|
|
38
|
+
],
|
|
39
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/void/schema.json",
|
|
3
|
+
"target": "node",
|
|
4
|
+
"head": {
|
|
5
|
+
"title": "fate",
|
|
6
|
+
"htmlAttrs": {
|
|
7
|
+
"lang": "en"
|
|
8
|
+
},
|
|
9
|
+
"meta": [
|
|
10
|
+
{
|
|
11
|
+
"charset": "utf-8"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "viewport",
|
|
15
|
+
"content": "width=device-width, initial-scale=1"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "theme-color",
|
|
19
|
+
"content": "#fff"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"link": [
|
|
23
|
+
{
|
|
24
|
+
"rel": "icon",
|
|
25
|
+
"href": "/icon.svg"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fate-app",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "fate is a modern data client for React.",
|
|
6
|
+
"author": "Christoph Nakazawa <christoph.pojer@gmail.com>",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git://github.com/nkzw-tech/fate.git"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "dotenv -e server/.env -- vp run --filter '@app/client' --filter '@app/server' build",
|
|
14
|
+
"dev": "npm-run-all --parallel dev:client dev:server",
|
|
15
|
+
"dev:client": "cd client && vp dev",
|
|
16
|
+
"dev:server": "cd server && vp run dev",
|
|
17
|
+
"dev:setup": "vp run --filter '@app/client' --filter '@app/server' dev:setup && vp run fate:generate",
|
|
18
|
+
"fate:generate": "vp run --filter '@app/client' fate:generate",
|
|
19
|
+
"prepare": "vp config",
|
|
20
|
+
"prisma": "vp run --filter '@app/server' prisma"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@app/server": "workspace:*",
|
|
24
|
+
"@nkzw/eslint-plugin": "^2.0.0",
|
|
25
|
+
"@nkzw/oxlint-config": "^1.2.1",
|
|
26
|
+
"@swc/core": "^1.15.33",
|
|
27
|
+
"@types/node": "^25.6.0",
|
|
28
|
+
"@typescript/native-preview": "7.0.0-dev.20260505.1",
|
|
29
|
+
"babel-plugin-react-compiler": "^1.0.0",
|
|
30
|
+
"dotenv": "^17.4.2",
|
|
31
|
+
"dotenv-cli": "^11.0.0",
|
|
32
|
+
"eslint-plugin-no-only-tests": "^3.4.0",
|
|
33
|
+
"eslint-plugin-perfectionist": "^5.9.0",
|
|
34
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
35
|
+
"npm-run-all2": "^8.0.4",
|
|
36
|
+
"prisma": "^7.8.0",
|
|
37
|
+
"ts-node": "^10.9.2",
|
|
38
|
+
"vite": "catalog:",
|
|
39
|
+
"vite-plus": "catalog:",
|
|
40
|
+
"vitest": "catalog:"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=24.0.0",
|
|
44
|
+
"pnpm": ">=11.0.0"
|
|
45
|
+
},
|
|
46
|
+
"packageManager": "pnpm@11.0.6"
|
|
47
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
packages:
|
|
2
|
+
- client
|
|
3
|
+
- server
|
|
4
|
+
|
|
5
|
+
allowBuilds:
|
|
6
|
+
'@prisma/engines': true
|
|
7
|
+
'@swc/core': true
|
|
8
|
+
better-sqlite3: true
|
|
9
|
+
esbuild: true
|
|
10
|
+
prisma: true
|
|
11
|
+
sharp: true
|
|
12
|
+
workerd: true
|
|
13
|
+
|
|
14
|
+
catalog:
|
|
15
|
+
vite: npm:@voidzero-dev/vite-plus-core@^0.1.20
|
|
16
|
+
vite-plus: ^0.1.20
|
|
17
|
+
vitest: npm:@voidzero-dev/vite-plus-test@^0.1.20
|
|
18
|
+
|
|
19
|
+
onlyBuiltDependencies:
|
|
20
|
+
- '@prisma/client'
|
|
21
|
+
- '@prisma/engines'
|
|
22
|
+
- '@swc/core'
|
|
23
|
+
- '@tailwindcss/oxide'
|
|
24
|
+
- esbuild
|
|
25
|
+
- msgpackr-extract
|
|
26
|
+
- prisma
|
|
27
|
+
- unrs-resolver
|
|
28
|
+
|
|
29
|
+
overrides:
|
|
30
|
+
vite: 'catalog:'
|
|
31
|
+
vitest: 'catalog:'
|
|
32
|
+
|
|
33
|
+
peerDependencyRules:
|
|
34
|
+
allowAny:
|
|
35
|
+
- vite
|
|
36
|
+
- vitest
|
|
37
|
+
allowedVersions:
|
|
38
|
+
vite: '*'
|
|
39
|
+
vitest: '*'
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMax" viewBox="0 0 369 172">
|
|
2
|
+
<path d="M86.983 23.465h.272c1.797-.005 3.563.177 5.331.496l.349.063c5.588 1.02 10.731 3.447 15.201 6.933l.347.267c1.579 1.26 3.083 2.684 4.386 4.227l.161.186c4.018 4.719 6.924 10.686 7.767 16.852l.033.239c.262 1.848.351 3.688.352 5.551l.001.307c-.001 1.623-.092 3.188-.386 4.788l-.05.292c-1.003 5.874-3.476 11.447-7.286 16.034l-.29.358c-1.422 1.721-3.011 3.382-4.797 4.729l-.444.354c-3.046 2.405-6.436 4.147-10.084 5.442l-.497.186c-1.766.627-3.615.974-5.465 1.266l-.364.058c-1.591.238-3.185.286-4.791.281h-.499l-1.339-.002h-1.408c-.886-.001-1.772-.001-2.656-.003-3.085-.001-6.163-.005-9.247-.008v-12.78l3.606-.006 2.282-.007c1.205-.006 2.407-.01 3.611-.011.878 0 1.754-.003 2.63-.007.462-.002.928-.005 1.389-.002 6.302.01 12.003-1.72 16.65-6.117l.291-.272c3.951-3.807 6.097-9.302 6.241-14.736.04-3.078-.476-6.048-1.68-8.892l-.104-.244c-2.382-5.559-6.98-9.439-12.504-11.675-2.204-.816-4.522-1.16-6.863-1.134-.301.004-.606.004-.909.001-1.677.003-3.304.127-4.924.591l-.331.098c-2.625.758-5.093 1.928-7.254 3.607l-.323.249c-1.046.817-2.031 1.682-2.873 2.71l-.154.179c-2.354 2.782-3.9 5.988-4.727 9.529l-.054.229c-.391 1.8-.423 3.633-.42 5.471l-.001.74c.002 1.4.001 2.801-.004 4.201l-.004 3.779c0 1.824-.001 3.649-.003 5.473l-.006 2.813-.005 6.076-.001.267-.008 8.614c-.001 2.023-.004 4.045-.006 6.066v.259l-.004 2.55-.006 5.46c0 1.331-.001 2.658-.003 3.985-.002.72-.002 1.438-.002 2.156 0 .658 0 1.317-.002 1.978v.708c.004 2.098-.07 4.214-.545 6.263l-.077.359-.161.716c-.071.302-.136.605-.199.909-.55 2.538-1.6 5.067-2.832 7.348l-.214.42c-.965 1.921-2.22 3.714-3.574 5.38l-.152.183c-.78.973-1.639 1.866-2.519 2.751l-.308.313a25.81 25.81 0 0 1-2.226 1.955l-.22.179c-3.698 2.953-7.975 5.044-12.538 6.262-.212.056-.422.115-.631.176-8.366 2.287-17.8.738-25.278-3.512-3.639-2.122-7.171-4.945-9.721-8.307-.121-.15-.241-.298-.356-.448A36.247 36.247 0 0 1 .949 131.4l-.144-.234c-.889-1.466-1.562-3.034-2.222-4.617l-.11-.265c-3.253-7.791-2.911-17.367.184-25.133.865-2.069 1.869-4.089 3.123-5.951l.172-.261a31.91 31.91 0 0 1 2.547-3.29l.229-.263c.13-.152.266-.304.396-.452l.425-.493c1.216-1.389 2.593-2.615 4.068-3.723.208-.157.414-.315.62-.476 1.184-.901 2.437-1.665 3.729-2.4l.272-.159c1.586-.893 3.235-1.573 4.934-2.21l.253-.097c4.232-1.567 8.615-1.836 13.079-1.82 1.359 0 2.732.002 4.093.007 1.209.005 2.417.006 3.621.006 1.899.002 3.794.007 5.688.012v12.78l-3.612.013-2.282.011c-1.201.005-2.401.012-3.61.016-.876.003-1.751.005-2.629.013-.463.002-.924.005-1.387.006-4.322.005-8.193.592-12.033 2.662l-.217.114c-1.458.773-2.697 1.731-3.908 2.849-.206.185-.413.362-.63.535-.435.376-.794.788-1.16 1.232l-.153.18a21.18 21.18 0 0 0-4.474 8.651l-.094.342c-.42 1.682-.54 3.395-.536 5.127v.272c.019 5.672 2.392 10.671 6.206 14.769l.215.237c3.296 3.453 8.483 5.917 13.247 6.046.448.008.896.01 1.345.01.276 0 .553.003.835.005 4.917.019 9.864-1.73 13.577-4.995l.303-.267c.299-.263.592-.527.881-.799l.262-.247c.787-.756 1.451-1.599 2.104-2.474l.151-.201c1.929-2.606 3.117-5.723 3.635-8.909l.059-.362c.194-1.296.21-2.573.207-3.883l.003-.74v-2.02c0-.73 0-1.459.005-2.188v-3.782c0-1.827.004-3.654.007-5.481 0-.939 0-1.877.004-2.816l.003-6.082v-.268c.005-2.876.008-5.75.008-8.627l.013-8.883c.004-1.823.004-3.646.004-5.469 0-1.33.004-2.659.004-3.989.003-.721.003-1.442.003-2.159v-1.98c.005-.237.005-.473 0-.711-.011-8.523 3.072-17.023 8.941-23.268.244-.263.483-.531.717-.805.416-.48.861-.918 1.324-1.352l.252-.232a26.259 26.259 0 0 1 2.184-1.812l.46-.349c1.39-1.058 2.837-1.951 4.375-2.775l.318-.172c5.005-2.666 10.5-3.877 16.15-3.889Z" style="transform-box:fill-box;transform-origin:50% 50%;fill:#bfbfbf" transform="rotate(-31 0 0)"/>
|
|
3
|
+
<path fill="#fff" d="M157.805 24.517c-4.326 0-7.594.981-9.807 2.942-2.214 1.962-3.572 4.954-4.075 8.978l-1.508 10.561h19.161l-3.016 10.713h-17.654l-9.054 64.428c-1.005 7.342-2.69 13.201-5.054 17.577-2.363 4.376-5.431 7.922-9.203 10.638-3.773 2.715-8.927 5.481-15.466 8.297l-3.923-10.41c4.225-1.911 7.569-3.772 10.033-5.582 2.465-1.811 4.527-4.326 6.187-7.544 1.66-3.22 2.892-7.545 3.696-12.976l9.053-64.428h-14.032l1.509-10.713h14.032l1.66-11.315c.906-6.84 3.722-12.273 8.45-16.296 4.727-4.024 10.913-6.035 18.558-6.035 3.621 0 6.84.452 9.657 1.358 2.816.905 5.834 2.364 9.053 4.375l-5.281 9.204c-3.722-2.514-8.047-3.772-12.976-3.772Zm43.956 20.672c4.929 0 9.631.552 14.107 1.659 4.477 1.107 9.079 2.816 13.806 5.13l-8.147 56.43c-.202 1.61-.302 2.716-.302 3.319 0 1.811.377 3.27 1.131 4.376.755 1.107 2.088 2.012 3.999 2.716l-3.923 9.506c-4.225-.503-7.494-1.811-9.807-3.923-2.315-2.113-3.722-5.231-4.226-9.355-3.218 4.124-6.84 7.368-10.863 9.732-4.024 2.364-8.299 3.546-12.825 3.546-8.047 0-14.283-2.766-18.709-8.299-4.427-5.532-6.639-12.926-6.639-22.18 0-8.047 1.484-16.093 4.451-24.141 2.967-8.047 7.619-14.811 13.957-20.294 6.337-5.482 14.334-8.222 23.99-8.222Zm.302 11.014c-6.338 0-11.594 2.137-15.768 6.412-4.174 4.276-7.242 9.607-9.204 15.993-1.961 6.388-2.941 12.851-2.941 19.389 0 6.538 1.157 11.392 3.47 14.56 2.313 3.169 5.632 4.753 9.958 4.753 4.124 0 7.82-1.257 11.09-3.772 3.268-2.515 6.663-6.136 10.185-10.863l6.186-43.908c-2.113-.904-4.15-1.559-6.111-1.961-1.961-.402-4.25-.603-6.865-.603Zm57.687 49.338c-.201 2.012-.302 3.32-.302 3.923 0 2.515.579 4.351 1.735 5.508 1.157 1.156 2.943 1.734 5.357 1.734 1.811 0 3.596-.276 5.356-.829 1.761-.553 3.797-1.383 6.111-2.489l4.526 9.656c-5.532 3.52-11.417 5.281-17.653 5.281-6.135 0-10.864-1.584-14.183-4.754-3.319-3.168-4.979-7.669-4.979-13.503 0-2.113.101-3.722.302-4.829l6.639-47.528h-13.73l1.509-10.713h14.333l4.979-18.407 10.864-1.207-2.716 19.614h18.709l-3.017 10.713h-17.201l-6.639 47.83Zm94.35-40.134c0 10.159-4.527 17.502-13.58 22.029-9.052 4.525-21.727 7.695-38.022 9.504.302 13.178 6.035 19.766 17.201 19.766 3.721 0 7.293-.603 10.713-1.81 3.42-1.208 6.94-3.068 10.562-5.583l5.884 9.356c-8.953 6.436-18.458 9.656-28.517 9.656-9.656 0-17.125-2.842-22.407-8.526-5.281-5.682-7.921-13.604-7.921-23.763 0-7.947 1.383-15.817 4.149-23.614 2.767-7.795 7.218-14.283 13.353-19.463 6.137-5.181 13.932-7.77 23.388-7.77 8.047 0 14.258 1.961 18.634 5.884 4.375 3.922 6.563 8.701 6.563 14.334Zm-50.848 20.972c12.473-1.408 21.652-3.571 27.537-6.487 5.884-2.918 8.826-7.595 8.826-14.033 0-2.414-.854-4.627-2.565-6.639-1.709-2.012-4.476-3.017-8.299-3.017-7.644 0-13.528 2.917-17.653 8.75-4.124 5.835-6.739 12.977-7.846 21.426Z"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMax" viewBox="0 0 369 172">
|
|
2
|
+
<path d="M86.983 23.465h.272c1.797-.005 3.563.177 5.331.496l.349.063c5.588 1.02 10.731 3.447 15.201 6.933l.347.267c1.579 1.26 3.083 2.684 4.386 4.227l.161.186c4.018 4.719 6.924 10.686 7.767 16.852l.033.239c.262 1.848.351 3.688.352 5.551l.001.307c-.001 1.623-.092 3.188-.386 4.788l-.05.292c-1.003 5.874-3.476 11.447-7.286 16.034l-.29.358c-1.422 1.721-3.011 3.382-4.797 4.729l-.444.354c-3.046 2.405-6.436 4.147-10.084 5.442l-.497.186c-1.766.627-3.615.974-5.465 1.266l-.364.058c-1.591.238-3.185.286-4.791.281h-.499l-1.339-.002h-1.408c-.886-.001-1.772-.001-2.656-.003-3.085-.001-6.163-.005-9.247-.008v-12.78l3.606-.006 2.282-.007c1.205-.006 2.407-.01 3.611-.011.878 0 1.754-.003 2.63-.007.462-.002.928-.005 1.389-.002 6.302.01 12.003-1.72 16.65-6.117l.291-.272c3.951-3.807 6.097-9.302 6.241-14.736.04-3.078-.476-6.048-1.68-8.892l-.104-.244c-2.382-5.559-6.98-9.439-12.504-11.675-2.204-.816-4.522-1.16-6.863-1.134-.301.004-.606.004-.909.001-1.677.003-3.304.127-4.924.591l-.331.098c-2.625.758-5.093 1.928-7.254 3.607l-.323.249c-1.046.817-2.031 1.682-2.873 2.71l-.154.179c-2.354 2.782-3.9 5.988-4.727 9.529l-.054.229c-.391 1.8-.423 3.633-.42 5.471l-.001.74c.002 1.4.001 2.801-.004 4.201l-.004 3.779c0 1.824-.001 3.649-.003 5.473l-.006 2.813-.005 6.076-.001.267-.008 8.614c-.001 2.023-.004 4.045-.006 6.066v.259l-.004 2.55-.006 5.46c0 1.331-.001 2.658-.003 3.985-.002.72-.002 1.438-.002 2.156 0 .658 0 1.317-.002 1.978v.708c.004 2.098-.07 4.214-.545 6.263l-.077.359-.161.716c-.071.302-.136.605-.199.909-.55 2.538-1.6 5.067-2.832 7.348l-.214.42c-.965 1.921-2.22 3.714-3.574 5.38l-.152.183c-.78.973-1.639 1.866-2.519 2.751l-.308.313a25.81 25.81 0 0 1-2.226 1.955l-.22.179c-3.698 2.953-7.975 5.044-12.538 6.262-.212.056-.422.115-.631.176-8.366 2.287-17.8.738-25.278-3.512-3.639-2.122-7.171-4.945-9.721-8.307-.121-.15-.241-.298-.356-.448A36.247 36.247 0 0 1 .949 131.4l-.144-.234c-.889-1.466-1.562-3.034-2.222-4.617l-.11-.265c-3.253-7.791-2.911-17.367.184-25.133.865-2.069 1.869-4.089 3.123-5.951l.172-.261a31.91 31.91 0 0 1 2.547-3.29l.229-.263c.13-.152.266-.304.396-.452l.425-.493c1.216-1.389 2.593-2.615 4.068-3.723.208-.157.414-.315.62-.476 1.184-.901 2.437-1.665 3.729-2.4l.272-.159c1.586-.893 3.235-1.573 4.934-2.21l.253-.097c4.232-1.567 8.615-1.836 13.079-1.82 1.359 0 2.732.002 4.093.007 1.209.005 2.417.006 3.621.006 1.899.002 3.794.007 5.688.012v12.78l-3.612.013-2.282.011c-1.201.005-2.401.012-3.61.016-.876.003-1.751.005-2.629.013-.463.002-.924.005-1.387.006-4.322.005-8.193.592-12.033 2.662l-.217.114c-1.458.773-2.697 1.731-3.908 2.849-.206.185-.413.362-.63.535-.435.376-.794.788-1.16 1.232l-.153.18a21.18 21.18 0 0 0-4.474 8.651l-.094.342c-.42 1.682-.54 3.395-.536 5.127v.272c.019 5.672 2.392 10.671 6.206 14.769l.215.237c3.296 3.453 8.483 5.917 13.247 6.046.448.008.896.01 1.345.01.276 0 .553.003.835.005 4.917.019 9.864-1.73 13.577-4.995l.303-.267c.299-.263.592-.527.881-.799l.262-.247c.787-.756 1.451-1.599 2.104-2.474l.151-.201c1.929-2.606 3.117-5.723 3.635-8.909l.059-.362c.194-1.296.21-2.573.207-3.883l.003-.74v-2.02c0-.73 0-1.459.005-2.188v-3.782c0-1.827.004-3.654.007-5.481 0-.939 0-1.877.004-2.816l.003-6.082v-.268c.005-2.876.008-5.75.008-8.627l.013-8.883c.004-1.823.004-3.646.004-5.469 0-1.33.004-2.659.004-3.989.003-.721.003-1.442.003-2.159v-1.98c.005-.237.005-.473 0-.711-.011-8.523 3.072-17.023 8.941-23.268.244-.263.483-.531.717-.805.416-.48.861-.918 1.324-1.352l.252-.232a26.259 26.259 0 0 1 2.184-1.812l.46-.349c1.39-1.058 2.837-1.951 4.375-2.775l.318-.172c5.005-2.666 10.5-3.877 16.15-3.889Z" style="transform-box:fill-box;transform-origin:50% 50%;fill:#bfbfbf" transform="rotate(-31 0 0)"/>
|
|
3
|
+
<path fill="currentColor" d="M157.805 24.517c-4.326 0-7.594.981-9.807 2.942-2.214 1.962-3.572 4.954-4.075 8.978l-1.508 10.561h19.161l-3.016 10.713h-17.654l-9.054 64.428c-1.005 7.342-2.69 13.201-5.054 17.577-2.363 4.376-5.431 7.922-9.203 10.638-3.773 2.715-8.927 5.481-15.466 8.297l-3.923-10.41c4.225-1.911 7.569-3.772 10.033-5.582 2.465-1.811 4.527-4.326 6.187-7.544 1.66-3.22 2.892-7.545 3.696-12.976l9.053-64.428h-14.032l1.509-10.713h14.032l1.66-11.315c.906-6.84 3.722-12.273 8.45-16.296 4.727-4.024 10.913-6.035 18.558-6.035 3.621 0 6.84.452 9.657 1.358 2.816.905 5.834 2.364 9.053 4.375l-5.281 9.204c-3.722-2.514-8.047-3.772-12.976-3.772Zm43.956 20.672c4.929 0 9.631.552 14.107 1.659 4.477 1.107 9.079 2.816 13.806 5.13l-8.147 56.43c-.202 1.61-.302 2.716-.302 3.319 0 1.811.377 3.27 1.131 4.376.755 1.107 2.088 2.012 3.999 2.716l-3.923 9.506c-4.225-.503-7.494-1.811-9.807-3.923-2.315-2.113-3.722-5.231-4.226-9.355-3.218 4.124-6.84 7.368-10.863 9.732-4.024 2.364-8.299 3.546-12.825 3.546-8.047 0-14.283-2.766-18.709-8.299-4.427-5.532-6.639-12.926-6.639-22.18 0-8.047 1.484-16.093 4.451-24.141 2.967-8.047 7.619-14.811 13.957-20.294 6.337-5.482 14.334-8.222 23.99-8.222Zm.302 11.014c-6.338 0-11.594 2.137-15.768 6.412-4.174 4.276-7.242 9.607-9.204 15.993-1.961 6.388-2.941 12.851-2.941 19.389 0 6.538 1.157 11.392 3.47 14.56 2.313 3.169 5.632 4.753 9.958 4.753 4.124 0 7.82-1.257 11.09-3.772 3.268-2.515 6.663-6.136 10.185-10.863l6.186-43.908c-2.113-.904-4.15-1.559-6.111-1.961-1.961-.402-4.25-.603-6.865-.603Zm57.687 49.338c-.201 2.012-.302 3.32-.302 3.923 0 2.515.579 4.351 1.735 5.508 1.157 1.156 2.943 1.734 5.357 1.734 1.811 0 3.596-.276 5.356-.829 1.761-.553 3.797-1.383 6.111-2.489l4.526 9.656c-5.532 3.52-11.417 5.281-17.653 5.281-6.135 0-10.864-1.584-14.183-4.754-3.319-3.168-4.979-7.669-4.979-13.503 0-2.113.101-3.722.302-4.829l6.639-47.528h-13.73l1.509-10.713h14.333l4.979-18.407 10.864-1.207-2.716 19.614h18.709l-3.017 10.713h-17.201l-6.639 47.83Zm94.35-40.134c0 10.159-4.527 17.502-13.58 22.029-9.052 4.525-21.727 7.695-38.022 9.504.302 13.178 6.035 19.766 17.201 19.766 3.721 0 7.293-.603 10.713-1.81 3.42-1.208 6.94-3.068 10.562-5.583l5.884 9.356c-8.953 6.436-18.458 9.656-28.517 9.656-9.656 0-17.125-2.842-22.407-8.526-5.281-5.682-7.921-13.604-7.921-23.763 0-7.947 1.383-15.817 4.149-23.614 2.767-7.795 7.218-14.283 13.353-19.463 6.137-5.181 13.932-7.77 23.388-7.77 8.047 0 14.258 1.961 18.634 5.884 4.375 3.922 6.563 8.701 6.563 14.334Zm-50.848 20.972c12.473-1.408 21.652-3.571 27.537-6.487 5.884-2.918 8.826-7.595 8.826-14.033 0-2.414-.854-4.627-2.565-6.639-1.709-2.012-4.476-3.017-8.299-3.017-7.644 0-13.528 2.917-17.653 8.75-4.124 5.835-6.739 12.977-7.846 21.426Z"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@app/server",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"author": "Christoph Nakazawa <christoph.pojer@gmail.com>",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git://github.com/nkzw-tech/fate.git"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "vp pack",
|
|
13
|
+
"dev": "NODE_ENV=development node_modules/.bin/nodemon -q -I --exec node --no-warnings --experimental-specifier-resolution=node --loader ts-node/esm --env-file .env src/index.tsx",
|
|
14
|
+
"dev:setup": "vp exec prisma generate",
|
|
15
|
+
"prisma": "prisma"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@hono/node-server": "^2.0.1",
|
|
19
|
+
"@hono/trpc-server": "^0.4.2",
|
|
20
|
+
"@nkzw/core": "^1.3.1",
|
|
21
|
+
"@nkzw/define-env": "^1.1.0",
|
|
22
|
+
"@nkzw/fate": "latest",
|
|
23
|
+
"@prisma/adapter-pg": "^7.8.0",
|
|
24
|
+
"@prisma/client": "^7.8.0",
|
|
25
|
+
"@trpc/server": "^11.17.0",
|
|
26
|
+
"better-auth": "^1.6.9",
|
|
27
|
+
"hono": "^4.12.17",
|
|
28
|
+
"zod": "^4.4.3"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^25.6.0",
|
|
32
|
+
"nodemon": "^3.1.14",
|
|
33
|
+
"prisma": "^7.8.0",
|
|
34
|
+
"vite-plus": "catalog:"
|
|
35
|
+
},
|
|
36
|
+
"nodemonConfig": {
|
|
37
|
+
"ext": "ts,tsx",
|
|
38
|
+
"watch": [
|
|
39
|
+
"src/"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import dotenv from 'dotenv';
|
|
3
|
+
import { defineConfig } from 'prisma/config';
|
|
4
|
+
|
|
5
|
+
const root = process.cwd();
|
|
6
|
+
dotenv.config({
|
|
7
|
+
path: join(root, '.env'),
|
|
8
|
+
quiet: true,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const { default: env } = await import('./src/lib/env.ts');
|
|
12
|
+
|
|
13
|
+
export default defineConfig({
|
|
14
|
+
datasource: {
|
|
15
|
+
url: env('DATABASE_URL'),
|
|
16
|
+
},
|
|
17
|
+
migrations: {
|
|
18
|
+
seed: `node --no-warnings --experimental-specifier-resolution=node --loader ts-node/esm --env-file .env src/prisma/seed.tsx`,
|
|
19
|
+
},
|
|
20
|
+
schema: './src/prisma/schema.prisma',
|
|
21
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env NODE_ENV=development node_modules/.bin/nodemon -q -I --exec node --no-warnings --experimental-specifier-resolution=node --loader ts-node/esm --env-file .env
|
|
2
|
+
import { styleText } from 'node:util';
|
|
3
|
+
import { trpcServer } from '@hono/trpc-server';
|
|
4
|
+
import { Hono } from 'hono';
|
|
5
|
+
import { cors } from 'hono/cors';
|
|
6
|
+
import { auth } from './lib/auth.ts';
|
|
7
|
+
import { clientOrigin, resolveCorsOrigin } from './lib/origins.ts';
|
|
8
|
+
import prisma from './prisma/prisma.ts';
|
|
9
|
+
import { appRouter } from './router.ts';
|
|
10
|
+
import { createContext } from './trpc/context.ts';
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
await prisma.$connect();
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error(`${styleText(['red', 'bold'], 'Prisma Database Connection Error')}\n`, error);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const app = new Hono();
|
|
20
|
+
|
|
21
|
+
app.use(
|
|
22
|
+
cors({
|
|
23
|
+
credentials: true,
|
|
24
|
+
origin: resolveCorsOrigin,
|
|
25
|
+
}),
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
app.use(
|
|
29
|
+
'/trpc/*',
|
|
30
|
+
trpcServer({
|
|
31
|
+
createContext: (_, context) => createContext({ context }),
|
|
32
|
+
router: appRouter,
|
|
33
|
+
}),
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
app.on(['POST', 'GET'], '/api/auth/*', ({ req }) => auth.handler(req.raw));
|
|
37
|
+
|
|
38
|
+
app.all('/*', (context) => context.redirect(clientOrigin));
|
|
39
|
+
|
|
40
|
+
export default app;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { parseArgs, styleText } from 'node:util';
|
|
2
|
+
import { serve } from '@hono/node-server';
|
|
3
|
+
import parseInteger from '@nkzw/core/parseInteger.js';
|
|
4
|
+
import app from './app.tsx';
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
values: { port: portArg },
|
|
8
|
+
} = parseArgs({
|
|
9
|
+
options: {
|
|
10
|
+
port: {
|
|
11
|
+
default: '9000',
|
|
12
|
+
short: 'p',
|
|
13
|
+
type: 'string',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const port = (portArg && parseInteger(portArg)) || 9000;
|
|
19
|
+
|
|
20
|
+
serve({ fetch: app.fetch, port }, () =>
|
|
21
|
+
console.log(
|
|
22
|
+
`${styleText(['green', 'bold'], ` ➜`)} Server running on port ${styleText('bold', String(port))}.\n`,
|
|
23
|
+
),
|
|
24
|
+
);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { betterAuth } from 'better-auth';
|
|
2
|
+
import { prismaAdapter } from 'better-auth/adapters/prisma';
|
|
3
|
+
import { admin, username } from 'better-auth/plugins';
|
|
4
|
+
import prisma from '../prisma/prisma.ts';
|
|
5
|
+
import { trustedOrigins } from './origins.ts';
|
|
6
|
+
|
|
7
|
+
export const auth = betterAuth({
|
|
8
|
+
advanced: {
|
|
9
|
+
database: {
|
|
10
|
+
generateId: false,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
database: prismaAdapter(prisma, {
|
|
14
|
+
provider: 'postgresql',
|
|
15
|
+
}),
|
|
16
|
+
emailAndPassword: {
|
|
17
|
+
autoSignIn: true,
|
|
18
|
+
enabled: true,
|
|
19
|
+
maxPasswordLength: 128,
|
|
20
|
+
minPasswordLength: 8,
|
|
21
|
+
},
|
|
22
|
+
plugins: [admin(), username()],
|
|
23
|
+
session: {
|
|
24
|
+
cookieCache: {
|
|
25
|
+
enabled: true,
|
|
26
|
+
maxAge: 15 * 24 * 60 * 60,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
telemetry: { enabled: false },
|
|
30
|
+
trustedOrigins,
|
|
31
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import env from './env.ts';
|
|
2
|
+
|
|
3
|
+
const localDevOriginPattern = /^https?:\/\/(?:localhost|127\.0\.0\.1)(?::\d+)?$/;
|
|
4
|
+
|
|
5
|
+
const isDevelopment = process.env.NODE_ENV === 'development' || process.env.DEV;
|
|
6
|
+
|
|
7
|
+
export const clientOrigin = env('CLIENT_DOMAIN');
|
|
8
|
+
|
|
9
|
+
export const trustedOrigins = [
|
|
10
|
+
clientOrigin,
|
|
11
|
+
...(isDevelopment ? ['http://localhost:*', 'http://127.0.0.1:*'] : []),
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export const resolveCorsOrigin = (origin: string) => {
|
|
15
|
+
if (origin === clientOrigin || (isDevelopment && localDevOriginPattern.test(origin))) {
|
|
16
|
+
return origin;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PrismaPg } from '@prisma/adapter-pg';
|
|
2
|
+
import env from '../lib/env.ts';
|
|
3
|
+
import { PrismaClient } from './prisma-client/client.ts';
|
|
4
|
+
|
|
5
|
+
const adapter = new PrismaPg({
|
|
6
|
+
connectionString: env('DATABASE_URL'),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export default new PrismaClient({ adapter });
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// This is your Prisma schema file,
|
|
2
|
+
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
3
|
+
|
|
4
|
+
generator client {
|
|
5
|
+
importFileExtension = "ts"
|
|
6
|
+
output = "./prisma-client"
|
|
7
|
+
provider = "prisma-client"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
datasource db {
|
|
11
|
+
provider = "postgresql"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
model User {
|
|
15
|
+
id String @id @unique @default(uuid(7))
|
|
16
|
+
accounts Account[]
|
|
17
|
+
banExpires DateTime?
|
|
18
|
+
banned Boolean?
|
|
19
|
+
banReason String?
|
|
20
|
+
createdAt DateTime @default(now())
|
|
21
|
+
displayUsername String?
|
|
22
|
+
email String @unique
|
|
23
|
+
emailVerified Boolean
|
|
24
|
+
image String?
|
|
25
|
+
name String
|
|
26
|
+
password String?
|
|
27
|
+
role String @default("user")
|
|
28
|
+
sessions Session[]
|
|
29
|
+
posts Post[]
|
|
30
|
+
comments Comment[]
|
|
31
|
+
updatedAt DateTime
|
|
32
|
+
username String? @unique
|
|
33
|
+
|
|
34
|
+
@@index([id(sort: Asc)])
|
|
35
|
+
@@map("user")
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
model Session {
|
|
39
|
+
id String @unique @default(uuid(7))
|
|
40
|
+
expiresAt DateTime
|
|
41
|
+
token String
|
|
42
|
+
createdAt DateTime
|
|
43
|
+
updatedAt DateTime
|
|
44
|
+
ipAddress String?
|
|
45
|
+
userAgent String?
|
|
46
|
+
userId String
|
|
47
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
48
|
+
|
|
49
|
+
@@unique([token])
|
|
50
|
+
@@map("session")
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
model Account {
|
|
54
|
+
id String @unique @default(uuid(7))
|
|
55
|
+
accountId String
|
|
56
|
+
providerId String
|
|
57
|
+
userId String
|
|
58
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
59
|
+
accessToken String?
|
|
60
|
+
refreshToken String?
|
|
61
|
+
idToken String?
|
|
62
|
+
accessTokenExpiresAt DateTime?
|
|
63
|
+
refreshTokenExpiresAt DateTime?
|
|
64
|
+
scope String?
|
|
65
|
+
password String?
|
|
66
|
+
createdAt DateTime
|
|
67
|
+
updatedAt DateTime
|
|
68
|
+
|
|
69
|
+
@@unique([providerId, accountId])
|
|
70
|
+
@@map("account")
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
model Post {
|
|
74
|
+
id String @id @default(uuid(7))
|
|
75
|
+
title String
|
|
76
|
+
content String
|
|
77
|
+
likes Int @default(0)
|
|
78
|
+
createdAt DateTime @default(now())
|
|
79
|
+
updatedAt DateTime @updatedAt
|
|
80
|
+
authorId String
|
|
81
|
+
author User @relation(fields: [authorId], references: [id], onDelete: Cascade)
|
|
82
|
+
comments Comment[]
|
|
83
|
+
|
|
84
|
+
@@index([authorId(sort: Asc)])
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
model Comment {
|
|
88
|
+
id String @id @default(uuid(7))
|
|
89
|
+
content String
|
|
90
|
+
createdAt DateTime @default(now())
|
|
91
|
+
postId String
|
|
92
|
+
authorId String?
|
|
93
|
+
post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
|
|
94
|
+
author User? @relation(fields: [authorId], references: [id], onDelete: SetNull)
|
|
95
|
+
|
|
96
|
+
@@index([authorId(sort: Asc)])
|
|
97
|
+
@@index([postId(sort: Asc)])
|
|
98
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env NODE_ENV=development node --no-warnings --experimental-specifier-resolution=node --loader ts-node/esm --env-file .env
|
|
2
|
+
import { styleText } from 'node:util';
|
|
3
|
+
import randomEntry from '@nkzw/core/randomEntry.js';
|
|
4
|
+
import { auth } from '../lib/auth.ts';
|
|
5
|
+
import prisma from './prisma.ts';
|
|
6
|
+
import { comments, posts, users } from './seedData.ts';
|
|
7
|
+
|
|
8
|
+
console.log(styleText('bold', '› Seeding database...'));
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
console.log(styleText('bold', `Creating users`));
|
|
12
|
+
|
|
13
|
+
for (const data of users) {
|
|
14
|
+
const { user } = await auth.api.createUser({
|
|
15
|
+
body: data,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
console.log(` Created user ${styleText('blue', user.name)}.`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const seededUsers = await prisma.user.findMany();
|
|
22
|
+
const usersByEmail = new Map(seededUsers.map((user) => [user.email, user]));
|
|
23
|
+
|
|
24
|
+
console.log(styleText('bold', `Seeding posts and comments`));
|
|
25
|
+
|
|
26
|
+
const createdPosts = await Promise.all(
|
|
27
|
+
posts.map((post) => {
|
|
28
|
+
const author = usersByEmail.get(post.authorEmail);
|
|
29
|
+
|
|
30
|
+
if (!author) {
|
|
31
|
+
throw new Error(`Missing seeded user for ${post.authorEmail}.`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return prisma.post.create({
|
|
35
|
+
data: {
|
|
36
|
+
authorId: author.id,
|
|
37
|
+
content: post.content,
|
|
38
|
+
likes: post.likes,
|
|
39
|
+
title: post.title,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
let index = 0;
|
|
46
|
+
for (const comment of comments) {
|
|
47
|
+
const post = createdPosts[index % createdPosts.length];
|
|
48
|
+
const author = randomEntry(seededUsers);
|
|
49
|
+
|
|
50
|
+
await prisma.comment.create({
|
|
51
|
+
data: {
|
|
52
|
+
authorId: author?.id,
|
|
53
|
+
content: comment,
|
|
54
|
+
postId: post.id,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
index++;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
console.log(
|
|
62
|
+
styleText(
|
|
63
|
+
['green', 'bold'],
|
|
64
|
+
`✓ Created ${createdPosts.length} posts and ${comments.length} comments.`,
|
|
65
|
+
),
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
console.log(styleText(['green', 'bold'], '✓ Done.'));
|
|
69
|
+
} finally {
|
|
70
|
+
await prisma.$disconnect();
|
|
71
|
+
}
|