create-thexjs-app 0.1.2 → 0.1.4
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/dist/index.js +43 -20
- package/package.json +2 -7
- package/templates/basic/src/components/Link.tsx +6 -12
- package/templates/basic/src/lib/auth.ts +17 -6
- package/templates/basic/src/pages/login.tsx +11 -4
- package/templates/basic/src/pages/placeholder.tsx +11 -2
- package/templates/blog/src/pages/index.tsx +4 -1
- package/templates/default/src/pages/index.tsx +1 -1
- package/templates/landing/src/components/code-block.tsx +104 -10
- package/templates/landing/src/layouts/main.tsx +48 -18
- package/templates/landing/src/pages/docs/_layout.tsx +26 -14
- package/templates/landing/src/pages/docs/api-routes.tsx +1 -1
- package/templates/landing/src/pages/docs/build-deploy.tsx +1 -1
- package/templates/landing/src/pages/docs/configuration.tsx +1 -1
- package/templates/landing/src/pages/docs/content-collections.tsx +1 -1
- package/templates/landing/src/pages/docs/data-layer.tsx +3 -3
- package/templates/landing/src/pages/docs/getting-started.tsx +4 -4
- package/templates/landing/src/pages/docs/installation.tsx +16 -20
- package/templates/landing/src/pages/docs/introduction.tsx +8 -11
- package/templates/landing/src/pages/docs/layouts.tsx +1 -1
- package/templates/landing/src/pages/docs/middleware.tsx +1 -1
- package/templates/landing/src/pages/docs/packages/cli.tsx +10 -7
- package/templates/landing/src/pages/docs/packages/core.tsx +9 -5
- package/templates/landing/src/pages/docs/packages/env.tsx +3 -3
- package/templates/landing/src/pages/docs/pages.tsx +1 -1
- package/templates/landing/src/pages/docs/routing.tsx +1 -1
- package/templates/landing/src/pages/docs/server-functions.tsx +60 -6
- package/templates/landing/src/pages/features.tsx +1 -1
- package/templates/landing/src/pages/index.tsx +91 -126
- package/templates/landing/src/styles/globals.css +81 -45
- package/templates/landing/tsconfig.json +6 -1
- package/templates/saas/src/api/auth/login.ts +31 -0
- package/templates/saas/src/lib/auth.ts +27 -6
- package/templates/saas/src/pages/dashboard/settings.tsx +8 -2
- package/templates/saas/src/pages/login.tsx +83 -10
- package/templates/landing/src/pages/contact.tsx +0 -95
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ArrowRight, BookOpen, Code2, FileJson, Globe, Layers, Shield, Zap } from "lucide-react";
|
|
2
|
-
import {
|
|
2
|
+
import { TerminalBlock } from "../components/code-block";
|
|
3
3
|
|
|
4
4
|
const features = [
|
|
5
5
|
{
|
|
@@ -39,153 +39,118 @@ export const mode = "static";
|
|
|
39
39
|
export default function HomePage() {
|
|
40
40
|
return (
|
|
41
41
|
<div className="pb-32">
|
|
42
|
-
|
|
43
|
-
<section className="relative flex min-h-[92vh] flex-col items-center justify-center overflow-hidden px-6">
|
|
42
|
+
<section className="relative overflow-hidden px-6 pt-16 pb-24 sm:pt-20">
|
|
44
43
|
<div
|
|
45
|
-
className="pointer-events-none absolute inset-0 opacity-
|
|
44
|
+
className="pointer-events-none absolute inset-0 opacity-30"
|
|
46
45
|
style={{
|
|
47
46
|
backgroundImage:
|
|
48
|
-
"linear-gradient(to right,
|
|
49
|
-
backgroundSize: "
|
|
50
|
-
maskImage: "radial-gradient(ellipse
|
|
47
|
+
"linear-gradient(to right, #1a2233 1px, transparent 1px), linear-gradient(to bottom, #1a2233 1px, transparent 1px)",
|
|
48
|
+
backgroundSize: "40px 40px",
|
|
49
|
+
maskImage: "radial-gradient(ellipse 80% 70% at 50% 0%, black 10%, transparent 100%)",
|
|
51
50
|
}}
|
|
52
51
|
/>
|
|
53
|
-
<div className="pointer-events-none absolute
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
52
|
+
<div className="pointer-events-none absolute -top-32 left-1/2 h-[520px] w-[520px] -translate-x-1/2 animate-pulse-glow rounded-full bg-primary/10 blur-3xl" />
|
|
53
|
+
|
|
54
|
+
<div className="relative z-10 mx-auto grid max-w-6xl items-center gap-14 lg:grid-cols-[1fr_1.05fr] lg:gap-10">
|
|
55
|
+
<div>
|
|
56
|
+
<p className="font-mono text-[11px] uppercase tracking-[0.28em] text-primary">
|
|
57
|
+
Bun-native fullstack
|
|
58
|
+
</p>
|
|
59
|
+
<h1 className="mt-5 text-[clamp(2.4rem,6vw,4.25rem)] font-extrabold leading-[1.02]">
|
|
60
|
+
Files in.
|
|
61
|
+
<br />
|
|
62
|
+
<span className="text-primary">Routes out.</span>
|
|
63
|
+
</h1>
|
|
64
|
+
<p className="mt-6 max-w-lg text-base leading-relaxed text-muted-foreground sm:text-lg">
|
|
65
|
+
x is a React framework where your folder structure is the router, your API lives
|
|
66
|
+
beside your pages, and everything runs in one Bun process.
|
|
67
|
+
</p>
|
|
68
|
+
<div className="mt-9 flex flex-wrap gap-3">
|
|
69
|
+
<a
|
|
70
|
+
href="/docs/installation"
|
|
71
|
+
className="group inline-flex h-11 items-center gap-2 rounded-xl bg-primary px-5 text-sm font-semibold text-primary-foreground shadow-lg shadow-primary/25 transition-all hover:bg-primary/90 active:scale-[0.98]"
|
|
72
|
+
>
|
|
73
|
+
Install x
|
|
74
|
+
<ArrowRight className="h-4 w-4 transition-transform group-hover:translate-x-0.5" />
|
|
75
|
+
</a>
|
|
76
|
+
<a
|
|
77
|
+
href="/docs/introduction"
|
|
78
|
+
className="inline-flex h-11 items-center gap-2 rounded-xl border border-border bg-card/60 px-5 text-sm font-medium backdrop-blur-sm transition-colors hover:bg-muted"
|
|
79
|
+
>
|
|
80
|
+
<BookOpen className="h-4 w-4" /> Introduction
|
|
81
|
+
</a>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<div className="relative">
|
|
86
|
+
<div className="absolute -inset-4 rounded-3xl bg-gradient-to-br from-primary/10 via-transparent to-secondary/5 blur-2xl" />
|
|
87
|
+
<TerminalBlock
|
|
88
|
+
label="~/my-app — zsh"
|
|
89
|
+
code={`$ bun create thexjs-app@latest my-app
|
|
90
|
+
|
|
91
|
+
Available templates:
|
|
92
|
+
|
|
93
|
+
default Blank slate — single home page. (recommended)
|
|
94
|
+
basic Pages, API, auth, dashboard.
|
|
95
|
+
blog Markdown content collections.
|
|
96
|
+
saas Dashboard, pricing, data layer.
|
|
97
|
+
|
|
98
|
+
Choose a template (default): █
|
|
99
|
+
|
|
100
|
+
$ cd my-app && bun run dev
|
|
101
|
+
[x] dev server running at http://localhost:3000`}
|
|
102
|
+
/>
|
|
83
103
|
</div>
|
|
84
104
|
</div>
|
|
85
|
-
<div className="pointer-events-none absolute bottom-0 left-0 right-0 h-64 bg-gradient-to-t from-background to-transparent" />
|
|
86
105
|
</section>
|
|
87
106
|
|
|
88
|
-
{/* ── Features ── */}
|
|
89
107
|
<section className="mx-auto max-w-6xl px-6">
|
|
90
108
|
<div className="mx-auto max-w-2xl text-center">
|
|
91
|
-
<p className="
|
|
92
|
-
<h2 className="mt-4 text-3xl font-bold
|
|
93
|
-
Everything in one place
|
|
94
|
-
</h2>
|
|
109
|
+
<p className="font-mono text-[11px] uppercase tracking-[0.22em] text-primary">Why x</p>
|
|
110
|
+
<h2 className="mt-4 text-3xl font-bold sm:text-4xl">Everything in one place</h2>
|
|
95
111
|
<p className="mt-4 text-muted-foreground">
|
|
96
|
-
Most frameworks
|
|
97
|
-
|
|
112
|
+
Most frameworks split the stack. x keeps routing, rendering, API, and build tooling in
|
|
113
|
+
one runtime.
|
|
98
114
|
</p>
|
|
99
115
|
</div>
|
|
100
|
-
<div className="mt-
|
|
116
|
+
<div className="mt-14 grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
|
|
101
117
|
{features.map((f) => (
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
|
|
118
|
+
<article
|
|
119
|
+
key={f.title}
|
|
120
|
+
className="group rounded-2xl border border-border/80 bg-card/50 p-6 transition-colors hover:border-primary/25 hover:bg-card"
|
|
121
|
+
>
|
|
122
|
+
<div className="flex h-9 w-9 items-center justify-center rounded-lg border border-border bg-muted/50 text-primary transition-colors group-hover:border-primary/30 group-hover:bg-primary/10">
|
|
123
|
+
<f.icon className="h-4 w-4" />
|
|
105
124
|
</div>
|
|
106
|
-
<h3 className="mt-
|
|
125
|
+
<h3 className="mt-4 font-semibold">{f.title}</h3>
|
|
107
126
|
<p className="mt-2 text-sm leading-relaxed text-muted-foreground">{f.desc}</p>
|
|
108
|
-
</
|
|
127
|
+
</article>
|
|
109
128
|
))}
|
|
110
129
|
</div>
|
|
111
130
|
</section>
|
|
112
131
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
<p className="
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
<h2 className="mt-4 text-3xl font-bold tracking-tight sm:text-4xl">
|
|
120
|
-
Scaffold in one command
|
|
121
|
-
</h2>
|
|
122
|
-
<p className="mt-4 text-muted-foreground">
|
|
123
|
-
Create a project with the default template — a single home page, ready to edit.
|
|
132
|
+
<section className="mx-auto mt-28 max-w-4xl px-6">
|
|
133
|
+
<div className="rounded-3xl border border-border/80 bg-card/40 p-10 text-center sm:p-14">
|
|
134
|
+
<h2 className="text-3xl font-bold sm:text-4xl">Ready to build?</h2>
|
|
135
|
+
<p className="mx-auto mt-4 max-w-lg text-muted-foreground">
|
|
136
|
+
Read the docs, scaffold a project, and ship from a single home page or a full-stack
|
|
137
|
+
starter.
|
|
124
138
|
</p>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
$ cd my-app && bun run dev
|
|
142
|
-
dev server running at http://localhost:3000`}
|
|
143
|
-
/>
|
|
144
|
-
<div className="mt-8 flex flex-wrap items-center justify-center gap-4">
|
|
145
|
-
<a
|
|
146
|
-
href="/docs/installation"
|
|
147
|
-
className="group inline-flex h-11 items-center gap-2 rounded-xl bg-primary px-6 text-sm font-semibold text-primary-foreground shadow-lg shadow-primary/25 transition-all hover:bg-primary/90 active:scale-[0.97]"
|
|
148
|
-
>
|
|
149
|
-
Installation guide{" "}
|
|
150
|
-
<ArrowRight className="h-4 w-4 transition-transform group-hover:translate-x-0.5" />
|
|
151
|
-
</a>
|
|
152
|
-
<a
|
|
153
|
-
href="/docs/packages/core"
|
|
154
|
-
className="inline-flex h-11 items-center rounded-xl border border-border px-6 text-sm font-medium text-foreground transition-colors hover:bg-muted"
|
|
155
|
-
>
|
|
156
|
-
Package docs
|
|
157
|
-
</a>
|
|
158
|
-
</div>
|
|
159
|
-
</section>
|
|
160
|
-
|
|
161
|
-
{/* ── CTA ── */}
|
|
162
|
-
<section className="mx-auto mt-32 max-w-4xl px-6">
|
|
163
|
-
<div className="relative overflow-hidden rounded-3xl border border-primary/20 bg-gradient-to-br from-primary/[0.07] via-primary/[0.03] to-background p-14 text-center sm:p-24">
|
|
164
|
-
<div className="pointer-events-none absolute -right-20 -top-20 h-60 w-60 rounded-full bg-primary/10 blur-3xl" />
|
|
165
|
-
<div className="relative">
|
|
166
|
-
<h2 className="text-3xl font-bold tracking-tight sm:text-4xl">Ready to build?</h2>
|
|
167
|
-
<p className="mt-4 text-lg text-muted-foreground">
|
|
168
|
-
One command, one process, everything you need. Start building with x today.
|
|
169
|
-
</p>
|
|
170
|
-
<div className="mt-8 flex flex-wrap items-center justify-center gap-4">
|
|
171
|
-
<a
|
|
172
|
-
href="/docs"
|
|
173
|
-
className="group inline-flex h-12 items-center gap-2 rounded-xl bg-primary px-6 text-sm font-semibold text-primary-foreground shadow-xl shadow-primary/25 transition-all hover:bg-primary/90 active:scale-[0.97]"
|
|
174
|
-
>
|
|
175
|
-
<BookOpen className="h-4 w-4" /> Read the docs
|
|
176
|
-
</a>
|
|
177
|
-
<a
|
|
178
|
-
href="https://github.com/abdelkabirouadoukou/x"
|
|
179
|
-
target="_blank"
|
|
180
|
-
rel="noopener noreferrer"
|
|
181
|
-
className="group inline-flex h-12 items-center gap-2 rounded-xl border border-border bg-card/50 px-6 text-sm font-medium text-foreground backdrop-blur-sm transition-all hover:bg-muted active:scale-[0.97]"
|
|
182
|
-
>
|
|
183
|
-
<svg viewBox="0 0 24 24" className="h-5 w-5" fill="currentColor">
|
|
184
|
-
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
|
|
185
|
-
</svg>
|
|
186
|
-
GitHub
|
|
187
|
-
</a>
|
|
188
|
-
</div>
|
|
139
|
+
<div className="mt-8 flex flex-wrap items-center justify-center gap-3">
|
|
140
|
+
<a
|
|
141
|
+
href="/docs"
|
|
142
|
+
className="inline-flex h-11 items-center gap-2 rounded-xl bg-primary px-5 text-sm font-semibold text-primary-foreground shadow-lg shadow-primary/20 transition-all hover:bg-primary/90"
|
|
143
|
+
>
|
|
144
|
+
<BookOpen className="h-4 w-4" /> Read the docs
|
|
145
|
+
</a>
|
|
146
|
+
<a
|
|
147
|
+
href="https://github.com/abdelkabirouadoukou/x"
|
|
148
|
+
target="_blank"
|
|
149
|
+
rel="noopener noreferrer"
|
|
150
|
+
className="inline-flex h-11 items-center rounded-xl border border-border px-5 text-sm font-medium transition-colors hover:bg-muted"
|
|
151
|
+
>
|
|
152
|
+
GitHub
|
|
153
|
+
</a>
|
|
189
154
|
</div>
|
|
190
155
|
</div>
|
|
191
156
|
</section>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import url("https://fonts.googleapis.com/css2?family=
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=IBM+Plex+Mono:wght@400;500&family=Syne:wght@600;700;800&display=swap");
|
|
2
2
|
|
|
3
3
|
@import "tailwindcss";
|
|
4
4
|
@import "tw-animate-css";
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
@custom-variant dark (&:is(.dark *));
|
|
7
7
|
|
|
8
8
|
@theme inline {
|
|
9
|
-
--font-
|
|
10
|
-
--font-
|
|
9
|
+
--font-display: "Syne", ui-sans-serif, system-ui, sans-serif;
|
|
10
|
+
--font-sans: "DM Sans", ui-sans-serif, system-ui, sans-serif;
|
|
11
|
+
--font-mono: "IBM Plex Mono", ui-monospace, monospace;
|
|
11
12
|
--color-background: var(--background);
|
|
12
13
|
--color-foreground: var(--foreground);
|
|
13
14
|
--color-card: var(--card);
|
|
@@ -23,49 +24,42 @@
|
|
|
23
24
|
--color-accent: var(--accent);
|
|
24
25
|
--color-accent-foreground: var(--accent-foreground);
|
|
25
26
|
--color-destructive: var(--destructive);
|
|
26
|
-
--color-destructive-foreground: var(--destructive-foreground);
|
|
27
27
|
--color-border: var(--border);
|
|
28
28
|
--color-input: var(--input);
|
|
29
29
|
--color-ring: var(--ring);
|
|
30
|
-
--color-sidebar: var(--sidebar);
|
|
31
|
-
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
32
|
-
--color-sidebar-primary: var(--sidebar-primary);
|
|
33
|
-
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
34
|
-
--color-sidebar-accent: var(--sidebar-accent);
|
|
35
|
-
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
36
|
-
--color-sidebar-border: var(--sidebar-border);
|
|
37
|
-
--color-sidebar-ring: var(--sidebar-ring);
|
|
38
30
|
--animate-float: float 3s ease-in-out infinite;
|
|
39
|
-
--animate-pulse-glow: pulse-glow
|
|
31
|
+
--animate-pulse-glow: pulse-glow 2.8s ease-in-out infinite;
|
|
32
|
+
--animate-cursor: cursor-blink 1.1s step-end infinite;
|
|
40
33
|
}
|
|
41
34
|
|
|
42
35
|
:root {
|
|
43
|
-
--radius: 0.
|
|
44
|
-
--background:
|
|
45
|
-
--foreground:
|
|
46
|
-
--card:
|
|
47
|
-
--card-foreground:
|
|
48
|
-
--popover:
|
|
49
|
-
--popover-foreground:
|
|
50
|
-
--primary:
|
|
51
|
-
--primary-foreground:
|
|
52
|
-
--secondary:
|
|
53
|
-
--secondary-foreground:
|
|
54
|
-
--muted:
|
|
55
|
-
--muted-foreground:
|
|
56
|
-
--accent:
|
|
57
|
-
--accent-foreground:
|
|
58
|
-
--destructive:
|
|
59
|
-
--border:
|
|
60
|
-
--input:
|
|
61
|
-
--ring:
|
|
62
|
-
--
|
|
63
|
-
--
|
|
64
|
-
--
|
|
65
|
-
--
|
|
66
|
-
--
|
|
67
|
-
--
|
|
68
|
-
--
|
|
36
|
+
--radius: 0.625rem;
|
|
37
|
+
--background: #060910;
|
|
38
|
+
--foreground: #e4eaf4;
|
|
39
|
+
--card: #0c1018;
|
|
40
|
+
--card-foreground: #e4eaf4;
|
|
41
|
+
--popover: #0c1018;
|
|
42
|
+
--popover-foreground: #e4eaf4;
|
|
43
|
+
--primary: #e8952f;
|
|
44
|
+
--primary-foreground: #0a0d14;
|
|
45
|
+
--secondary: #3dd6c6;
|
|
46
|
+
--secondary-foreground: #060910;
|
|
47
|
+
--muted: #121824;
|
|
48
|
+
--muted-foreground: #7b879c;
|
|
49
|
+
--accent: #e8952f;
|
|
50
|
+
--accent-foreground: #0a0d14;
|
|
51
|
+
--destructive: #f07178;
|
|
52
|
+
--border: #1a2233;
|
|
53
|
+
--input: #1a2233;
|
|
54
|
+
--ring: #e8952f;
|
|
55
|
+
--terminal-bg: #05080f;
|
|
56
|
+
--terminal-bar: #0a0f18;
|
|
57
|
+
--terminal-border: #1c2638;
|
|
58
|
+
--terminal-text: #d8e1f0;
|
|
59
|
+
--terminal-muted: #6b7f9a;
|
|
60
|
+
--terminal-prompt: #e8952f;
|
|
61
|
+
--terminal-label: #5a6d88;
|
|
62
|
+
--terminal-glow: 0 24px 80px -20px rgba(232, 149, 47, 0.12);
|
|
69
63
|
}
|
|
70
64
|
|
|
71
65
|
@layer base {
|
|
@@ -73,28 +67,70 @@
|
|
|
73
67
|
@apply border-border outline-ring/50;
|
|
74
68
|
}
|
|
75
69
|
body {
|
|
76
|
-
@apply bg-background text-foreground
|
|
70
|
+
@apply bg-background font-sans text-foreground antialiased;
|
|
71
|
+
}
|
|
72
|
+
h1,
|
|
73
|
+
h2,
|
|
74
|
+
h3 {
|
|
75
|
+
@apply font-display tracking-tight;
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
|
|
79
|
+
/* Docs prose rhythm */
|
|
80
|
+
.doc-content h2 {
|
|
81
|
+
@apply mt-14 scroll-mt-24 border-t border-border/40 pt-10 text-xl font-bold first:mt-0 first:border-0 first:pt-0;
|
|
82
|
+
}
|
|
83
|
+
.doc-content h3 {
|
|
84
|
+
@apply mt-8 text-lg font-semibold;
|
|
85
|
+
}
|
|
86
|
+
.doc-content p {
|
|
87
|
+
@apply mt-3 leading-relaxed text-muted-foreground;
|
|
88
|
+
}
|
|
89
|
+
.doc-content ul {
|
|
90
|
+
@apply mt-4 list-inside list-disc space-y-2 text-muted-foreground;
|
|
91
|
+
}
|
|
92
|
+
.doc-content a:not(.no-doc-link) {
|
|
93
|
+
@apply text-primary underline underline-offset-2 transition-colors hover:text-primary/80;
|
|
94
|
+
}
|
|
95
|
+
.doc-content code:not(pre code) {
|
|
96
|
+
@apply rounded-md bg-muted px-1.5 py-0.5 font-mono text-sm text-foreground;
|
|
97
|
+
}
|
|
98
|
+
|
|
80
99
|
@keyframes float {
|
|
81
100
|
0%,
|
|
82
101
|
100% {
|
|
83
|
-
transform: translateY(
|
|
102
|
+
transform: translateY(0);
|
|
84
103
|
}
|
|
85
104
|
50% {
|
|
86
|
-
transform: translateY(-
|
|
105
|
+
transform: translateY(-8px);
|
|
87
106
|
}
|
|
88
107
|
}
|
|
89
108
|
|
|
90
109
|
@keyframes pulse-glow {
|
|
91
110
|
0%,
|
|
92
111
|
100% {
|
|
93
|
-
opacity: 0.
|
|
94
|
-
|
|
112
|
+
opacity: 0.45;
|
|
113
|
+
transform: scale(0.98);
|
|
95
114
|
}
|
|
96
115
|
50% {
|
|
116
|
+
opacity: 0.85;
|
|
117
|
+
transform: scale(1);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@keyframes cursor-blink {
|
|
122
|
+
0%,
|
|
123
|
+
100% {
|
|
97
124
|
opacity: 1;
|
|
98
|
-
|
|
125
|
+
}
|
|
126
|
+
50% {
|
|
127
|
+
opacity: 0;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@media (prefers-reduced-motion: reduce) {
|
|
132
|
+
.animate-pulse-glow,
|
|
133
|
+
.animate-cursor {
|
|
134
|
+
animation: none !important;
|
|
99
135
|
}
|
|
100
136
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "../../tsconfig.base.json",
|
|
3
3
|
"compilerOptions": { "noEmit": true, "baseUrl": ".", "paths": { "@/*": ["./src/*"] } },
|
|
4
|
-
"include": [
|
|
4
|
+
"include": [
|
|
5
|
+
"src",
|
|
6
|
+
"../../../core/src/build.ts",
|
|
7
|
+
"../../../core/src/client-nav.ts",
|
|
8
|
+
"../../../core/src/createApp.ts"
|
|
9
|
+
]
|
|
5
10
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// DEMO ONLY: admin/admin with plaintext comparison via the shared
|
|
2
|
+
// authenticate() helper — replace with real credential storage before shipping.
|
|
3
|
+
import { authenticate, setSessionCookie } from "../../lib/auth";
|
|
4
|
+
|
|
5
|
+
export async function POST(req: Request): Promise<Response> {
|
|
6
|
+
try {
|
|
7
|
+
const body = (await req.json()) as { email?: string; password?: string };
|
|
8
|
+
const { email, password } = body;
|
|
9
|
+
|
|
10
|
+
if (!email || !password) {
|
|
11
|
+
return Response.json({ error: "email and password required" }, { status: 400 });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const session = authenticate(email, password);
|
|
15
|
+
if (!session) {
|
|
16
|
+
return Response.json({ error: "invalid credentials" }, { status: 401 });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const cookie = setSessionCookie(session.token);
|
|
20
|
+
return new Response(JSON.stringify({ user: { username: session.username } }), {
|
|
21
|
+
status: 200,
|
|
22
|
+
headers: {
|
|
23
|
+
"Content-Type": "application/json",
|
|
24
|
+
"Set-Cookie": cookie,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
} catch (err) {
|
|
28
|
+
console.error("[auth] login error:", err);
|
|
29
|
+
return Response.json({ error: "internal error" }, { status: 500 });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
// DEMO ONLY: hardcoded admin/admin credentials, plaintext password comparison,
|
|
3
|
+
// no session expiry. This auth is a placeholder for demos — replace with real
|
|
4
|
+
// credential storage (hashed passwords) before shipping anything production.
|
|
1
5
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
6
|
+
import { mkdirSync } from "node:fs";
|
|
7
|
+
import { dirname, join } from "node:path";
|
|
8
|
+
import { connectSQLite, runSQLiteMigrations } from "@thexjs/core/data";
|
|
4
9
|
|
|
5
10
|
const SESSION_COOKIE = "x_session";
|
|
6
11
|
const SESSION_MAX_AGE = 60 * 60 * 24 * 7;
|
|
@@ -12,9 +17,13 @@ export interface Session {
|
|
|
12
17
|
username: string;
|
|
13
18
|
}
|
|
14
19
|
|
|
15
|
-
|
|
20
|
+
let db: Database | null = null;
|
|
21
|
+
|
|
22
|
+
function getDb(): Database {
|
|
23
|
+
if (db) return db;
|
|
16
24
|
const dbPath = join(import.meta.dir, "..", "..", "data", "dev.db");
|
|
17
|
-
|
|
25
|
+
mkdirSync(dirname(dbPath), { recursive: true });
|
|
26
|
+
db = connectSQLite({ path: dbPath });
|
|
18
27
|
runSQLiteMigrations(db, join(import.meta.dir, "migrations"));
|
|
19
28
|
return db;
|
|
20
29
|
}
|
|
@@ -35,6 +44,16 @@ export function createSession(username: string): Session {
|
|
|
35
44
|
return { id, token, user_id: userId, username };
|
|
36
45
|
}
|
|
37
46
|
|
|
47
|
+
// DEMO ONLY: the single source of truth for the credential check, shared by
|
|
48
|
+
// the login API route and the login page's server fallback. Replace this with
|
|
49
|
+
// real (hashed) password verification before shipping.
|
|
50
|
+
export function authenticate(email: string, password: string): Session | null {
|
|
51
|
+
if (email === "admin" && password === "admin") {
|
|
52
|
+
return createSession(email);
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
38
57
|
export function getSession(token: string | undefined): Session | null {
|
|
39
58
|
if (!token) return null;
|
|
40
59
|
const db = getDb();
|
|
@@ -61,10 +80,12 @@ export function parseSessionCookie(cookieHeader: string | null): string | undefi
|
|
|
61
80
|
return undefined;
|
|
62
81
|
}
|
|
63
82
|
|
|
83
|
+
const SECURE_COOKIE_FLAG = process.env.NODE_ENV === "production" ? "; Secure" : "";
|
|
84
|
+
|
|
64
85
|
export function setSessionCookie(token: string): string {
|
|
65
|
-
return `${SESSION_COOKIE}=${token}; HttpOnly; SameSite=Lax; Path=/; Max-Age=${SESSION_MAX_AGE}`;
|
|
86
|
+
return `${SESSION_COOKIE}=${token}; HttpOnly; SameSite=Lax; Path=/; Max-Age=${SESSION_MAX_AGE}${SECURE_COOKIE_FLAG}`;
|
|
66
87
|
}
|
|
67
88
|
|
|
68
89
|
export function clearSessionCookie(): string {
|
|
69
|
-
return `${SESSION_COOKIE}=; HttpOnly; SameSite=Lax; Path=/; Max-Age=0`;
|
|
90
|
+
return `${SESSION_COOKIE}=; HttpOnly; SameSite=Lax; Path=/; Max-Age=0${SECURE_COOKIE_FLAG}`;
|
|
70
91
|
}
|
|
@@ -53,7 +53,10 @@ export default function SettingsPage({ loaderData }: RouteProps) {
|
|
|
53
53
|
/>
|
|
54
54
|
</div>
|
|
55
55
|
</div>
|
|
56
|
-
<button
|
|
56
|
+
<button
|
|
57
|
+
type="button"
|
|
58
|
+
className="inline-flex items-center gap-2 rounded-xl bg-primary px-5 py-2.5 text-sm font-semibold text-primary-foreground shadow-lg shadow-primary/20 transition-all hover:bg-primary/90"
|
|
59
|
+
>
|
|
57
60
|
<Save className="h-4 w-4" />
|
|
58
61
|
Save Changes
|
|
59
62
|
</button>
|
|
@@ -95,7 +98,10 @@ export default function SettingsPage({ loaderData }: RouteProps) {
|
|
|
95
98
|
<p className="text-sm text-muted-foreground mb-4">
|
|
96
99
|
Permanently delete your account and all associated data.
|
|
97
100
|
</p>
|
|
98
|
-
<button
|
|
101
|
+
<button
|
|
102
|
+
type="button"
|
|
103
|
+
className="rounded-xl border border-destructive/50 bg-destructive/10 px-5 py-2.5 text-sm font-semibold text-destructive transition-all hover:bg-destructive/20"
|
|
104
|
+
>
|
|
99
105
|
Delete Account
|
|
100
106
|
</button>
|
|
101
107
|
</div>
|