mirror of
https://github.com/coollabsio/coolify-examples.git
synced 2026-02-19 13:58:56 +00:00
new examples
This commit is contained in:
11
node/tanstack-start/static/.dockerignore
Normal file
11
node/tanstack-start/static/.dockerignore
Normal file
@@ -0,0 +1,11 @@
|
||||
node_modules/
|
||||
.git/
|
||||
.gitignore
|
||||
.env
|
||||
.env.local
|
||||
*.md
|
||||
.DS_Store
|
||||
*.log
|
||||
npm-debug.log*
|
||||
.vinxi/
|
||||
.output/
|
||||
3
node/tanstack-start/static/.gitignore
vendored
Normal file
3
node/tanstack-start/static/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules/
|
||||
.vinxi/
|
||||
.output/
|
||||
7
node/tanstack-start/static/app.config.ts
Normal file
7
node/tanstack-start/static/app.config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { defineConfig } from '@tanstack/start/config';
|
||||
|
||||
export default defineConfig({
|
||||
server: {
|
||||
preset: 'static',
|
||||
},
|
||||
});
|
||||
14
node/tanstack-start/static/app/router.tsx
Normal file
14
node/tanstack-start/static/app/router.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import { createRouter as createTanStackRouter } from '@tanstack/react-router';
|
||||
import { routeTree } from './routeTree.gen';
|
||||
|
||||
export function createRouter() {
|
||||
return createTanStackRouter({
|
||||
routeTree,
|
||||
});
|
||||
}
|
||||
|
||||
declare module '@tanstack/react-router' {
|
||||
interface Register {
|
||||
router: ReturnType<typeof createRouter>;
|
||||
}
|
||||
}
|
||||
16
node/tanstack-start/static/app/routes/__root.tsx
Normal file
16
node/tanstack-start/static/app/routes/__root.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { createRootRoute, Outlet } from '@tanstack/react-router';
|
||||
|
||||
export const Route = createRootRoute({
|
||||
component: () => (
|
||||
<html>
|
||||
<head>
|
||||
<meta charSet="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>TanStack Start</title>
|
||||
</head>
|
||||
<body>
|
||||
<Outlet />
|
||||
</body>
|
||||
</html>
|
||||
),
|
||||
});
|
||||
30
node/tanstack-start/static/app/routes/index.tsx
Normal file
30
node/tanstack-start/static/app/routes/index.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export const Route = createFileRoute('/')({
|
||||
component: Home,
|
||||
});
|
||||
|
||||
function Home() {
|
||||
// Build-time public var (baked into bundle)
|
||||
const buildPublicVar = import.meta.env.VITE_BUILD_PUBLIC_VAR || 'default-value';
|
||||
|
||||
useEffect(() => {
|
||||
console.log('=== Build-time Variables ===');
|
||||
console.log('VITE_BUILD_PUBLIC_VAR:', buildPublicVar);
|
||||
}, [buildPublicVar]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div style={{ padding: '20px', background: '#f0f0f0', margin: '20px', borderRadius: '8px' }}>
|
||||
<h2>Environment Variable Test</h2>
|
||||
<h3>Build-time (baked into bundle)</h3>
|
||||
<p><strong>VITE_BUILD_PUBLIC_VAR:</strong> {buildPublicVar}</p>
|
||||
<p style={{ color: '#666', fontSize: '14px' }}>
|
||||
Note: Static sites only support build-time env vars (no server at runtime)
|
||||
</p>
|
||||
</div>
|
||||
<h1>Hello from TanStack Start!</h1>
|
||||
</>
|
||||
);
|
||||
}
|
||||
21
node/tanstack-start/static/package.json
Normal file
21
node/tanstack-start/static/package.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "static",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vinxi dev",
|
||||
"build": "vinxi build",
|
||||
"start": "npx serve@latest .output/public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tanstack/react-router": "^1.93.0",
|
||||
"@tanstack/start": "^1.93.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"vinxi": "^0.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react-dom": "^19.0.0",
|
||||
"typescript": "^5.7.2"
|
||||
}
|
||||
}
|
||||
13
node/tanstack-start/static/tsconfig.json
Normal file
13
node/tanstack-start/static/tsconfig.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"esModuleInterop": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"jsx": "react-jsx",
|
||||
"noEmit": true
|
||||
},
|
||||
"include": ["app/**/*", "app.config.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user