create-velox-app 0.4.3 → 0.4.5
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/cli.js +0 -0
- package/dist/index.js +21 -14
- package/dist/index.js.map +1 -1
- package/dist/templates/auth.d.ts +6 -3
- package/dist/templates/auth.d.ts.map +1 -1
- package/dist/templates/auth.js +56 -1112
- package/dist/templates/auth.js.map +1 -1
- package/dist/templates/compiler.d.ts +68 -0
- package/dist/templates/compiler.d.ts.map +1 -0
- package/dist/templates/compiler.js +149 -0
- package/dist/templates/compiler.js.map +1 -0
- package/dist/templates/default.d.ts +5 -2
- package/dist/templates/default.d.ts.map +1 -1
- package/dist/templates/default.js +51 -509
- package/dist/templates/default.js.map +1 -1
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +19 -10
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/placeholders.d.ts +70 -0
- package/dist/templates/placeholders.d.ts.map +1 -0
- package/dist/templates/placeholders.js +145 -0
- package/dist/templates/placeholders.js.map +1 -0
- package/dist/templates/shared/index.d.ts +9 -0
- package/dist/templates/shared/index.d.ts.map +1 -0
- package/dist/templates/shared/index.js +9 -0
- package/dist/templates/shared/index.js.map +1 -0
- package/dist/templates/shared/root.d.ts +14 -0
- package/dist/templates/shared/root.d.ts.map +1 -0
- package/dist/templates/shared/root.js +43 -0
- package/dist/templates/shared/root.js.map +1 -0
- package/dist/templates/shared/web-base.d.ts +18 -0
- package/dist/templates/shared/web-base.d.ts.map +1 -0
- package/dist/templates/shared/web-base.js +63 -0
- package/dist/templates/shared/web-base.js.map +1 -0
- package/dist/templates/shared/web-styles.d.ts +10 -0
- package/dist/templates/shared/web-styles.d.ts.map +1 -0
- package/dist/templates/shared/web-styles.js +26 -0
- package/dist/templates/shared/web-styles.js.map +1 -0
- package/dist/templates/shared.d.ts +2 -13
- package/dist/templates/shared.d.ts.map +1 -1
- package/dist/templates/shared.js +2 -289
- package/dist/templates/shared.js.map +1 -1
- package/dist/templates/source/api/config/app.d.ts +13 -0
- package/dist/templates/source/api/config/app.d.ts.map +1 -0
- package/dist/templates/source/api/config/app.js +14 -0
- package/dist/templates/source/api/config/app.js.map +1 -0
- package/dist/templates/source/api/config/auth.d.ts +34 -0
- package/dist/templates/source/api/config/auth.d.ts.map +1 -0
- package/dist/templates/source/api/config/auth.js +165 -0
- package/dist/templates/source/api/config/auth.js.map +1 -0
- package/dist/templates/source/api/config/index.auth.d.ts +6 -0
- package/dist/templates/source/api/config/index.auth.d.ts.map +1 -0
- package/dist/templates/source/api/config/index.auth.js +6 -0
- package/dist/templates/source/api/config/index.auth.js.map +1 -0
- package/dist/templates/source/api/config/index.default.d.ts +5 -0
- package/dist/templates/source/api/config/index.default.d.ts.map +1 -0
- package/dist/templates/source/api/config/index.default.js +5 -0
- package/dist/templates/source/api/config/index.default.js.map +1 -0
- package/dist/templates/source/api/database/index.d.ts +9 -0
- package/dist/templates/source/api/database/index.d.ts.map +1 -0
- package/dist/templates/source/api/database/index.js +18 -0
- package/dist/templates/source/api/database/index.js.map +1 -0
- package/dist/templates/source/api/index.auth.d.ts +5 -0
- package/dist/templates/source/api/index.auth.d.ts.map +1 -0
- package/dist/templates/source/api/index.auth.js +59 -0
- package/dist/templates/source/api/index.auth.js.map +1 -0
- package/dist/templates/source/api/index.default.d.ts +5 -0
- package/dist/templates/source/api/index.default.d.ts.map +1 -0
- package/dist/templates/source/api/index.default.js +56 -0
- package/dist/templates/source/api/index.default.js.map +1 -0
- package/dist/templates/source/api/prisma.config.d.ts +9 -0
- package/dist/templates/source/api/prisma.config.d.ts.map +1 -0
- package/dist/templates/source/api/prisma.config.js +15 -0
- package/dist/templates/source/api/prisma.config.js.map +1 -0
- package/dist/templates/source/api/procedures/auth.d.ts +14 -0
- package/dist/templates/source/api/procedures/auth.d.ts.map +1 -0
- package/dist/templates/source/api/procedures/auth.js +221 -0
- package/dist/templates/source/api/procedures/auth.js.map +1 -0
- package/dist/templates/source/api/procedures/health.d.ts +5 -0
- package/dist/templates/source/api/procedures/health.d.ts.map +1 -0
- package/dist/templates/source/api/procedures/health.js +21 -0
- package/dist/templates/source/api/procedures/health.js.map +1 -0
- package/dist/templates/source/api/procedures/index.auth.d.ts +7 -0
- package/dist/templates/source/api/procedures/index.auth.d.ts.map +1 -0
- package/dist/templates/source/api/procedures/index.auth.js +7 -0
- package/dist/templates/source/api/procedures/index.auth.js.map +1 -0
- package/dist/templates/source/api/procedures/index.default.d.ts +6 -0
- package/dist/templates/source/api/procedures/index.default.d.ts.map +1 -0
- package/dist/templates/source/api/procedures/index.default.js +6 -0
- package/dist/templates/source/api/procedures/index.default.js.map +1 -0
- package/dist/templates/source/api/procedures/users.auth.d.ts +7 -0
- package/dist/templates/source/api/procedures/users.auth.d.ts.map +1 -0
- package/dist/templates/source/api/procedures/users.auth.js +111 -0
- package/dist/templates/source/api/procedures/users.auth.js.map +1 -0
- package/dist/templates/source/api/procedures/users.default.d.ts +5 -0
- package/dist/templates/source/api/procedures/users.default.d.ts.map +1 -0
- package/dist/templates/source/api/procedures/users.default.js +86 -0
- package/dist/templates/source/api/procedures/users.default.js.map +1 -0
- package/dist/templates/source/api/schemas/index.d.ts +5 -0
- package/dist/templates/source/api/schemas/index.d.ts.map +1 -0
- package/dist/templates/source/api/schemas/index.js +5 -0
- package/dist/templates/source/api/schemas/index.js.map +1 -0
- package/dist/templates/source/api/schemas/user.d.ts +11 -0
- package/dist/templates/source/api/schemas/user.d.ts.map +1 -0
- package/dist/templates/source/api/schemas/user.js +20 -0
- package/dist/templates/source/api/schemas/user.js.map +1 -0
- package/dist/templates/source/api/tsup.config.d.ts +3 -0
- package/dist/templates/source/api/tsup.config.d.ts.map +1 -0
- package/dist/templates/source/api/tsup.config.js +10 -0
- package/dist/templates/source/api/tsup.config.js.map +1 -0
- package/dist/templates/source/web/main.d.ts +9 -0
- package/dist/templates/source/web/main.d.ts.map +1 -0
- package/dist/templates/source/web/main.js +27 -0
- package/dist/templates/source/web/main.js.map +1 -0
- package/dist/templates/source/web/routes/__root.d.ts +2 -0
- package/dist/templates/source/web/routes/__root.d.ts.map +1 -0
- package/dist/templates/source/web/routes/__root.js +28 -0
- package/dist/templates/source/web/routes/__root.js.map +1 -0
- package/dist/templates/source/web/routes/about.d.ts +2 -0
- package/dist/templates/source/web/routes/about.d.ts.map +1 -0
- package/dist/templates/source/web/routes/about.js +33 -0
- package/dist/templates/source/web/routes/about.js.map +1 -0
- package/dist/templates/source/web/routes/index.auth.d.ts +2 -0
- package/dist/templates/source/web/routes/index.auth.d.ts.map +1 -0
- package/dist/templates/source/web/routes/index.auth.js +159 -0
- package/dist/templates/source/web/routes/index.auth.js.map +1 -0
- package/dist/templates/source/web/routes/index.default.d.ts +2 -0
- package/dist/templates/source/web/routes/index.default.d.ts.map +1 -0
- package/dist/templates/source/web/routes/index.default.js +60 -0
- package/dist/templates/source/web/routes/index.default.js.map +1 -0
- package/dist/templates/source/web/vite.config.d.ts +3 -0
- package/dist/templates/source/web/vite.config.d.ts.map +1 -0
- package/dist/templates/source/web/vite.config.js +22 -0
- package/dist/templates/source/web/vite.config.js.map +1 -0
- package/package.json +11 -9
- package/src/templates/source/api/config/app.ts +13 -0
- package/src/templates/source/api/config/auth.ts +202 -0
- package/src/templates/source/api/config/database.ts +22 -0
- package/src/templates/source/api/env.auth +22 -0
- package/src/templates/source/api/env.default +13 -0
- package/src/templates/source/api/index.auth.ts +30 -0
- package/src/templates/source/api/index.default.ts +27 -0
- package/src/templates/source/api/package.auth.json +40 -0
- package/src/templates/source/api/package.default.json +38 -0
- package/src/templates/source/api/prisma/schema.auth.prisma +30 -0
- package/src/templates/source/api/prisma/schema.default.prisma +28 -0
- package/src/templates/source/api/prisma.config.ts +15 -0
- package/src/templates/source/api/procedures/auth.ts +285 -0
- package/src/templates/source/api/procedures/health.ts +24 -0
- package/src/templates/source/api/procedures/users.auth.ts +170 -0
- package/src/templates/source/api/procedures/users.default.ts +119 -0
- package/src/templates/source/api/schemas/user.ts +29 -0
- package/src/templates/source/api/tsconfig.json +12 -0
- package/src/templates/source/api/tsup.config.ts +10 -0
- package/src/templates/source/root/CLAUDE.auth.md +148 -0
- package/src/templates/source/root/CLAUDE.default.md +128 -0
- package/src/templates/source/root/README.md +72 -0
- package/src/templates/source/root/gitignore +37 -0
- package/src/templates/source/root/package.json +17 -0
- package/src/templates/source/root/pnpm-workspace.yaml +2 -0
- package/src/templates/source/root/tsconfig.json +19 -0
- package/src/templates/source/web/App.module.css +282 -0
- package/src/templates/source/web/favicon.svg +12 -0
- package/src/templates/source/web/index.html +13 -0
- package/src/templates/source/web/main.tsx +38 -0
- package/src/templates/source/web/package.json +26 -0
- package/src/templates/source/web/routes/__root.tsx +31 -0
- package/src/templates/source/web/routes/about.tsx +36 -0
- package/src/templates/source/web/routes/index.auth.tsx +230 -0
- package/src/templates/source/web/routes/index.default.tsx +79 -0
- package/src/templates/source/web/styles/global.css +90 -0
- package/src/templates/source/web/tsconfig.json +24 -0
- package/src/templates/source/web/vite.config.ts +22 -0
- package/LICENSE +0 -21
|
@@ -0,0 +1,13 @@
|
|
|
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>__PROJECT_NAME__</title>
|
|
7
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { StrictMode } from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import { RouterProvider, createRouter } from '@tanstack/react-router';
|
|
4
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
5
|
+
import { routeTree } from './routeTree.gen';
|
|
6
|
+
import './styles/global.css';
|
|
7
|
+
|
|
8
|
+
// Create query client for data fetching
|
|
9
|
+
const queryClient = new QueryClient({
|
|
10
|
+
defaultOptions: {
|
|
11
|
+
queries: {
|
|
12
|
+
staleTime: 1000 * 60, // 1 minute
|
|
13
|
+
retry: 1,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// Create router with route tree
|
|
19
|
+
const router = createRouter({ routeTree });
|
|
20
|
+
|
|
21
|
+
// Type-safe router registration
|
|
22
|
+
declare module '@tanstack/react-router' {
|
|
23
|
+
interface Register {
|
|
24
|
+
router: typeof router;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Render application
|
|
29
|
+
const rootElement = document.getElementById('root');
|
|
30
|
+
if (!rootElement) throw new Error('Root element not found');
|
|
31
|
+
|
|
32
|
+
createRoot(rootElement).render(
|
|
33
|
+
<StrictMode>
|
|
34
|
+
<QueryClientProvider client={queryClient}>
|
|
35
|
+
<RouterProvider router={router} />
|
|
36
|
+
</QueryClientProvider>
|
|
37
|
+
</StrictMode>
|
|
38
|
+
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "web",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "tsc -b && vite build",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"type-check": "tsc --noEmit"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"react": "19.1.0",
|
|
14
|
+
"react-dom": "19.1.0",
|
|
15
|
+
"@tanstack/react-router": "1.140.0",
|
|
16
|
+
"@tanstack/react-query": "5.90.12"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/react": "19.1.6",
|
|
20
|
+
"@types/react-dom": "19.1.5",
|
|
21
|
+
"@vitejs/plugin-react": "5.1.2",
|
|
22
|
+
"@tanstack/router-plugin": "1.140.0",
|
|
23
|
+
"vite": "6.4.1",
|
|
24
|
+
"typescript": "5.9.3"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createRootRoute, Outlet, Link } from '@tanstack/react-router';
|
|
2
|
+
import styles from '@/App.module.css';
|
|
3
|
+
|
|
4
|
+
export const Route = createRootRoute({
|
|
5
|
+
component: RootLayout,
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
function RootLayout() {
|
|
9
|
+
return (
|
|
10
|
+
<div className={styles.app}>
|
|
11
|
+
<nav className={styles.nav}>
|
|
12
|
+
<div className={styles.navBrand}>
|
|
13
|
+
<Link to="/" className={styles.logo}>
|
|
14
|
+
Velox TS
|
|
15
|
+
</Link>
|
|
16
|
+
</div>
|
|
17
|
+
<div className={styles.navLinks}>
|
|
18
|
+
<Link to="/" className={styles.navLink} activeProps={{ className: styles.navLinkActive }}>
|
|
19
|
+
Home
|
|
20
|
+
</Link>
|
|
21
|
+
<Link to="/about" className={styles.navLink} activeProps={{ className: styles.navLinkActive }}>
|
|
22
|
+
About
|
|
23
|
+
</Link>
|
|
24
|
+
</div>
|
|
25
|
+
</nav>
|
|
26
|
+
<main className={styles.main}>
|
|
27
|
+
<Outlet />
|
|
28
|
+
</main>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createFileRoute } from '@tanstack/react-router';
|
|
2
|
+
import styles from '@/App.module.css';
|
|
3
|
+
|
|
4
|
+
export const Route = createFileRoute('/about')({
|
|
5
|
+
component: AboutPage,
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
function AboutPage() {
|
|
9
|
+
return (
|
|
10
|
+
<div className={styles.container}>
|
|
11
|
+
<div className={styles.hero}>
|
|
12
|
+
<h1 className={styles.title}>About VeloxTS</h1>
|
|
13
|
+
<p className={styles.subtitle}>
|
|
14
|
+
An elegant TypeScript framework for full-stack development.
|
|
15
|
+
</p>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div className={styles.cards}>
|
|
19
|
+
<div className={styles.card}>
|
|
20
|
+
<h2>Type Safety</h2>
|
|
21
|
+
<p>End-to-end type safety without code generation. Types flow from backend to frontend automatically.</p>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div className={styles.card}>
|
|
25
|
+
<h2>Developer Experience</h2>
|
|
26
|
+
<p>Convention over configuration. Sensible defaults with escape hatches when you need them.</p>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div className={styles.card}>
|
|
30
|
+
<h2>Modern Stack</h2>
|
|
31
|
+
<p>Built on Fastify, tRPC, Prisma, React, and TanStack Router.</p>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { createFileRoute } from '@tanstack/react-router';
|
|
2
|
+
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import styles from '@/App.module.css';
|
|
5
|
+
|
|
6
|
+
// API helpers
|
|
7
|
+
const api = {
|
|
8
|
+
get: async <T,>(path: string): Promise<T> => {
|
|
9
|
+
const token = localStorage.getItem('accessToken');
|
|
10
|
+
const res = await fetch(`/api${path}`, {
|
|
11
|
+
headers: token ? { Authorization: `Bearer ${token}` } : {},
|
|
12
|
+
});
|
|
13
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
14
|
+
return res.json();
|
|
15
|
+
},
|
|
16
|
+
post: async <T,>(path: string, data: unknown): Promise<T> => {
|
|
17
|
+
const token = localStorage.getItem('accessToken');
|
|
18
|
+
const res = await fetch(`/api${path}`, {
|
|
19
|
+
method: 'POST',
|
|
20
|
+
headers: {
|
|
21
|
+
'Content-Type': 'application/json',
|
|
22
|
+
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
|
23
|
+
},
|
|
24
|
+
body: JSON.stringify(data),
|
|
25
|
+
});
|
|
26
|
+
if (!res.ok) {
|
|
27
|
+
const error = await res.json().catch(() => ({}));
|
|
28
|
+
throw new Error(error.message || `HTTP ${res.status}`);
|
|
29
|
+
}
|
|
30
|
+
return res.json();
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
interface User {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
email: string;
|
|
38
|
+
roles?: string[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface AuthResponse {
|
|
42
|
+
user: User;
|
|
43
|
+
accessToken: string;
|
|
44
|
+
refreshToken: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const Route = createFileRoute('/')({
|
|
48
|
+
component: HomePage,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
function HomePage() {
|
|
52
|
+
const queryClient = useQueryClient();
|
|
53
|
+
const [isLogin, setIsLogin] = useState(true);
|
|
54
|
+
const [email, setEmail] = useState('');
|
|
55
|
+
const [password, setPassword] = useState('');
|
|
56
|
+
const [name, setName] = useState('');
|
|
57
|
+
const [error, setError] = useState('');
|
|
58
|
+
|
|
59
|
+
// Check if user is logged in
|
|
60
|
+
const { data: user, isLoading } = useQuery({
|
|
61
|
+
queryKey: ['me'],
|
|
62
|
+
queryFn: () => api.get<User>('/auth/me'),
|
|
63
|
+
retry: false,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const login = useMutation({
|
|
67
|
+
mutationFn: (data: { email: string; password: string }) =>
|
|
68
|
+
api.post<AuthResponse>('/auth/login', data),
|
|
69
|
+
onSuccess: (data) => {
|
|
70
|
+
localStorage.setItem('accessToken', data.accessToken);
|
|
71
|
+
localStorage.setItem('refreshToken', data.refreshToken);
|
|
72
|
+
queryClient.invalidateQueries({ queryKey: ['me'] });
|
|
73
|
+
setError('');
|
|
74
|
+
},
|
|
75
|
+
onError: (err) => {
|
|
76
|
+
setError(err instanceof Error ? err.message : 'Login failed');
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const register = useMutation({
|
|
81
|
+
mutationFn: (data: { name: string; email: string; password: string }) =>
|
|
82
|
+
api.post<AuthResponse>('/auth/register', data),
|
|
83
|
+
onSuccess: (data) => {
|
|
84
|
+
localStorage.setItem('accessToken', data.accessToken);
|
|
85
|
+
localStorage.setItem('refreshToken', data.refreshToken);
|
|
86
|
+
queryClient.invalidateQueries({ queryKey: ['me'] });
|
|
87
|
+
setError('');
|
|
88
|
+
},
|
|
89
|
+
onError: (err) => {
|
|
90
|
+
setError(err instanceof Error ? err.message : 'Registration failed');
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const logout = useMutation({
|
|
95
|
+
mutationFn: () => api.post('/auth/logout', {}),
|
|
96
|
+
onSuccess: () => {
|
|
97
|
+
localStorage.removeItem('accessToken');
|
|
98
|
+
localStorage.removeItem('refreshToken');
|
|
99
|
+
queryClient.setQueryData(['me'], null);
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const handleSubmit = (e: React.FormEvent) => {
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
setError('');
|
|
106
|
+
|
|
107
|
+
if (isLogin) {
|
|
108
|
+
login.mutate({ email, password });
|
|
109
|
+
} else {
|
|
110
|
+
register.mutate({ name, email, password });
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
if (isLoading) {
|
|
115
|
+
return (
|
|
116
|
+
<div className={styles.container}>
|
|
117
|
+
<p className={styles.loading}>Loading...</p>
|
|
118
|
+
</div>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Logged in view
|
|
123
|
+
if (user) {
|
|
124
|
+
return (
|
|
125
|
+
<div className={styles.container}>
|
|
126
|
+
<div className={styles.hero}>
|
|
127
|
+
<h1 className={styles.title}>Welcome, {user.name}!</h1>
|
|
128
|
+
<p className={styles.subtitle}>{user.email}</p>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<div className={styles.cards}>
|
|
132
|
+
<div className={styles.card}>
|
|
133
|
+
<h2>Your Profile</h2>
|
|
134
|
+
<p><strong>ID:</strong> {user.id}</p>
|
|
135
|
+
<p><strong>Roles:</strong> {user.roles?.join(', ') || 'user'}</p>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
<div className={styles.card}>
|
|
139
|
+
<h2>Actions</h2>
|
|
140
|
+
<button
|
|
141
|
+
onClick={() => logout.mutate()}
|
|
142
|
+
className={styles.button}
|
|
143
|
+
disabled={logout.isPending}
|
|
144
|
+
>
|
|
145
|
+
{logout.isPending ? 'Logging out...' : 'Logout'}
|
|
146
|
+
</button>
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Login/Register form
|
|
154
|
+
return (
|
|
155
|
+
<div className={styles.container}>
|
|
156
|
+
<div className={styles.hero}>
|
|
157
|
+
<h1 className={styles.title}>Welcome to VeloxTS</h1>
|
|
158
|
+
<p className={styles.subtitle}>
|
|
159
|
+
Full-stack TypeScript with authentication.
|
|
160
|
+
</p>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<div className={styles.authCard}>
|
|
164
|
+
<div className={styles.authTabs}>
|
|
165
|
+
<button
|
|
166
|
+
className={`${styles.authTab} ${isLogin ? styles.authTabActive : ''}`}
|
|
167
|
+
onClick={() => setIsLogin(true)}
|
|
168
|
+
>
|
|
169
|
+
Login
|
|
170
|
+
</button>
|
|
171
|
+
<button
|
|
172
|
+
className={`${styles.authTab} ${!isLogin ? styles.authTabActive : ''}`}
|
|
173
|
+
onClick={() => setIsLogin(false)}
|
|
174
|
+
>
|
|
175
|
+
Register
|
|
176
|
+
</button>
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
<form onSubmit={handleSubmit} className={styles.form}>
|
|
180
|
+
{!isLogin && (
|
|
181
|
+
<input
|
|
182
|
+
type="text"
|
|
183
|
+
placeholder="Name"
|
|
184
|
+
value={name}
|
|
185
|
+
onChange={(e) => setName(e.target.value)}
|
|
186
|
+
className={styles.input}
|
|
187
|
+
required
|
|
188
|
+
minLength={2}
|
|
189
|
+
/>
|
|
190
|
+
)}
|
|
191
|
+
<input
|
|
192
|
+
type="email"
|
|
193
|
+
placeholder="Email"
|
|
194
|
+
value={email}
|
|
195
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
196
|
+
className={styles.input}
|
|
197
|
+
required
|
|
198
|
+
/>
|
|
199
|
+
<input
|
|
200
|
+
type="password"
|
|
201
|
+
placeholder="Password"
|
|
202
|
+
value={password}
|
|
203
|
+
onChange={(e) => setPassword(e.target.value)}
|
|
204
|
+
className={styles.input}
|
|
205
|
+
required
|
|
206
|
+
minLength={isLogin ? 1 : 12}
|
|
207
|
+
/>
|
|
208
|
+
|
|
209
|
+
{error && <p className={styles.formError}>{error}</p>}
|
|
210
|
+
|
|
211
|
+
<button
|
|
212
|
+
type="submit"
|
|
213
|
+
className={styles.button}
|
|
214
|
+
disabled={login.isPending || register.isPending}
|
|
215
|
+
>
|
|
216
|
+
{login.isPending || register.isPending
|
|
217
|
+
? 'Please wait...'
|
|
218
|
+
: isLogin ? 'Sign In' : 'Create Account'}
|
|
219
|
+
</button>
|
|
220
|
+
</form>
|
|
221
|
+
|
|
222
|
+
{!isLogin && (
|
|
223
|
+
<p className={styles.formHint}>
|
|
224
|
+
Password: 12+ chars, uppercase, lowercase, number
|
|
225
|
+
</p>
|
|
226
|
+
)}
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { createFileRoute } from '@tanstack/react-router';
|
|
2
|
+
import { useQuery } from '@tanstack/react-query';
|
|
3
|
+
import styles from '@/App.module.css';
|
|
4
|
+
|
|
5
|
+
// API helper
|
|
6
|
+
const api = {
|
|
7
|
+
get: async <T,>(path: string): Promise<T> => {
|
|
8
|
+
const res = await fetch(`/api${path}`);
|
|
9
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
10
|
+
return res.json();
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const Route = createFileRoute('/')({
|
|
15
|
+
component: HomePage,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
interface HealthResponse {
|
|
19
|
+
status: string;
|
|
20
|
+
version: string;
|
|
21
|
+
timestamp: string;
|
|
22
|
+
uptime: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function HomePage() {
|
|
26
|
+
const { data: health, isLoading, error } = useQuery({
|
|
27
|
+
queryKey: ['health'],
|
|
28
|
+
queryFn: () => api.get<HealthResponse>('/health'),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div className={styles.container}>
|
|
33
|
+
<div className={styles.hero}>
|
|
34
|
+
<h1 className={styles.title}>Welcome to VeloxTS</h1>
|
|
35
|
+
<p className={styles.subtitle}>
|
|
36
|
+
Full-stack TypeScript, beautifully simple.
|
|
37
|
+
</p>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div className={styles.cards}>
|
|
41
|
+
<div className={styles.card}>
|
|
42
|
+
<h2>API Status</h2>
|
|
43
|
+
{isLoading ? (
|
|
44
|
+
<p className={styles.loading}>Checking...</p>
|
|
45
|
+
) : error ? (
|
|
46
|
+
<p className={styles.error}>Disconnected</p>
|
|
47
|
+
) : (
|
|
48
|
+
<p className={styles.success}>
|
|
49
|
+
{health?.status === 'ok' ? 'Connected' : 'Unknown'}
|
|
50
|
+
</p>
|
|
51
|
+
)}
|
|
52
|
+
{health && (
|
|
53
|
+
<p className={styles.meta}>v{health.version}</p>
|
|
54
|
+
)}
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div className={styles.card}>
|
|
58
|
+
<h2>Get Started</h2>
|
|
59
|
+
<p>Edit <code>apps/api/src/procedures</code> to add API endpoints.</p>
|
|
60
|
+
<p>Edit <code>apps/web/src/routes</code> to add pages.</p>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<div className={styles.card}>
|
|
64
|
+
<h2>Documentation</h2>
|
|
65
|
+
<p>
|
|
66
|
+
<a href="https://veloxts.dev" target="_blank" rel="noopener noreferrer">
|
|
67
|
+
VeloxTS Docs
|
|
68
|
+
</a>
|
|
69
|
+
</p>
|
|
70
|
+
<p>
|
|
71
|
+
<a href="https://tanstack.com/router" target="_blank" rel="noopener noreferrer">
|
|
72
|
+
TanStack Router
|
|
73
|
+
</a>
|
|
74
|
+
</p>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/* Global Styles */
|
|
2
|
+
|
|
3
|
+
*,
|
|
4
|
+
*::before,
|
|
5
|
+
*::after {
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
margin: 0;
|
|
8
|
+
padding: 0;
|
|
9
|
+
font: inherit;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
html {
|
|
13
|
+
font-size: 16px;
|
|
14
|
+
-webkit-font-smoothing: antialiased;
|
|
15
|
+
-moz-osx-font-smoothing: grayscale;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
body {
|
|
19
|
+
background: #0a0a0a;
|
|
20
|
+
color: #ededed;
|
|
21
|
+
font-family:
|
|
22
|
+
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans",
|
|
23
|
+
"Helvetica Neue", sans-serif;
|
|
24
|
+
line-height: 1.6;
|
|
25
|
+
min-height: 100svh;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
h1,
|
|
29
|
+
h2,
|
|
30
|
+
h3,
|
|
31
|
+
h4,
|
|
32
|
+
h5,
|
|
33
|
+
h6 {
|
|
34
|
+
text-wrap: balance;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
p,
|
|
38
|
+
li,
|
|
39
|
+
figcaption {
|
|
40
|
+
text-wrap: pretty;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
img,
|
|
44
|
+
picture,
|
|
45
|
+
svg,
|
|
46
|
+
video,
|
|
47
|
+
canvas {
|
|
48
|
+
max-width: 100%;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
a {
|
|
52
|
+
color: #00d9ff;
|
|
53
|
+
text-decoration: none;
|
|
54
|
+
transition: opacity 0.2s;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
a:hover {
|
|
58
|
+
opacity: 0.8;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
code {
|
|
62
|
+
font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Monaco, "Courier New", monospace;
|
|
63
|
+
background: #1a1a1a;
|
|
64
|
+
padding: 0.2em 0.4em;
|
|
65
|
+
border-radius: 4px;
|
|
66
|
+
font-size: 0.9em;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
::selection {
|
|
70
|
+
background: #00d9ff;
|
|
71
|
+
color: #000;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
::-webkit-scrollbar {
|
|
75
|
+
width: 8px;
|
|
76
|
+
height: 8px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
::-webkit-scrollbar-track {
|
|
80
|
+
background: #111;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
::-webkit-scrollbar-thumb {
|
|
84
|
+
background: #333;
|
|
85
|
+
border-radius: 4px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
::-webkit-scrollbar-thumb:hover {
|
|
89
|
+
background: #444;
|
|
90
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"jsx": "react-jsx",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"allowSyntheticDefaultImports": true,
|
|
16
|
+
"forceConsistentCasingInFileNames": true,
|
|
17
|
+
"noUnusedLocals": true,
|
|
18
|
+
"noUnusedParameters": true,
|
|
19
|
+
"paths": {
|
|
20
|
+
"@/*": ["./src/*"]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"include": ["src"]
|
|
24
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import { tanstackRouter } from '@tanstack/router-plugin/vite';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [tanstackRouter(), react()],
|
|
8
|
+
resolve: {
|
|
9
|
+
alias: {
|
|
10
|
+
'@': path.resolve(__dirname, './src'),
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
server: {
|
|
14
|
+
port: __WEB_PORT__,
|
|
15
|
+
proxy: {
|
|
16
|
+
'/api': {
|
|
17
|
+
target: 'http://localhost:__API_PORT__',
|
|
18
|
+
changeOrigin: true,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 VeloxTS Framework Contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|