@evjs/create-app 0.0.1-rc.27

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 (48) hide show
  1. package/dist/index.js +97 -0
  2. package/package.json +54 -0
  3. package/templates/basic-csr/README.md +23 -0
  4. package/templates/basic-csr/index.html +11 -0
  5. package/templates/basic-csr/package.json +22 -0
  6. package/templates/basic-csr/src/main.tsx +22 -0
  7. package/templates/basic-csr/src/pages/__root.tsx +28 -0
  8. package/templates/basic-csr/src/pages/about.tsx +19 -0
  9. package/templates/basic-csr/src/pages/home.tsx +19 -0
  10. package/templates/basic-csr/src/pages/posts/index.tsx +63 -0
  11. package/templates/basic-csr/tsconfig.json +17 -0
  12. package/templates/basic-server-fns/README.md +24 -0
  13. package/templates/basic-server-fns/index.html +11 -0
  14. package/templates/basic-server-fns/package.json +22 -0
  15. package/templates/basic-server-fns/src/api/users.server.ts +31 -0
  16. package/templates/basic-server-fns/src/main.tsx +12 -0
  17. package/templates/basic-server-fns/src/routes.tsx +103 -0
  18. package/templates/basic-server-fns/tsconfig.json +16 -0
  19. package/templates/complex-routing/README.md +27 -0
  20. package/templates/complex-routing/index.html +11 -0
  21. package/templates/complex-routing/package.json +22 -0
  22. package/templates/complex-routing/src/api/data.server.ts +86 -0
  23. package/templates/complex-routing/src/main.tsx +29 -0
  24. package/templates/complex-routing/src/pages/__root.tsx +60 -0
  25. package/templates/complex-routing/src/pages/catch.tsx +26 -0
  26. package/templates/complex-routing/src/pages/dashboard.tsx +79 -0
  27. package/templates/complex-routing/src/pages/home.tsx +35 -0
  28. package/templates/complex-routing/src/pages/posts/index.tsx +100 -0
  29. package/templates/complex-routing/src/pages/search.tsx +71 -0
  30. package/templates/complex-routing/src/pages/user.tsx +28 -0
  31. package/templates/complex-routing/tsconfig.json +13 -0
  32. package/templates/configured-server-fns/README.md +24 -0
  33. package/templates/configured-server-fns/ev.config.ts +56 -0
  34. package/templates/configured-server-fns/index.html +11 -0
  35. package/templates/configured-server-fns/package.json +22 -0
  36. package/templates/configured-server-fns/src/api/users.server.ts +22 -0
  37. package/templates/configured-server-fns/src/main.tsx +12 -0
  38. package/templates/configured-server-fns/src/routes.tsx +95 -0
  39. package/templates/configured-server-fns/tsconfig.json +16 -0
  40. package/templates/with-tailwind/ev.config.ts +20 -0
  41. package/templates/with-tailwind/index.html +11 -0
  42. package/templates/with-tailwind/package.json +29 -0
  43. package/templates/with-tailwind/postcss.config.mjs +5 -0
  44. package/templates/with-tailwind/src/main.tsx +15 -0
  45. package/templates/with-tailwind/src/pages/__root.tsx +30 -0
  46. package/templates/with-tailwind/src/pages/home.tsx +85 -0
  47. package/templates/with-tailwind/src/styles.css +2 -0
  48. package/templates/with-tailwind/tsconfig.json +17 -0
