create-questpie 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.
Files changed (40) hide show
  1. package/README.md +81 -0
  2. package/dist/index.mjs +284 -0
  3. package/package.json +44 -0
  4. package/templates/tanstack-start/AGENTS.md +563 -0
  5. package/templates/tanstack-start/CLAUDE.md +105 -0
  6. package/templates/tanstack-start/Dockerfile +23 -0
  7. package/templates/tanstack-start/README.md +94 -0
  8. package/templates/tanstack-start/components.json +22 -0
  9. package/templates/tanstack-start/docker-compose.yml +20 -0
  10. package/templates/tanstack-start/env.example +16 -0
  11. package/templates/tanstack-start/gitignore +12 -0
  12. package/templates/tanstack-start/package.json +43 -0
  13. package/templates/tanstack-start/questpie.config.ts +12 -0
  14. package/templates/tanstack-start/src/admin.css +4 -0
  15. package/templates/tanstack-start/src/lib/auth-client.ts +12 -0
  16. package/templates/tanstack-start/src/lib/cms-client.ts +12 -0
  17. package/templates/tanstack-start/src/lib/env.ts +27 -0
  18. package/templates/tanstack-start/src/lib/query-client.ts +9 -0
  19. package/templates/tanstack-start/src/migrations/index.ts +8 -0
  20. package/templates/tanstack-start/src/questpie/admin/admin.ts +5 -0
  21. package/templates/tanstack-start/src/questpie/admin/builder.ts +4 -0
  22. package/templates/tanstack-start/src/questpie/server/app.ts +52 -0
  23. package/templates/tanstack-start/src/questpie/server/builder.ts +4 -0
  24. package/templates/tanstack-start/src/questpie/server/collections/index.ts +1 -0
  25. package/templates/tanstack-start/src/questpie/server/collections/posts.collection.ts +72 -0
  26. package/templates/tanstack-start/src/questpie/server/dashboard.ts +68 -0
  27. package/templates/tanstack-start/src/questpie/server/globals/index.ts +1 -0
  28. package/templates/tanstack-start/src/questpie/server/globals/site-settings.global.ts +24 -0
  29. package/templates/tanstack-start/src/questpie/server/rpc.ts +4 -0
  30. package/templates/tanstack-start/src/questpie/server/sidebar.ts +26 -0
  31. package/templates/tanstack-start/src/router.tsx +10 -0
  32. package/templates/tanstack-start/src/routes/__root.tsx +16 -0
  33. package/templates/tanstack-start/src/routes/admin/$.tsx +21 -0
  34. package/templates/tanstack-start/src/routes/admin/index.tsx +18 -0
  35. package/templates/tanstack-start/src/routes/admin/login.tsx +17 -0
  36. package/templates/tanstack-start/src/routes/admin.tsx +68 -0
  37. package/templates/tanstack-start/src/routes/api/cms/$.ts +45 -0
  38. package/templates/tanstack-start/src/styles.css +125 -0
  39. package/templates/tanstack-start/tsconfig.json +27 -0
  40. package/templates/tanstack-start/vite.config.ts +26 -0
