feat: scaffold apps/clients Cloudflare Worker app
This commit is contained in:
parent
bc28194d3d
commit
7b7b180f96
14 changed files with 1491 additions and 0 deletions
12
apps/clients/index.html
Normal file
12
apps/clients/index.html
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Xtablo — Client Portal</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="client-root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
50
apps/clients/package.json
Normal file
50
apps/clients/package.json
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
"name": "@xtablo/clients",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite dev --port 5175",
|
||||
"build": "tsc -b && vite build --mode production",
|
||||
"build:staging": "tsc -b && vite build --mode staging",
|
||||
"build:prod": "tsc -b && vite build --mode production",
|
||||
"deploy": "wrangler deploy",
|
||||
"typecheck": "tsc -b",
|
||||
"lint": "biome check .",
|
||||
"lint:fix": "biome check --write .",
|
||||
"format": "biome format --write .",
|
||||
"preview": "vite preview",
|
||||
"clean": "rm -rf dist .vite tsconfig.tsbuildinfo node_modules/.vite"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "2.2.5",
|
||||
"@cloudflare/vite-plugin": "^1.9.4",
|
||||
"@tailwindcss/vite": "^4.0.14",
|
||||
"@types/react": "19.0.10",
|
||||
"@types/react-dom": "19.0.4",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"tailwindcss": "^4.0.14",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"typescript": "^5.7.0",
|
||||
"vite": "^6.2.2",
|
||||
"vite-tsconfig-paths": "^5.1.4",
|
||||
"wrangler": "^4.24.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tanstack/react-query": "^5.69.0",
|
||||
"@xtablo/shared": "workspace:*",
|
||||
"@xtablo/shared-types": "workspace:*",
|
||||
"@xtablo/tablo-views": "workspace:*",
|
||||
"@xtablo/ui": "workspace:*",
|
||||
"@xtablo/chat-ui": "workspace:*",
|
||||
"i18next": "^25.6.0",
|
||||
"i18next-browser-languagedetector": "^8.2.0",
|
||||
"lucide-react": "^0.460.0",
|
||||
"react": "19.0.0",
|
||||
"react-dom": "19.0.0",
|
||||
"react-i18next": "^16.2.0",
|
||||
"react-router-dom": "^7.9.4",
|
||||
"tailwind-merge": "^3.0.2",
|
||||
"zustand": "^5.0.5"
|
||||
}
|
||||
}
|
||||
9
apps/clients/src/App.tsx
Normal file
9
apps/clients/src/App.tsx
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import AppRoutes from "./routes";
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<div className="min-h-screen bg-background">
|
||||
<AppRoutes />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
31
apps/clients/src/i18n.ts
Normal file
31
apps/clients/src/i18n.ts
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import i18n from "i18next";
|
||||
import LanguageDetector from "i18next-browser-languagedetector";
|
||||
import { initReactI18next } from "react-i18next";
|
||||
import bookingEn from "./locales/en/booking.json";
|
||||
// Import translation files
|
||||
import bookingFr from "./locales/fr/booking.json";
|
||||
|
||||
i18n
|
||||
.use(LanguageDetector)
|
||||
.use(initReactI18next)
|
||||
.init({
|
||||
resources: {
|
||||
fr: {
|
||||
booking: bookingFr,
|
||||
},
|
||||
en: {
|
||||
booking: bookingEn,
|
||||
},
|
||||
},
|
||||
fallbackLng: "fr",
|
||||
defaultNS: "booking",
|
||||
interpolation: {
|
||||
escapeValue: false,
|
||||
},
|
||||
detection: {
|
||||
order: ["localStorage", "navigator"],
|
||||
caches: ["localStorage"],
|
||||
},
|
||||
});
|
||||
|
||||
export default i18n;
|
||||
3
apps/clients/src/locales/en/booking.json
Normal file
3
apps/clients/src/locales/en/booking.json
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"welcome": "Welcome"
|
||||
}
|
||||
3
apps/clients/src/locales/fr/booking.json
Normal file
3
apps/clients/src/locales/fr/booking.json
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"welcome": "Bienvenue"
|
||||
}
|
||||
1266
apps/clients/src/main.css
Normal file
1266
apps/clients/src/main.css
Normal file
File diff suppressed because it is too large
Load diff
28
apps/clients/src/main.tsx
Normal file
28
apps/clients/src/main.tsx
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { QueryClientProvider } from "@tanstack/react-query";
|
||||
import { queryClient } from "@xtablo/shared";
|
||||
import { SessionProvider } from "@xtablo/shared/contexts/SessionContext";
|
||||
import { ThemeProvider } from "@xtablo/shared/contexts/ThemeContext";
|
||||
import { Toaster } from "@xtablo/ui/components/sonner";
|
||||
import { StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { BrowserRouter as Router } from "react-router-dom";
|
||||
import App from "./App";
|
||||
|
||||
import "@xtablo/ui/styles/globals.css";
|
||||
import "./main.css";
|
||||
import "./i18n";
|
||||
|
||||
createRoot(document.getElementById("client-root")!).render(
|
||||
<StrictMode>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<SessionProvider>
|
||||
<ThemeProvider>
|
||||
<Toaster />
|
||||
<Router>
|
||||
<App />
|
||||
</Router>
|
||||
</ThemeProvider>
|
||||
</SessionProvider>
|
||||
</QueryClientProvider>
|
||||
</StrictMode>
|
||||
);
|
||||
11
apps/clients/src/routes.tsx
Normal file
11
apps/clients/src/routes.tsx
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { Route, Routes } from "react-router-dom";
|
||||
|
||||
export default function AppRoutes() {
|
||||
return (
|
||||
<Routes>
|
||||
<Route path="/auth/callback" element={<div>Auth callback placeholder</div>} />
|
||||
<Route path="/tablo/:tabloId" element={<div>Tablo view placeholder</div>} />
|
||||
<Route path="/" element={<div>Client portal placeholder</div>} />
|
||||
</Routes>
|
||||
);
|
||||
}
|
||||
30
apps/clients/tsconfig.json
Normal file
30
apps/clients/tsconfig.json
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@xtablo/ui": ["../../packages/ui/src"],
|
||||
"@xtablo/ui/*": ["../../packages/ui/src/*"],
|
||||
"@xtablo/shared": ["../../packages/shared/src"],
|
||||
"@xtablo/shared/*": ["../../packages/shared/src/*"],
|
||||
"@xtablo/tablo-views": ["../../packages/tablo-views/src"],
|
||||
"@xtablo/tablo-views/*": ["../../packages/tablo-views/src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src"],
|
||||
"references": []
|
||||
}
|
||||
22
apps/clients/vite.config.ts
Normal file
22
apps/clients/vite.config.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { cloudflare } from "@cloudflare/vite-plugin";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { defineConfig, type PluginOption } from "vite";
|
||||
import tsconfigPaths from "vite-tsconfig-paths";
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
const plugins: PluginOption[] = [
|
||||
react(),
|
||||
tailwindcss(),
|
||||
tsconfigPaths(),
|
||||
];
|
||||
|
||||
if (mode !== "test" && process.env.VITEST !== "true") {
|
||||
plugins.push(cloudflare());
|
||||
}
|
||||
|
||||
return {
|
||||
plugins,
|
||||
server: { cors: false },
|
||||
};
|
||||
});
|
||||
9
apps/clients/worker/index.ts
Normal file
9
apps/clients/worker/index.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export default {
|
||||
fetch(request: Request) {
|
||||
const url = new URL(request.url);
|
||||
if (url.pathname.startsWith("/api/")) {
|
||||
return Response.json({ name: "Cloudflare" });
|
||||
}
|
||||
return new Response(null, { status: 404 });
|
||||
},
|
||||
};
|
||||
16
apps/clients/wrangler.toml
Normal file
16
apps/clients/wrangler.toml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
name = "xtablo-clients"
|
||||
main = "worker/index.ts"
|
||||
compatibility_date = "2025-07-09"
|
||||
|
||||
[assets]
|
||||
directory = "./dist/"
|
||||
not_found_handling = "single-page-application"
|
||||
|
||||
[observability]
|
||||
enabled = true
|
||||
|
||||
[env.staging]
|
||||
route = { pattern = "clients-staging.xtablo.com", custom_domain = true }
|
||||
|
||||
[env.production]
|
||||
route = { pattern = "clients.xtablo.com", custom_domain = true }
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
"dev": "turbo dev",
|
||||
"dev:main": "turbo dev --filter=@xtablo/main",
|
||||
"dev:external": "turbo dev --filter=@xtablo/external",
|
||||
"dev:clients": "turbo dev --filter=@xtablo/clients",
|
||||
"dev:api": "turbo dev --filter=@xtablo/api",
|
||||
"deploy:main:staging": "turbo deploy:staging --filter=@xtablo/main",
|
||||
"deploy:main:prod": "turbo deploy:prod --filter=@xtablo/main",
|
||||
|
|
|
|||
Loading…
Reference in a new issue