create-thexjs-app 0.1.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 +1026 -0
- package/dist/index.js +224 -0
- package/package.json +30 -0
- package/templates/basic/components.json +21 -0
- package/templates/basic/content/blog/hello.md +8 -0
- package/templates/basic/public/favicon.ico +0 -0
- package/templates/basic/src/actions/dashboard/greet.ts +3 -0
- package/templates/basic/src/api/auth/login.ts +30 -0
- package/templates/basic/src/api/auth/logout.ts +12 -0
- package/templates/basic/src/api/placeholder/comments.ts +17 -0
- package/templates/basic/src/api/placeholder/posts.ts +20 -0
- package/templates/basic/src/api/placeholder/todos.ts +21 -0
- package/templates/basic/src/api/placeholder/users.ts +12 -0
- package/templates/basic/src/components/Head.tsx +21 -0
- package/templates/basic/src/components/Image.tsx +27 -0
- package/templates/basic/src/components/Link.tsx +16 -0
- package/templates/basic/src/components/ui/badge.tsx +49 -0
- package/templates/basic/src/components/ui/button.tsx +58 -0
- package/templates/basic/src/components/ui/card.tsx +88 -0
- package/templates/basic/src/components/ui/input.tsx +20 -0
- package/templates/basic/src/layouts/main.tsx +38 -0
- package/templates/basic/src/lib/auth.ts +70 -0
- package/templates/basic/src/lib/migrations/001_create_sessions.sql +9 -0
- package/templates/basic/src/lib/placeholder-data.ts +176 -0
- package/templates/basic/src/lib/utils.ts +6 -0
- package/templates/basic/src/pages/_404.tsx +17 -0
- package/templates/basic/src/pages/about.tsx +22 -0
- package/templates/basic/src/pages/blog.tsx +41 -0
- package/templates/basic/src/pages/dashboard/_middleware.ts +16 -0
- package/templates/basic/src/pages/dashboard/index.tsx +84 -0
- package/templates/basic/src/pages/index.tsx +54 -0
- package/templates/basic/src/pages/login.tsx +85 -0
- package/templates/basic/src/pages/placeholder.tsx +194 -0
- package/templates/basic/src/pages/posts/[id].tsx +17 -0
- package/templates/basic/src/styles/globals.css +90 -0
- package/templates/basic/src/x-routes.ts +29 -0
- package/templates/basic/tsconfig.json +11 -0
- package/templates/basic/x.config.ts +10 -0
- package/templates/blog/components.json +20 -0
- package/templates/blog/content/posts/getting-started.md +38 -0
- package/templates/blog/content/posts/hello-world.md +21 -0
- package/templates/blog/content/posts/tailwind-v4.md +31 -0
- package/templates/blog/public/favicon.ico +0 -0
- package/templates/blog/src/components/ui/avatar.tsx +91 -0
- package/templates/blog/src/components/ui/badge.tsx +49 -0
- package/templates/blog/src/components/ui/button.tsx +58 -0
- package/templates/blog/src/components/ui/card.tsx +88 -0
- package/templates/blog/src/components/ui/input.tsx +20 -0
- package/templates/blog/src/layouts/blog.tsx +46 -0
- package/templates/blog/src/layouts/main.tsx +32 -0
- package/templates/blog/src/lib/utils.ts +5 -0
- package/templates/blog/src/pages/about.tsx +36 -0
- package/templates/blog/src/pages/blog/[slug].tsx +56 -0
- package/templates/blog/src/pages/blog/index.tsx +70 -0
- package/templates/blog/src/pages/index.tsx +70 -0
- package/templates/blog/src/styles/globals.css +90 -0
- package/templates/blog/src/x-routes.ts +20 -0
- package/templates/blog/tsconfig.json +5 -0
- package/templates/blog/x.config.ts +6 -0
- package/templates/landing/components.json +20 -0
- package/templates/landing/public/favicon.ico +0 -0
- package/templates/landing/src/components/code-block.tsx +24 -0
- package/templates/landing/src/components/ui/avatar.tsx +91 -0
- package/templates/landing/src/components/ui/badge.tsx +49 -0
- package/templates/landing/src/components/ui/button.tsx +58 -0
- package/templates/landing/src/components/ui/card.tsx +88 -0
- package/templates/landing/src/components/ui/input.tsx +20 -0
- package/templates/landing/src/layouts/main.tsx +48 -0
- package/templates/landing/src/lib/syntax.tsx +366 -0
- package/templates/landing/src/lib/utils.ts +5 -0
- package/templates/landing/src/pages/contact.tsx +95 -0
- package/templates/landing/src/pages/docs/_layout.tsx +109 -0
- package/templates/landing/src/pages/docs/api-routes.tsx +113 -0
- package/templates/landing/src/pages/docs/build-deploy.tsx +124 -0
- package/templates/landing/src/pages/docs/configuration.tsx +121 -0
- package/templates/landing/src/pages/docs/content-collections.tsx +130 -0
- package/templates/landing/src/pages/docs/data-layer.tsx +142 -0
- package/templates/landing/src/pages/docs/getting-started.tsx +119 -0
- package/templates/landing/src/pages/docs/index.tsx +123 -0
- package/templates/landing/src/pages/docs/layouts.tsx +114 -0
- package/templates/landing/src/pages/docs/middleware.tsx +124 -0
- package/templates/landing/src/pages/docs/pages.tsx +135 -0
- package/templates/landing/src/pages/docs/routing.tsx +123 -0
- package/templates/landing/src/pages/docs/server-functions.tsx +123 -0
- package/templates/landing/src/pages/features.tsx +129 -0
- package/templates/landing/src/pages/index.tsx +175 -0
- package/templates/landing/src/styles/globals.css +100 -0
- package/templates/landing/src/x-routes.ts +31 -0
- package/templates/landing/tsconfig.json +5 -0
- package/templates/landing/x.config.ts +2 -0
- package/templates/saas/components.json +20 -0
- package/templates/saas/public/favicon.ico +0 -0
- package/templates/saas/src/actions/dashboard.ts +3 -0
- package/templates/saas/src/components/ui/avatar.tsx +91 -0
- package/templates/saas/src/components/ui/badge.tsx +49 -0
- package/templates/saas/src/components/ui/button.tsx +58 -0
- package/templates/saas/src/components/ui/card.tsx +88 -0
- package/templates/saas/src/components/ui/input.tsx +20 -0
- package/templates/saas/src/layouts/dashboard.tsx +67 -0
- package/templates/saas/src/layouts/main.tsx +38 -0
- package/templates/saas/src/lib/auth.ts +70 -0
- package/templates/saas/src/lib/migrations/001_create_sessions.sql +9 -0
- package/templates/saas/src/lib/utils.ts +5 -0
- package/templates/saas/src/pages/dashboard/_middleware.ts +9 -0
- package/templates/saas/src/pages/dashboard/analytics.tsx +68 -0
- package/templates/saas/src/pages/dashboard/index.tsx +86 -0
- package/templates/saas/src/pages/dashboard/settings.tsx +105 -0
- package/templates/saas/src/pages/index.tsx +110 -0
- package/templates/saas/src/pages/login.tsx +67 -0
- package/templates/saas/src/pages/pricing.tsx +121 -0
- package/templates/saas/src/styles/globals.css +90 -0
- package/templates/saas/src/x-routes.ts +22 -0
- package/templates/saas/tsconfig.json +5 -0
- package/templates/saas/x.config.ts +7 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { RouteProps } from "@thexjs/core";
|
|
2
|
+
import { ArrowRight } from "lucide-react";
|
|
3
|
+
import { CodeBlock } from "../../components/code-block";
|
|
4
|
+
|
|
5
|
+
export default function DocPage({}: RouteProps) {
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">
|
|
9
|
+
Server Functions
|
|
10
|
+
</p>
|
|
11
|
+
<h1 className="mt-4 text-3xl font-bold tracking-tight sm:text-4xl">Server functions</h1>
|
|
12
|
+
<p className="mt-4 text-lg text-muted-foreground">
|
|
13
|
+
Call server-side functions directly from the browser without writing REST endpoints. Server
|
|
14
|
+
functions live in <span className="text-foreground">src/actions/</span> and are invoked via
|
|
15
|
+
fetch.
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<h2 className="mt-12 text-xl font-bold tracking-tight">Defining server functions</h2>
|
|
19
|
+
<p className="mt-3 text-muted-foreground">
|
|
20
|
+
Create a file in <span className="text-foreground">src/actions/</span> and export named
|
|
21
|
+
async functions. Each function receives a <span className="text-foreground">Request</span>{" "}
|
|
22
|
+
object and any arguments you pass.
|
|
23
|
+
</p>
|
|
24
|
+
<CodeBlock
|
|
25
|
+
label="src/actions/greet.ts"
|
|
26
|
+
code={`export async function greet(name: string) {
|
|
27
|
+
return \`Hello, ${"$"}{name}! The server time is ${"$"}{new Date().toISOString()}.\`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export async function sendEmail({ to, subject, body }: {
|
|
31
|
+
to: string;
|
|
32
|
+
subject: string;
|
|
33
|
+
body: string;
|
|
34
|
+
}) {
|
|
35
|
+
// send email logic
|
|
36
|
+
return { sent: true, to };
|
|
37
|
+
}`}
|
|
38
|
+
/>
|
|
39
|
+
|
|
40
|
+
<h2 className="mt-12 text-xl font-bold tracking-tight">Calling from the browser</h2>
|
|
41
|
+
<p className="mt-3 text-muted-foreground">
|
|
42
|
+
Server functions are called by sending a POST request to{" "}
|
|
43
|
+
<span className="text-foreground">/__x/actions/<filename>/<functionName></span>.
|
|
44
|
+
The arguments are sent as JSON in the request body.
|
|
45
|
+
</p>
|
|
46
|
+
<CodeBlock
|
|
47
|
+
label="client component"
|
|
48
|
+
code={`"use client";
|
|
49
|
+
|
|
50
|
+
import { useState } from "react";
|
|
51
|
+
|
|
52
|
+
export default function GreetForm() {
|
|
53
|
+
const [message, setMessage] = useState("");
|
|
54
|
+
|
|
55
|
+
async function handleSubmit(e: React.FormEvent) {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
const form = new FormData(e.target as HTMLFormElement);
|
|
58
|
+
const name = form.get("name");
|
|
59
|
+
|
|
60
|
+
const res = await fetch("/__x/actions/greet/greet", {
|
|
61
|
+
method: "POST",
|
|
62
|
+
headers: { "Content-Type": "application/json" },
|
|
63
|
+
body: JSON.stringify([name]),
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const data = await res.text();
|
|
67
|
+
setMessage(data);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<form onSubmit={handleSubmit} className="space-y-4">
|
|
72
|
+
<input
|
|
73
|
+
name="name"
|
|
74
|
+
placeholder="Enter your name"
|
|
75
|
+
className="rounded-xl border border-border bg-card px-4 py-2"
|
|
76
|
+
/>
|
|
77
|
+
<button type="submit" className="rounded-xl bg-primary px-4 py-2 text-primary-foreground">
|
|
78
|
+
Greet me
|
|
79
|
+
</button>
|
|
80
|
+
{message && <p className="text-muted-foreground">{message}</p>}
|
|
81
|
+
</form>
|
|
82
|
+
);
|
|
83
|
+
}`}
|
|
84
|
+
/>
|
|
85
|
+
|
|
86
|
+
<h2 className="mt-12 text-xl font-bold tracking-tight">Server functions from loaders</h2>
|
|
87
|
+
<p className="mt-3 text-muted-foreground">
|
|
88
|
+
You can also import and call server functions directly in loaders — no HTTP needed since
|
|
89
|
+
they share the same process.
|
|
90
|
+
</p>
|
|
91
|
+
<CodeBlock
|
|
92
|
+
label="src/pages/dashboard.tsx"
|
|
93
|
+
code={`import type { RouteProps, LoaderArgs } from "@thexjs/core";
|
|
94
|
+
import { getDashboardData } from "../actions/dashboard";
|
|
95
|
+
|
|
96
|
+
export async function loader({ request }: LoaderArgs) {
|
|
97
|
+
const data = await getDashboardData();
|
|
98
|
+
return { data };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export default function Dashboard({ loaderData }: RouteProps<typeof loader>) {
|
|
102
|
+
return <div>...</div>;
|
|
103
|
+
}`}
|
|
104
|
+
/>
|
|
105
|
+
|
|
106
|
+
<h2 className="mt-12 text-xl font-bold tracking-tight">Use cases</h2>
|
|
107
|
+
<p className="mt-3 text-muted-foreground">
|
|
108
|
+
Server functions are ideal for form handling, sending emails, database mutations, and any
|
|
109
|
+
server-side logic that doesn't need a dedicated REST API. They reduce boilerplate and keep
|
|
110
|
+
your client code simple.
|
|
111
|
+
</p>
|
|
112
|
+
|
|
113
|
+
<div className="mt-16 border-t border-border pt-8">
|
|
114
|
+
<a
|
|
115
|
+
href="/docs"
|
|
116
|
+
className="inline-flex items-center gap-1 text-sm text-muted-foreground transition-colors hover:text-foreground"
|
|
117
|
+
>
|
|
118
|
+
<ArrowRight className="h-3.5 w-3.5 rotate-180" /> Back to docs
|
|
119
|
+
</a>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ArrowRight,
|
|
3
|
+
BarChart3,
|
|
4
|
+
Box,
|
|
5
|
+
Code2,
|
|
6
|
+
FileJson,
|
|
7
|
+
Globe,
|
|
8
|
+
Layers,
|
|
9
|
+
RefreshCw,
|
|
10
|
+
Server,
|
|
11
|
+
Shield,
|
|
12
|
+
Sparkles,
|
|
13
|
+
Zap,
|
|
14
|
+
} from "lucide-react";
|
|
15
|
+
|
|
16
|
+
const allFeatures = [
|
|
17
|
+
{
|
|
18
|
+
icon: Zap,
|
|
19
|
+
title: "One process, everything included",
|
|
20
|
+
desc: "Static sites, SSR, API routes, and server functions all run in a single Bun process. No microservices, no orchestration, no separate API server.",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
icon: FileJson,
|
|
24
|
+
title: "File-based routing",
|
|
25
|
+
desc: "Your file tree is your route tree. Drop a page in src/pages/ and it's immediately available. Dynamic segments, nested routes, and catch-all 404s come for free.",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
icon: Layers,
|
|
29
|
+
title: "Static + dynamic hybrid",
|
|
30
|
+
desc: "Pick the right rendering mode per route. Use mode='static' for prerendered marketing pages, and server mode for personalized dashboards — all in the same project.",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
icon: Globe,
|
|
34
|
+
title: "API routes built in",
|
|
35
|
+
desc: "Build REST endpoints alongside your frontend. Shared types, same process, zero config. Middleware support for auth, validation, and logging.",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
icon: Server,
|
|
39
|
+
title: "Server functions",
|
|
40
|
+
desc: "Call server-side functions from the browser without writing REST endpoints. Just export async functions from src/actions/ and call them via fetch.",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
icon: Shield,
|
|
44
|
+
title: "Type safe end to end",
|
|
45
|
+
desc: "TypeScript from loader to component. LoaderData is typed through RouteProps, params are inferred from file paths, and server functions are fully typed.",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
icon: BarChart3,
|
|
49
|
+
title: "Content collections",
|
|
50
|
+
desc: "Write markdown files with frontmatter and x turns them into pages. Built-in rendering with code highlighting, slug generation, and frontmatter parsing.",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
icon: Sparkles,
|
|
54
|
+
title: "Live reload",
|
|
55
|
+
desc: "See changes instantly. The dev server watches pages, layouts, API routes, and actions. No manual restarts, no build step during development.",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
icon: Box,
|
|
59
|
+
title: "Optimized production builds",
|
|
60
|
+
desc: "One command produces static HTML, a server bundle, and a build manifest. Deploy anywhere Bun runs — Fly.io, Railway, Docker, or a VPS.",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
icon: Code2,
|
|
64
|
+
title: "Islands architecture",
|
|
65
|
+
desc: "Interactive client components hydrate in place. The rest of the page is static HTML. Minimal JavaScript, maximum performance.",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
icon: RefreshCw,
|
|
69
|
+
title: "Database integration",
|
|
70
|
+
desc: "Built-in SQLite and PostgreSQL support with migrations. Query databases directly from loaders and server functions with prepared statements.",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
icon: ArrowRight,
|
|
74
|
+
title: "Open source",
|
|
75
|
+
desc: "MIT licensed. Contributions welcome. Built for Bun with modern JavaScript in mind. No lock-in, no proprietary formats.",
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
export default function FeaturesPage() {
|
|
80
|
+
return (
|
|
81
|
+
<div className="mx-auto max-w-6xl px-6 py-20">
|
|
82
|
+
<div className="mx-auto max-w-2xl text-center">
|
|
83
|
+
<p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">Features</p>
|
|
84
|
+
<h1 className="mt-4 text-4xl font-bold tracking-tight sm:text-5xl">
|
|
85
|
+
Everything you need to build for the web
|
|
86
|
+
</h1>
|
|
87
|
+
<p className="mt-4 text-lg text-muted-foreground">
|
|
88
|
+
x combines static generation, server rendering, APIs, and server functions in a single Bun
|
|
89
|
+
process — with zero configuration.
|
|
90
|
+
</p>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
<div className="mt-16 grid gap-px overflow-hidden rounded-2xl border border-border bg-border sm:grid-cols-2 lg:grid-cols-3">
|
|
94
|
+
{allFeatures.map((f) => (
|
|
95
|
+
<div key={f.title} className="bg-card p-8 transition-colors hover:bg-card/80">
|
|
96
|
+
<div className="flex h-10 w-10 items-center justify-center rounded-xl bg-primary/10 text-primary">
|
|
97
|
+
<f.icon className="h-5 w-5" />
|
|
98
|
+
</div>
|
|
99
|
+
<h3 className="mt-5 text-lg font-semibold">{f.title}</h3>
|
|
100
|
+
<p className="mt-2 text-sm leading-relaxed text-muted-foreground">{f.desc}</p>
|
|
101
|
+
</div>
|
|
102
|
+
))}
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<div className="mt-16">
|
|
106
|
+
<div className="rounded-3xl border border-primary/20 bg-gradient-to-b from-primary/5 to-transparent p-12 text-center sm:p-20">
|
|
107
|
+
<h2 className="text-3xl font-bold tracking-tight sm:text-4xl">Ready to build with x?</h2>
|
|
108
|
+
<p className="mt-4 text-lg text-muted-foreground">
|
|
109
|
+
One command, one process, everything you need.
|
|
110
|
+
</p>
|
|
111
|
+
<div className="mt-8 flex flex-wrap items-center justify-center gap-4">
|
|
112
|
+
<a
|
|
113
|
+
href="/docs/getting-started"
|
|
114
|
+
className="inline-flex h-12 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"
|
|
115
|
+
>
|
|
116
|
+
Get started <ArrowRight className="h-4 w-4" />
|
|
117
|
+
</a>
|
|
118
|
+
<a
|
|
119
|
+
href="/docs"
|
|
120
|
+
className="inline-flex h-12 items-center gap-2 rounded-xl border border-border bg-card px-6 text-sm font-medium text-foreground transition-all hover:bg-muted"
|
|
121
|
+
>
|
|
122
|
+
Read the docs
|
|
123
|
+
</a>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { ArrowRight, BookOpen, Code2, FileJson, Globe, Layers, Shield, Zap } from "lucide-react";
|
|
2
|
+
import { CodeBlock } from "../components/code-block";
|
|
3
|
+
|
|
4
|
+
const features = [
|
|
5
|
+
{
|
|
6
|
+
icon: Zap,
|
|
7
|
+
title: "One process",
|
|
8
|
+
desc: "Static sites, SSR, API routes, and server functions — no microservices, no orchestration.",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
icon: FileJson,
|
|
12
|
+
title: "File-based routing",
|
|
13
|
+
desc: "Drop a file in src/pages, get a route. Nested folders, dynamic segments, API routes — automatic.",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
icon: Layers,
|
|
17
|
+
title: "Static + dynamic",
|
|
18
|
+
desc: "Mix static generation with SSR on the same route. Prerender marketing pages, SSR dashboards and admin.",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
icon: Globe,
|
|
22
|
+
title: "API routes",
|
|
23
|
+
desc: "Build REST endpoints alongside your pages. Shared types, same process, no separate server needed.",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
icon: Shield,
|
|
27
|
+
title: "Type safe",
|
|
28
|
+
desc: "End-to-end TypeScript. Loaders, params, server functions — all typed from the framework to your components.",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
icon: Code2,
|
|
32
|
+
title: "Island architecture",
|
|
33
|
+
desc: "Interactive components hydrate in place. Minimal client JS — only what you mark as an island loads.",
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
export default function HomePage() {
|
|
38
|
+
return (
|
|
39
|
+
<div className="pb-32">
|
|
40
|
+
{/* ── Hero ── */}
|
|
41
|
+
<section className="relative flex min-h-[90vh] flex-col items-center justify-center overflow-hidden px-6">
|
|
42
|
+
<div className="pointer-events-none absolute inset-0 flex items-start justify-center pt-16">
|
|
43
|
+
<div className="h-[500px] w-[500px] animate-pulse-glow rounded-full bg-primary/20 sm:h-[700px] sm:w-[700px]" />
|
|
44
|
+
</div>
|
|
45
|
+
<div className="relative z-10 flex flex-col items-center text-center">
|
|
46
|
+
<h1 className="max-w-3xl text-5xl font-bold tracking-tight leading-[1.1] sm:text-7xl">
|
|
47
|
+
Build anything.
|
|
48
|
+
<br />
|
|
49
|
+
<span className="text-primary">Ship anywhere.</span>
|
|
50
|
+
</h1>
|
|
51
|
+
<p className="mt-6 max-w-xl text-lg text-muted-foreground sm:text-xl">
|
|
52
|
+
A fullstack framework for Bun. Static sites, SSR, API routes, and server functions — all
|
|
53
|
+
in one process.
|
|
54
|
+
</p>
|
|
55
|
+
<div className="mt-10 flex flex-wrap items-center justify-center gap-4">
|
|
56
|
+
<a
|
|
57
|
+
href="/docs/getting-started"
|
|
58
|
+
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/30 transition-all hover:bg-primary/90 hover:shadow-primary/40 active:scale-[0.97]"
|
|
59
|
+
>
|
|
60
|
+
Get Started{" "}
|
|
61
|
+
<ArrowRight className="h-4 w-4 transition-transform group-hover:translate-x-0.5" />
|
|
62
|
+
</a>
|
|
63
|
+
<a
|
|
64
|
+
href="/docs"
|
|
65
|
+
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]"
|
|
66
|
+
>
|
|
67
|
+
<BookOpen className="h-4 w-4" /> Read the Docs
|
|
68
|
+
</a>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
<div className="pointer-events-none absolute bottom-0 left-0 right-0 h-64 bg-gradient-to-t from-background to-transparent" />
|
|
72
|
+
</section>
|
|
73
|
+
|
|
74
|
+
{/* ── Features ── */}
|
|
75
|
+
<section className="mx-auto max-w-6xl px-6">
|
|
76
|
+
<div className="mx-auto max-w-2xl text-center">
|
|
77
|
+
<p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">Why x</p>
|
|
78
|
+
<h2 className="mt-4 text-3xl font-bold tracking-tight sm:text-4xl">
|
|
79
|
+
Everything in one place
|
|
80
|
+
</h2>
|
|
81
|
+
<p className="mt-4 text-muted-foreground">
|
|
82
|
+
Most frameworks make you choose. x gives you everything — in one Bun process, zero
|
|
83
|
+
config.
|
|
84
|
+
</p>
|
|
85
|
+
</div>
|
|
86
|
+
<div className="mt-16 grid gap-px overflow-hidden rounded-2xl border border-border bg-border sm:grid-cols-3">
|
|
87
|
+
{features.map((f) => (
|
|
88
|
+
<div key={f.title} className="bg-card p-8 transition-colors hover:bg-card/80">
|
|
89
|
+
<div className="flex h-10 w-10 items-center justify-center rounded-xl bg-primary/10 text-primary">
|
|
90
|
+
<f.icon className="h-5 w-5" />
|
|
91
|
+
</div>
|
|
92
|
+
<h3 className="mt-5 text-lg font-semibold">{f.title}</h3>
|
|
93
|
+
<p className="mt-2 text-sm leading-relaxed text-muted-foreground">{f.desc}</p>
|
|
94
|
+
</div>
|
|
95
|
+
))}
|
|
96
|
+
</div>
|
|
97
|
+
</section>
|
|
98
|
+
|
|
99
|
+
{/* ── Terminal / Quick start ── */}
|
|
100
|
+
<section className="mx-auto mt-32 max-w-4xl px-6">
|
|
101
|
+
<div className="mx-auto max-w-2xl text-center">
|
|
102
|
+
<p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">
|
|
103
|
+
Quick start
|
|
104
|
+
</p>
|
|
105
|
+
<h2 className="mt-4 text-3xl font-bold tracking-tight sm:text-4xl">
|
|
106
|
+
One command to start
|
|
107
|
+
</h2>
|
|
108
|
+
<p className="mt-4 text-muted-foreground">
|
|
109
|
+
Create a project, add a page, run the dev server. Two minutes, zero config.
|
|
110
|
+
</p>
|
|
111
|
+
</div>
|
|
112
|
+
<CodeBlock
|
|
113
|
+
label="~/project — bash"
|
|
114
|
+
lang="bash"
|
|
115
|
+
code={`mkdir my-app && cd my-app
|
|
116
|
+
bun create x@latest
|
|
117
|
+
Creating a new x project...
|
|
118
|
+
Done!
|
|
119
|
+
|
|
120
|
+
cat > src/pages/index.tsx <<EOF
|
|
121
|
+
export default function Home() {
|
|
122
|
+
return (
|
|
123
|
+
<h1 className="text-3xl font-bold">Hello x!</h1>
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
EOF
|
|
127
|
+
x dev
|
|
128
|
+
compiling Tailwind CSS...
|
|
129
|
+
dev server running at http://localhost:3000`}
|
|
130
|
+
/>
|
|
131
|
+
<div className="mt-8 text-center">
|
|
132
|
+
<a
|
|
133
|
+
href="/docs/getting-started"
|
|
134
|
+
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]"
|
|
135
|
+
>
|
|
136
|
+
Read the full guide{" "}
|
|
137
|
+
<ArrowRight className="h-4 w-4 transition-transform group-hover:translate-x-0.5" />
|
|
138
|
+
</a>
|
|
139
|
+
</div>
|
|
140
|
+
</section>
|
|
141
|
+
|
|
142
|
+
{/* ── CTA ── */}
|
|
143
|
+
<section className="mx-auto mt-32 max-w-4xl px-6">
|
|
144
|
+
<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">
|
|
145
|
+
<div className="pointer-events-none absolute -right-20 -top-20 h-60 w-60 rounded-full bg-primary/10 blur-3xl" />
|
|
146
|
+
<div className="relative">
|
|
147
|
+
<h2 className="text-3xl font-bold tracking-tight sm:text-4xl">Ready to build?</h2>
|
|
148
|
+
<p className="mt-4 text-lg text-muted-foreground">
|
|
149
|
+
One command, one process, everything you need. Start building with x today.
|
|
150
|
+
</p>
|
|
151
|
+
<div className="mt-8 flex flex-wrap items-center justify-center gap-4">
|
|
152
|
+
<a
|
|
153
|
+
href="/docs"
|
|
154
|
+
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]"
|
|
155
|
+
>
|
|
156
|
+
<BookOpen className="h-4 w-4" /> Read the docs
|
|
157
|
+
</a>
|
|
158
|
+
<a
|
|
159
|
+
href="https://github.com/anomalyco/x"
|
|
160
|
+
target="_blank"
|
|
161
|
+
rel="noopener noreferrer"
|
|
162
|
+
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]"
|
|
163
|
+
>
|
|
164
|
+
<svg viewBox="0 0 24 24" className="h-5 w-5" fill="currentColor">
|
|
165
|
+
<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" />
|
|
166
|
+
</svg>
|
|
167
|
+
GitHub
|
|
168
|
+
</a>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
</section>
|
|
173
|
+
</div>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap");
|
|
2
|
+
|
|
3
|
+
@import "tailwindcss";
|
|
4
|
+
@import "tw-animate-css";
|
|
5
|
+
|
|
6
|
+
@custom-variant dark (&:is(.dark *));
|
|
7
|
+
|
|
8
|
+
@theme inline {
|
|
9
|
+
--font-sans: "Instrument Sans", "Inter", ui-sans-serif, system-ui, sans-serif;
|
|
10
|
+
--font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
|
|
11
|
+
--color-background: var(--background);
|
|
12
|
+
--color-foreground: var(--foreground);
|
|
13
|
+
--color-card: var(--card);
|
|
14
|
+
--color-card-foreground: var(--card-foreground);
|
|
15
|
+
--color-popover: var(--popover);
|
|
16
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
17
|
+
--color-primary: var(--primary);
|
|
18
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
19
|
+
--color-secondary: var(--secondary);
|
|
20
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
21
|
+
--color-muted: var(--muted);
|
|
22
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
23
|
+
--color-accent: var(--accent);
|
|
24
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
25
|
+
--color-destructive: var(--destructive);
|
|
26
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
27
|
+
--color-border: var(--border);
|
|
28
|
+
--color-input: var(--input);
|
|
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
|
+
--animate-float: float 3s ease-in-out infinite;
|
|
39
|
+
--animate-pulse-glow: pulse-glow 2s ease-in-out infinite;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:root {
|
|
43
|
+
--radius: 0.75rem;
|
|
44
|
+
--background: oklch(0.11 0.015 265);
|
|
45
|
+
--foreground: oklch(0.96 0.01 265);
|
|
46
|
+
--card: oklch(0.16 0.02 265);
|
|
47
|
+
--card-foreground: oklch(0.96 0.01 265);
|
|
48
|
+
--popover: oklch(0.16 0.02 265);
|
|
49
|
+
--popover-foreground: oklch(0.96 0.01 265);
|
|
50
|
+
--primary: oklch(0.72 0.18 35);
|
|
51
|
+
--primary-foreground: oklch(0.11 0.015 265);
|
|
52
|
+
--secondary: oklch(0.65 0.15 195);
|
|
53
|
+
--secondary-foreground: oklch(0.96 0.01 265);
|
|
54
|
+
--muted: oklch(0.2 0.015 265);
|
|
55
|
+
--muted-foreground: oklch(0.58 0.02 265);
|
|
56
|
+
--accent: oklch(0.72 0.18 35);
|
|
57
|
+
--accent-foreground: oklch(0.11 0.015 265);
|
|
58
|
+
--destructive: oklch(0.63 0.2 30);
|
|
59
|
+
--border: oklch(0.22 0.015 265);
|
|
60
|
+
--input: oklch(0.22 0.015 265);
|
|
61
|
+
--ring: oklch(0.72 0.18 35);
|
|
62
|
+
--sidebar: oklch(0.16 0.02 265);
|
|
63
|
+
--sidebar-foreground: oklch(0.96 0.01 265);
|
|
64
|
+
--sidebar-primary: oklch(0.72 0.18 35);
|
|
65
|
+
--sidebar-primary-foreground: oklch(0.11 0.015 265);
|
|
66
|
+
--sidebar-accent: oklch(0.2 0.015 265);
|
|
67
|
+
--sidebar-border: oklch(0.22 0.015 265);
|
|
68
|
+
--sidebar-ring: oklch(0.72 0.18 35);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@layer base {
|
|
72
|
+
* {
|
|
73
|
+
@apply border-border outline-ring/50;
|
|
74
|
+
}
|
|
75
|
+
body {
|
|
76
|
+
@apply bg-background text-foreground font-sans;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@keyframes float {
|
|
81
|
+
0%,
|
|
82
|
+
100% {
|
|
83
|
+
transform: translateY(0px);
|
|
84
|
+
}
|
|
85
|
+
50% {
|
|
86
|
+
transform: translateY(-10px);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@keyframes pulse-glow {
|
|
91
|
+
0%,
|
|
92
|
+
100% {
|
|
93
|
+
opacity: 0.6;
|
|
94
|
+
filter: blur(40px);
|
|
95
|
+
}
|
|
96
|
+
50% {
|
|
97
|
+
opacity: 1;
|
|
98
|
+
filter: blur(60px);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Auto-generated by @thexjs/core -- do not edit
|
|
2
|
+
export type RouteMap = {
|
|
3
|
+
"/": Record<string, never>;
|
|
4
|
+
"/features": Record<string, never>;
|
|
5
|
+
"/contact": Record<string, never>;
|
|
6
|
+
"/docs": Record<string, never>;
|
|
7
|
+
"/docs/content-collections": Record<string, never>;
|
|
8
|
+
"/docs/build-deploy": Record<string, never>;
|
|
9
|
+
"/docs/configuration": Record<string, never>;
|
|
10
|
+
"/docs/data-layer": Record<string, never>;
|
|
11
|
+
"/docs/server-functions": Record<string, never>;
|
|
12
|
+
"/docs/layouts": Record<string, never>;
|
|
13
|
+
"/docs/api-routes": Record<string, never>;
|
|
14
|
+
"/docs/routing": Record<string, never>;
|
|
15
|
+
"/docs/pages": Record<string, never>;
|
|
16
|
+
"/docs/getting-started": Record<string, never>;
|
|
17
|
+
"/docs/middleware": Record<string, never>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export function href<T extends keyof RouteMap & string>(
|
|
21
|
+
path: T,
|
|
22
|
+
...[params]: RouteMap[T] extends Record<string, never> ? [] : [RouteMap[T]]
|
|
23
|
+
): string {
|
|
24
|
+
if (!params) return path;
|
|
25
|
+
let result: string = path;
|
|
26
|
+
for (const [key, value] of Object.entries(params)) {
|
|
27
|
+
result = result.replace(new RegExp(`:${key}(?=/|$)`), encodeURIComponent(String(value)));
|
|
28
|
+
}
|
|
29
|
+
result = result.replace(/\*+$/, "");
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "base-nova",
|
|
4
|
+
"rsc": false,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "src/styles/globals.css",
|
|
9
|
+
"baseColor": "neutral",
|
|
10
|
+
"cssVariables": true,
|
|
11
|
+
"prefix": ""
|
|
12
|
+
},
|
|
13
|
+
"aliases": {
|
|
14
|
+
"components": "@/components",
|
|
15
|
+
"utils": "@/lib/utils",
|
|
16
|
+
"ui": "@/components/ui",
|
|
17
|
+
"lib": "@/lib"
|
|
18
|
+
},
|
|
19
|
+
"iconLibrary": "lucide"
|
|
20
|
+
}
|
|
Binary file
|