@@ -0,0 +1,68 @@
1
+ import { AdminLayoutProvider } from "@questpie/admin/client";
2
+ import {
3
+ createFileRoute,
4
+ HeadContent,
5
+ Link,
6
+ Outlet,
7
+ Scripts,
8
+ useLocation,
9
+ } from "@tanstack/react-router";
10
+ import { authClient } from "~/lib/auth-client";
11
+ import { client } from "~/lib/cms-client";
12
+ import { queryClient } from "~/lib/query-client";
13
+ import { admin } from "~/questpie/admin/admin";
14
+
15
+ import adminCss from "../admin.css?url";
16
+
17
+ function AdminLink({
18
+ to,
19
+ className,
20
+ children,
21
+ activeProps,
22
+ }: {
23
+ to: string;
24
+ className?: string;
25
+ children: React.ReactNode;
26
+ activeProps?: { className?: string };
27
+ }) {
28
+ return (
29
+ <Link to={to} className={className} activeProps={activeProps}>
30
+ {children}
31
+ </Link>
32
+ );
33
+ }
34
+
35
+ export const Route = createFileRoute("/admin")({
36
+ head: () => ({
37
+ title: "Admin Panel",
38
+ links: [{ rel: "stylesheet", href: adminCss }],
39
+ }),
40
+ component: AdminLayout,
41
+ });
42
+
43
+ function AdminLayout() {
44
+ const location = useLocation();
45
+
46
+ return (
47
+ <html lang="en" className="dark">
48
+ <head>
49
+ <HeadContent />
50
+ </head>
51
+ <body>
52
+ <AdminLayoutProvider
53
+ admin={admin}
54
+ client={client}
55
+ queryClient={queryClient}
56
+ authClient={authClient}
57
+ LinkComponent={AdminLink}
58
+ activeRoute={location.pathname}
59
+ basePath="/admin"
60
+ useServerTranslations
61
+ >
62
+ <Outlet />
63
+ </AdminLayoutProvider>
64
+ <Scripts />
65
+ </body>
66
+ </html>
67
+ );
68
+ }
@@ -0,0 +1,45 @@
1
+ import { withOpenApi } from "@questpie/openapi";
2
+ import { createFileRoute } from "@tanstack/react-router";
3
+ import { createFetchHandler } from "questpie";
4
+ import { appRpc, cms } from "@/questpie/server/app.js";
5
+
6
+ const handler = withOpenApi(
7
+ createFetchHandler(cms, {
8
+ basePath: "/api/cms",
9
+ rpc: appRpc,
10
+ }),
11
+ {
12
+ cms,
13
+ rpc: appRpc,
14
+ basePath: "/api/cms",
15
+ info: {
16
+ title: "{{projectName}} API",
17
+ version: "1.0.0",
18
+ description: "QUESTPIE CMS API",
19
+ },
20
+ scalar: { theme: "purple" },
21
+ },
22
+ );
23
+
24
+ const handleCmsRequest = async (request: Request) => {
25
+ const response = await handler(request);
26
+ return (
27
+ response ??
28
+ new Response(JSON.stringify({ error: "Not found" }), {
29
+ status: 404,
30
+ headers: { "Content-Type": "application/json" },
31
+ })
32
+ );
33
+ };
34
+
35
+ export const Route = createFileRoute("/api/cms/$")({
36
+ server: {
37
+ handlers: {
38
+ GET: ({ request }) => handleCmsRequest(request),
39
+ POST: ({ request }) => handleCmsRequest(request),
40
+ PUT: ({ request }) => handleCmsRequest(request),
41
+ DELETE: ({ request }) => handleCmsRequest(request),
42
+ PATCH: ({ request }) => handleCmsRequest(request),
43
+ },
44
+ },
45
+ });
@@ -0,0 +1,125 @@
1
+ @import "tailwindcss";
2
+ @import "tw-animate-css";
3
+
4
+ @custom-variant dark (&:is(.dark *));
5
+
6
+ :root {
7
+ --background: oklch(0.985 0 0);
8
+ --foreground: oklch(0.145 0 0);
9
+ --card: oklch(1 0 0);
10
+ --card-foreground: oklch(0.145 0 0);
11
+ --popover: oklch(1 0 0);
12
+ --popover-foreground: oklch(0.145 0 0);
13
+ --primary: oklch(0.205 0 0);
14
+ --primary-foreground: oklch(0.985 0 0);
15
+ --secondary: oklch(0.97 0 0);
16
+ --secondary-foreground: oklch(0.205 0 0);
17
+ --muted: oklch(0.97 0 0);
18
+ --muted-foreground: oklch(0.556 0 0);
19
+ --accent: oklch(0.97 0 0);
20
+ --accent-foreground: oklch(0.205 0 0);
21
+ --destructive: oklch(0.58 0.22 27);
22
+ --destructive-foreground: oklch(0.985 0 0);
23
+ --border: oklch(0.922 0 0);
24
+ --input: oklch(0.922 0 0);
25
+ --ring: oklch(0.708 0 0);
26
+ --chart-1: oklch(0.75 0.18 25);
27
+ --chart-2: oklch(0.65 0.15 45);
28
+ --chart-3: oklch(0.55 0.12 65);
29
+ --chart-4: oklch(0.45 0.09 85);
30
+ --chart-5: oklch(0.35 0.06 105);
31
+ --radius: 0.5rem;
32
+ --sidebar: oklch(0.985 0 0);
33
+ --sidebar-foreground: oklch(0.145 0 0);
34
+ --sidebar-primary: oklch(0.205 0 0);
35
+ --sidebar-primary-foreground: oklch(0.985 0 0);
36
+ --sidebar-accent: oklch(0.97 0 0);
37
+ --sidebar-accent-foreground: oklch(0.205 0 0);
38
+ --sidebar-border: oklch(0.922 0 0);
39
+ --sidebar-ring: oklch(0.708 0 0);
40
+ }
41
+
42
+ .dark {
43
+ --background: oklch(0.12 0 0);
44
+ --foreground: oklch(0.985 0 0);
45
+ --card: oklch(0.17 0 0);
46
+ --card-foreground: oklch(0.985 0 0);
47
+ --popover: oklch(0.17 0 0);
48
+ --popover-foreground: oklch(0.985 0 0);
49
+ --primary: oklch(0.985 0 0);
50
+ --primary-foreground: oklch(0.12 0 0);
51
+ --secondary: oklch(0.22 0 0);
52
+ --secondary-foreground: oklch(0.985 0 0);
53
+ --muted: oklch(0.22 0 0);
54
+ --muted-foreground: oklch(0.65 0 0);
55
+ --accent: oklch(0.27 0 0);
56
+ --accent-foreground: oklch(0.985 0 0);
57
+ --destructive: oklch(0.704 0.191 22.216);
58
+ --destructive-foreground: oklch(0.985 0 0);
59
+ --border: oklch(0.27 0 0);
60
+ --input: oklch(0.27 0 0);
61
+ --ring: oklch(0.45 0 0);
62
+ --chart-1: oklch(0.75 0.18 25);
63
+ --chart-2: oklch(0.65 0.15 45);
64
+ --chart-3: oklch(0.55 0.12 65);
65
+ --chart-4: oklch(0.45 0.09 85);
66
+ --chart-5: oklch(0.35 0.06 105);
67
+ --sidebar: oklch(0.17 0 0);
68
+ --sidebar-foreground: oklch(0.985 0 0);
69
+ --sidebar-primary: oklch(0.985 0 0);
70
+ --sidebar-primary-foreground: oklch(0.12 0 0);
71
+ --sidebar-accent: oklch(0.22 0 0);
72
+ --sidebar-accent-foreground: oklch(0.985 0 0);
73
+ --sidebar-border: oklch(0.27 0 0);
74
+ --sidebar-ring: oklch(0.45 0 0);
75
+ }
76
+
77
+ @theme inline {
78
+ --font-sans: ui-sans-serif, system-ui, sans-serif;
79
+ --color-background: var(--background);
80
+ --color-foreground: var(--foreground);
81
+ --color-card: var(--card);
82
+ --color-card-foreground: var(--card-foreground);
83
+ --color-popover: var(--popover);
84
+ --color-popover-foreground: var(--popover-foreground);
85
+ --color-primary: var(--primary);
86
+ --color-primary-foreground: var(--primary-foreground);
87
+ --color-secondary: var(--secondary);
88
+ --color-secondary-foreground: var(--secondary-foreground);
89
+ --color-muted: var(--muted);
90
+ --color-muted-foreground: var(--muted-foreground);
91
+ --color-accent: var(--accent);
92
+ --color-accent-foreground: var(--accent-foreground);
93
+ --color-destructive: var(--destructive);
94
+ --color-destructive-foreground: var(--destructive-foreground);
95
+ --color-border: var(--border);
96
+ --color-input: var(--input);
97
+ --color-ring: var(--ring);
98
+ --color-chart-1: var(--chart-1);
99
+ --color-chart-2: var(--chart-2);
100
+ --color-chart-3: var(--chart-3);
101
+ --color-chart-4: var(--chart-4);
102
+ --color-chart-5: var(--chart-5);
103
+ --color-sidebar: var(--sidebar);
104
+ --color-sidebar-foreground: var(--sidebar-foreground);
105
+ --color-sidebar-primary: var(--sidebar-primary);
106
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
107
+ --color-sidebar-accent: var(--sidebar-accent);
108
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
109
+ --color-sidebar-border: var(--sidebar-border);
110
+ --color-sidebar-ring: var(--sidebar-ring);
111
+ --radius-sm: calc(var(--radius) - 4px);
112
+ --radius-md: calc(var(--radius) - 2px);
113
+ --radius-lg: var(--radius);
114
+ --radius-xl: calc(var(--radius) + 4px);
115
+ --radius-2xl: calc(var(--radius) + 8px);
116
+ }
117
+
118
+ @layer base {
119
+ * {
120
+ @apply border-border outline-ring/50;
121
+ }
122
+ body {
123
+ @apply font-sans bg-background text-foreground;
124
+ }
125
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "include": ["src/**/*.ts", "src/**/*.tsx", "*.config.ts"],
3
+ "exclude": ["node_modules", "dist", "**/*.test.ts"],
4
+ "compilerOptions": {
5
+ "target": "ES2022",
6
+ "jsx": "react-jsx",
7
+ "module": "ESNext",
8
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
9
+ "types": ["vite/client"],
10
+ "moduleResolution": "bundler",
11
+ "resolveJsonModule": true,
12
+ "allowImportingTsExtensions": true,
13
+ "verbatimModuleSyntax": false,
14
+ "noEmit": true,
15
+ "skipLibCheck": true,
16
+ "strict": true,
17
+ "noUnusedLocals": false,
18
+ "noUnusedParameters": false,
19
+ "noFallthroughCasesInSwitch": true,
20
+ "noUncheckedSideEffectImports": true,
21
+ "baseUrl": ".",
22
+ "paths": {
23
+ "@/*": ["./src/*"],
24
+ "~/*": ["./src/*"]
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,26 @@
1
+ import { defineConfig } from "vite";
2
+ import { devtools } from "@tanstack/devtools-vite";
3
+ import { tanstackStart } from "@tanstack/react-start/plugin/vite";
4
+ import viteReact from "@vitejs/plugin-react";
5
+ import viteTsConfigPaths from "vite-tsconfig-paths";
6
+ import tailwindcss from "@tailwindcss/vite";
7
+ import { nitro } from "nitro/vite";
8
+
9
+ export default defineConfig({
10
+ plugins: [
11
+ devtools(),
12
+ nitro({ preset: "bun" }) as any,
13
+ viteTsConfigPaths({ projects: ["./tsconfig.json"] }),
14
+ tailwindcss(),
15
+ tanstackStart(),
16
+ viteReact(),
17
+ ],
18
+ optimizeDeps: {
19
+ exclude: ["drizzle-kit"],
20
+ },
21
+ build: {
22
+ rollupOptions: {
23
+ external: ["bun", /^drizzle-kit/],
24
+ },
25
+ },
26
+ });