package/dist/index.js ADDED
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env node
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { Command } from "commander";
5
+ import fs from "fs-extra";
6
+ import pc from "picocolors";
7
+ import prompts from "prompts";
8
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
+ const pkg = fs.readJsonSync(path.resolve(__dirname, "../package.json"));
10
+ const program = new Command();
11
+ program
12
+ .name("create-evjs-app")
13
+ .description("Scaffold a new evjs project")
14
+ .version(pkg.version)
15
+ .argument("[name]", "Project name")
16
+ .option("-t, --template <template>", "Template to use")
17
+ .action(async (name, options) => {
18
+ const response = await prompts([
19
+ {
20
+ type: name ? null : "text",
21
+ name: "projectName",
22
+ message: "Project name:",
23
+ initial: name || "my-evjs-app",
24
+ },
25
+ {
26
+ type: options.template ? null : "select",
27
+ name: "template",
28
+ message: "Select a template:",
29
+ choices: [
30
+ { title: "Basic CSR (Client-Side Rendering)", value: "basic-csr" },
31
+ { title: "Basic Server Functions", value: "basic-server-fns" },
32
+ {
33
+ title: "Configured Server Functions (ev.config.ts + Query)",
34
+ value: "configured-server-fns",
35
+ },
36
+ {
37
+ title: "Complex Routing (params, search, layouts, loaders)",
38
+ value: "complex-routing",
39
+ },
40
+ {
41
+ title: "With Tailwind CSS (plugin loaders example)",
42
+ value: "with-tailwind",
43
+ },
44
+ ],
45
+ },
46
+ ], {
47
+ onCancel: () => {
48
+ process.exit(1);
49
+ },
50
+ });
51
+ const projectName = response.projectName || name;
52
+ const template = response.template || options.template;
53
+ const targetDir = path.resolve(process.cwd(), projectName);
54
+ if (fs.existsSync(targetDir)) {
55
+ console.error(pc.red(`✖ Directory ${projectName} already exists!`));
56
+ process.exit(1);
57
+ }
58
+ const templateDir = path.resolve(__dirname, "../templates", template);
59
+ if (!fs.existsSync(templateDir)) {
60
+ console.error(pc.red(`✖ Template ${template} not found!`));
61
+ process.exit(1);
62
+ }
63
+ console.log(pc.cyan(`⚡ Scaffolding project in ${targetDir}...`));
64
+ await fs.copy(templateDir, targetDir, {
65
+ dereference: true,
66
+ filter: (src) => {
67
+ const basename = path.basename(src);
68
+ return !["node_modules", "dist", ".turbo"].includes(basename);
69
+ },
70
+ });
71
+ // Post-process package.json: sync @evjs/* versions and set project name
72
+ const pkgPath = path.join(targetDir, "package.json");
73
+ if (fs.existsSync(pkgPath)) {
74
+ const projPkg = await fs.readJson(pkgPath);
75
+ projPkg.name = projectName;
76
+ delete projPkg.private; // Templates shouldn't be private by default
77
+ const updateDeps = (deps) => {
78
+ if (!deps)
79
+ return;
80
+ for (const [depName, val] of Object.entries(deps)) {
81
+ if (depName.startsWith("@evjs/") &&
82
+ (val === "*" ||
83
+ (typeof val === "string" && val.includes("workspace")))) {
84
+ deps[depName] = `^${pkg.version}`;
85
+ }
86
+ }
87
+ };
88
+ updateDeps(projPkg.dependencies);
89
+ updateDeps(projPkg.devDependencies);
90
+ await fs.writeJson(pkgPath, projPkg, { spaces: 2 });
91
+ }
92
+ console.log(pc.green("✔ Done! Now run:"));
93
+ console.log(` cd ${projectName}`);
94
+ console.log(" npm install");
95
+ console.log(" npm run dev");
96
+ });
97
+ program.parse();
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@evjs/create-app",
3
+ "version": "0.0.1-rc.27",
4
+ "description": "Scaffold a new evjs project",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "bin": {
8
+ "create-evjs-app": "dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "templates"
13
+ ],
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "check-types": "tsc --noEmit",
20
+ "prepack": "node scripts/deref-templates.js",
21
+ "postpack": "node scripts/restore-templates.js"
22
+ },
23
+ "dependencies": {
24
+ "commander": "^12.1.0",
25
+ "fs-extra": "^11.3.0",
26
+ "picocolors": "^1.1.1",
27
+ "prompts": "^2.4.2"
28
+ },
29
+ "devDependencies": {
30
+ "@types/fs-extra": "^11.0.4",
31
+ "@types/node": "^22.13.5",
32
+ "@types/prompts": "^2.4.9",
33
+ "typescript": "^5.7.3"
34
+ },
35
+ "homepage": "https://github.com/evaijs/evjs#readme",
36
+ "bugs": {
37
+ "url": "https://github.com/evaijs/evjs/issues"
38
+ },
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/evaijs/evjs.git"
42
+ },
43
+ "keywords": [
44
+ "evjs",
45
+ "create-app",
46
+ "scaffolding",
47
+ "react",
48
+ "server-functions",
49
+ "typescript",
50
+ "framework"
51
+ ],
52
+ "license": "MIT",
53
+ "author": "xusd320"
54
+ }
@@ -0,0 +1,23 @@
1
+ # basic-csr
2
+
3
+ Minimal client-side rendering example — no server functions, just routing.
4
+
5
+ ## Run
6
+
7
+ ```bash
8
+ npm run dev -w example-basic-csr
9
+ ```
10
+
11
+ ## Key Files
12
+
13
+ | File | Purpose |
14
+ |------|---------|
15
+ | `src/main.tsx` | App bootstrap with `createApp` |
16
+ | `src/pages/` | Route components (Home, Posts) |
17
+
18
+ ## What It Demonstrates
19
+
20
+ - `createApp` + `createRoute` from `@evjs/client`
21
+ - Client-side routing with TanStack Router
22
+ - Dynamic route params (`$postId`)
23
+ - No server functions — pure CSR
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>ev — Basic CSR Example</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ </body>
11
+ </html>
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "example-basic-csr",
3
+ "version": "0.0.1-rc.27",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "ev dev",
7
+ "build": "ev build",
8
+ "check-types": "tsc --noEmit"
9
+ },
10
+ "dependencies": {
11
+ "react": "^19.2.4",
12
+ "react-dom": "^19.2.4"
13
+ },
14
+ "devDependencies": {
15
+ "@evjs/cli": "*",
16
+ "@evjs/client": "*",
17
+ "@evjs/server": "*",
18
+ "@types/react": "^19.0.8",
19
+ "@types/react-dom": "^19.0.3",
20
+ "typescript": "^5.7.3"
21
+ }
22
+ }
@@ -0,0 +1,22 @@
1
+ import { createApp } from "@evjs/client";
2
+ import { rootRoute } from "./pages/__root";
3
+ import { aboutRoute } from "./pages/about";
4
+ import { homeRoute } from "./pages/home";
5
+ import { postDetailRoute, postsIndexRoute, postsRoute } from "./pages/posts";
6
+
7
+ const routeTree = rootRoute.addChildren([
8
+ homeRoute,
9
+ aboutRoute,
10
+ postsRoute.addChildren([postsIndexRoute, postDetailRoute]),
11
+ ]);
12
+
13
+ const app = createApp({ routeTree });
14
+
15
+ // Register router type for full IDE type-safety on useParams, useSearch, Link, etc.
16
+ declare module "@tanstack/react-router" {
17
+ interface Register {
18
+ router: typeof app.router;
19
+ }
20
+ }
21
+
22
+ app.render("#app");
@@ -0,0 +1,28 @@
1
+ import { createRootRoute, Link, Outlet } from "@evjs/client";
2
+
3
+ function Root() {
4
+ return (
5
+ <div style={{ fontFamily: "system-ui, sans-serif", padding: "1rem" }}>
6
+ <nav
7
+ style={{
8
+ display: "flex",
9
+ gap: "1rem",
10
+ borderBottom: "1px solid #e5e7eb",
11
+ paddingBottom: "0.5rem",
12
+ marginBottom: "1rem",
13
+ }}
14
+ >
15
+ <Link to="/" style={{ fontWeight: "bold" }}>
16
+ Home
17
+ </Link>
18
+ <Link to="/about">About</Link>
19
+ <Link to="/posts">Posts</Link>
20
+ </nav>
21
+ <Outlet />
22
+ </div>
23
+ );
24
+ }
25
+
26
+ export const rootRoute = createRootRoute({
27
+ component: Root,
28
+ });
@@ -0,0 +1,19 @@
1
+ import { createRoute } from "@evjs/client";
2
+ import { rootRoute } from "./__root";
3
+
4
+ function About() {
5
+ return (
6
+ <div>
7
+ <h1>About</h1>
8
+ <p>
9
+ Code-based routing with TanStack Router via <code>createApp</code>.
10
+ </p>
11
+ </div>
12
+ );
13
+ }
14
+
15
+ export const aboutRoute = createRoute({
16
+ getParentRoute: () => rootRoute,
17
+ path: "/about",
18
+ component: About,
19
+ });
@@ -0,0 +1,19 @@
1
+ import { createRoute } from "@evjs/client";
2
+ import { rootRoute } from "./__root";
3
+
4
+ function Home() {
5
+ return (
6
+ <div>
7
+ <h1>Welcome Home!</h1>
8
+ <p>
9
+ A basic client-side rendered app built with <code>@evjs/client</code>.
10
+ </p>
11
+ </div>
12
+ );
13
+ }
14
+
15
+ export const homeRoute = createRoute({
16
+ getParentRoute: () => rootRoute,
17
+ path: "/",
18
+ component: Home,
19
+ });
@@ -0,0 +1,63 @@
1
+ import { createRoute, Link, Outlet } from "@evjs/client";
2
+ import { rootRoute } from "../__root";
3
+
4
+ const posts = [
5
+ { id: "1", title: "First Post", body: "Hello world!" },
6
+ { id: "2", title: "Second Post", body: "Another day, another post." },
7
+ { id: "3", title: "Third Post", body: "Three's a charm." },
8
+ ];
9
+
10
+ function Posts() {
11
+ return (
12
+ <div style={{ display: "flex", gap: "1rem" }}>
13
+ <ul style={{ listStyle: "none", padding: 0, minWidth: 160 }}>
14
+ {posts.map((p) => (
15
+ <li key={p.id} style={{ marginBottom: "0.25rem" }}>
16
+ <Link
17
+ to="/posts/$postId"
18
+ params={{ postId: p.id }}
19
+ activeProps={{ style: { fontWeight: "bold" } }}
20
+ >
21
+ {p.title}
22
+ </Link>
23
+ </li>
24
+ ))}
25
+ </ul>
26
+ <Outlet />
27
+ </div>
28
+ );
29
+ }
30
+
31
+ export const postsRoute = createRoute({
32
+ getParentRoute: () => rootRoute,
33
+ path: "/posts",
34
+ component: Posts,
35
+ });
36
+
37
+ function PostsIndex() {
38
+ return <p style={{ color: "#6b7280" }}>Select a post.</p>;
39
+ }
40
+
41
+ export const postsIndexRoute = createRoute({
42
+ getParentRoute: () => postsRoute,
43
+ path: "/",
44
+ component: PostsIndex,
45
+ });
46
+
47
+ function PostDetail() {
48
+ const { postId } = postDetailRoute.useParams();
49
+ const post = posts.find((p) => p.id === postId);
50
+ if (!post) return <p>Post not found.</p>;
51
+ return (
52
+ <div>
53
+ <h2>{post.title}</h2>
54
+ <p>{post.body}</p>
55
+ </div>
56
+ );
57
+ }
58
+
59
+ export const postDetailRoute = createRoute({
60
+ getParentRoute: () => postsRoute,
61
+ path: "$postId",
62
+ component: PostDetail,
63
+ });
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "jsx": "react-jsx",
5
+ "module": "ESNext",
6
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
7
+ "moduleResolution": "Bundler",
8
+ "verbatimModuleSyntax": true,
9
+ "noEmit": true,
10
+ "skipLibCheck": true,
11
+ "strict": true,
12
+ "noUnusedLocals": true,
13
+ "noUnusedParameters": true,
14
+ "noFallthroughCasesInSwitch": true
15
+ },
16
+ "include": ["src"]
17
+ }
@@ -0,0 +1,24 @@
1
+ # basic-server-fns
2
+
3
+ Basic server functions with type-safe `useQuery()` / `useMutation()`.
4
+
5
+ ## Run
6
+
7
+ ```bash
8
+ npm run dev -w example-basic-server-fns
9
+ ```
10
+
11
+ ## Key Files
12
+
13
+ | File | Purpose |
14
+ |------|---------|
15
+ | `src/main.tsx` | App bootstrap |
16
+ | `src/routes.tsx` | Routes + components |
17
+ | `src/api/users.server.ts` | `"use server"` CRUD functions |
18
+
19
+ ## What It Demonstrates
20
+
21
+ - `"use server"` directive for auto-discovered server functions
22
+ - `useQuery(getUsers)` for type-safe data fetching
23
+ - `useMutation({ mutationFn: createUser })` for mutations
24
+ - `serverFn(getUsers).queryKey` for cache invalidation
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Server Functions Example</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ </body>
11
+ </html>
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "example-basic-server-fns",
3
+ "version": "0.0.1-rc.27",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "ev dev",
7
+ "build": "ev build",
8
+ "check-types": "tsc --noEmit"
9
+ },
10
+ "dependencies": {
11
+ "react": "^19.2.4",
12
+ "react-dom": "^19.2.4"
13
+ },
14
+ "devDependencies": {
15
+ "@evjs/cli": "*",
16
+ "@evjs/client": "*",
17
+ "@evjs/server": "*",
18
+ "@types/react": "^19.1.8",
19
+ "@types/react-dom": "^19.1.8",
20
+ "typescript": "^5.7.3"
21
+ }
22
+ }
@@ -0,0 +1,31 @@
1
+ "use server";
2
+
3
+ /** Simulated user database. */
4
+ const users = [
5
+ { id: "1", name: "Alice", email: "alice@example.com" },
6
+ { id: "2", name: "Bob", email: "bob@example.com" },
7
+ { id: "3", name: "Charlie", email: "charlie@example.com" },
8
+ ];
9
+
10
+ /** Get all users. */
11
+ export async function getUsers() {
12
+ // Simulate server latency
13
+ await new Promise((r) => setTimeout(r, 100));
14
+ return users;
15
+ }
16
+
17
+ /** Get a single user by ID. */
18
+ export async function getUser(id: string) {
19
+ await new Promise((r) => setTimeout(r, 50));
20
+ const user = users.find((u) => u.id === id);
21
+ if (!user) throw new Error(`User ${id} not found`);
22
+ return user;
23
+ }
24
+
25
+ /** Create a new user. */
26
+ export async function createUser(data: { name: string; email: string }) {
27
+ await new Promise((r) => setTimeout(r, 50));
28
+ const newUser = { id: String(users.length + 1), ...data };
29
+ users.push(newUser);
30
+ return newUser;
31
+ }
@@ -0,0 +1,12 @@
1
+ import { createApp } from "@evjs/client";
2
+ import { routeTree } from "./routes";
3
+
4
+ const app = createApp({ routeTree });
5
+
6
+ declare module "@tanstack/react-router" {
7
+ interface Register {
8
+ router: typeof app.router;
9
+ }
10
+ }
11
+
12
+ app.render("#app");
@@ -0,0 +1,103 @@
1
+ import { createRootRoute, createRoute, Link, Outlet } from "@evjs/client";
2
+ import { useEffect, useState } from "react";
3
+ import { createUser, getUsers } from "./api/users.server";
4
+
5
+ // ── Root Route ──
6
+
7
+ function Root() {
8
+ return (
9
+ <div style={{ fontFamily: "system-ui, sans-serif", padding: "1rem" }}>
10
+ <h1>Server Functions Example</h1>
11
+ <nav style={{ display: "flex", gap: "1rem", marginBottom: "1rem" }}>
12
+ <Link to="/">Users</Link>
13
+ </nav>
14
+ <Outlet />
15
+ </div>
16
+ );
17
+ }
18
+
19
+ const rootRoute = createRootRoute({ component: Root });
20
+
21
+ // ── Users Route ──
22
+
23
+ function UsersPage() {
24
+ const [name, setName] = useState("");
25
+ const [email, setEmail] = useState("");
26
+
27
+ const [users, setUsers] = useState<
28
+ { id: string; name: string; email: string }[]
29
+ >([]);
30
+ const [isLoading, setIsLoading] = useState(true);
31
+
32
+ useEffect(() => {
33
+ let mounted = true;
34
+ getUsers()
35
+ .then((data) => {
36
+ if (mounted) {
37
+ setUsers(data);
38
+ setIsLoading(false);
39
+ }
40
+ })
41
+ .catch((err) => {
42
+ console.error(err);
43
+ if (mounted) setIsLoading(false);
44
+ });
45
+ return () => {
46
+ mounted = false;
47
+ };
48
+ }, []);
49
+
50
+ async function handleCreate(e: { preventDefault: () => void }) {
51
+ e.preventDefault();
52
+ if (!name || !email) return;
53
+ try {
54
+ await createUser({ name, email });
55
+ setName("");
56
+ setEmail("");
57
+ const data = await getUsers();
58
+ setUsers(data);
59
+ } catch (err) {
60
+ console.error(err);
61
+ }
62
+ }
63
+
64
+ if (isLoading) return <p>Loading users from server…</p>;
65
+
66
+ return (
67
+ <div>
68
+ <h2>Users (fetched via direct server function call)</h2>
69
+ <ul>
70
+ {users.map((u) => (
71
+ <li key={u.id}>
72
+ {u.name} — {u.email}
73
+ </li>
74
+ ))}
75
+ </ul>
76
+
77
+ <h3>Add User</h3>
78
+ <form onSubmit={handleCreate} style={{ display: "flex", gap: "0.5rem" }}>
79
+ <input
80
+ placeholder="Name"
81
+ value={name}
82
+ onChange={(e) => setName(e.target.value)}
83
+ />
84
+ <input
85
+ placeholder="Email"
86
+ value={email}
87
+ onChange={(e) => setEmail(e.target.value)}
88
+ />
89
+ <button type="submit">Create</button>
90
+ </form>
91
+ </div>
92
+ );
93
+ }
94
+
95
+ const usersRoute = createRoute({
96
+ getParentRoute: () => rootRoute,
97
+ path: "/",
98
+ component: UsersPage,
99
+ });
100
+
101
+ // ── Route Tree ──
102
+
103
+ export const routeTree = rootRoute.addChildren([usersRoute]);
@@ -0,0 +1,16 @@
1
+ {
2
+ "include": ["src"],
3
+ "compilerOptions": {
4
+ "target": "ESNext",
5
+ "jsx": "react-jsx",
6
+ "module": "ESNext",
7
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
8
+ "moduleResolution": "Bundler",
9
+ "outDir": "./dist",
10
+ "rootDir": "./src",
11
+ "skipLibCheck": true,
12
+ "strict": true,
13
+ "noEmit": true,
14
+ "verbatimModuleSyntax": true
15
+ }
16
+ }
@@ -0,0 +1,27 @@
1
+ # complex-routing
2
+
3
+ Advanced routing patterns with TanStack Router.
4
+
5
+ ## Run
6
+
7
+ ```bash
8
+ npm run dev -w example-complex-routing
9
+ ```
10
+
11
+ ## Key Files
12
+
13
+ | File | Purpose |
14
+ |------|---------|
15
+ | `src/main.tsx` | Route tree assembly |
16
+ | `src/pages/__root.tsx` | Root layout with navigation |
17
+ | `src/pages/home.tsx` | Index route |
18
+ | `src/pages/posts/` | Nested routes with loader |
19
+
20
+ ## What It Demonstrates
21
+
22
+ - Dynamic route params (`$postId`)
23
+ - Pathless layout routes
24
+ - Route loaders with `queryClient.ensureQueryData`
25
+ - Search params with `validateSearch`
26
+ - Catch-all 404 route
27
+ - Type-safe `route.useParams()`
@@ -0,0 +1,11 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>evjs — Complex Routing</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ </body>
11
+ </html>
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "example-complex-routing",
3
+ "version": "0.0.1-rc.27",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "ev dev",
7
+ "build": "ev build",
8
+ "check-types": "tsc --noEmit"
9
+ },
10
+ "dependencies": {
11
+ "react": "^19.2.4",
12
+ "react-dom": "^19.2.4"
13
+ },
14
+ "devDependencies": {
15
+ "@evjs/cli": "*",
16
+ "@evjs/client": "*",
17
+ "@evjs/server": "*",
18
+ "@types/react": "^19.0.8",
19
+ "@types/react-dom": "^19.0.3",
20
+ "typescript": "^5.7.3"
21
+ }
22
+ }