feat: initial SchwarmbLog monorepo setup

- React + Vite + TanStack Router/Query frontend
- Hono + Prisma + MySQL backend
- Prisma schema mit allen Entitäten
- Docker + docker-compose Setup
- Tailwind mit Salm/Ozean Farbpalette
This commit is contained in:
Sebastian
2026-03-29 15:19:47 +00:00
commit ab76f207ae
28 changed files with 768 additions and 0 deletions

21
apps/web/Dockerfile Normal file
View File

@@ -0,0 +1,21 @@
FROM node:20-alpine AS base
RUN corepack enable pnpm
FROM base AS deps
WORKDIR /app
COPY package.json pnpm-workspace.yaml ./
COPY apps/web/package.json ./apps/web/
RUN pnpm install --frozen-lockfile
FROM base AS build
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/apps/web/node_modules ./apps/web/node_modules
COPY . .
WORKDIR /app/apps/web
RUN pnpm build
FROM nginx:alpine AS runner
COPY --from=build /app/apps/web/dist /usr/share/nginx/html
COPY apps/web/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80

13
apps/web/index.html Normal file
View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SchwarmbLog Gemeinsam die Welt entdecken</title>
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

15
apps/web/nginx.conf Normal file
View File

@@ -0,0 +1,15 @@
server {
listen 80;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location /api/ {
proxy_pass http://api:3001/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}

33
apps/web/package.json Normal file
View File

@@ -0,0 +1,33 @@
{
"name": "@schwarmblog/web",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"typecheck": "tsc --noEmit",
"lint": "eslint src"
},
"dependencies": {
"@tanstack/react-query": "^5.45.0",
"@tanstack/react-router": "^1.42.0",
"@tanstack/router-devtools": "^1.42.0",
"@tanstack/react-query-devtools": "^5.45.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"lucide-react": "^0.395.0"
},
"devDependencies": {
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.19",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.4",
"typescript": "^5.4.5",
"vite": "^5.3.1",
"@tanstack/router-plugin": "^1.42.0"
}
}

View File

@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

9
apps/web/src/index.css Normal file
View File

@@ -0,0 +1,9 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
body {
@apply bg-ocean-50 text-gray-900 font-sans;
}
}

24
apps/web/src/lib/api.ts Normal file
View File

@@ -0,0 +1,24 @@
const BASE = "/api";
async function request<T>(path: string, init?: RequestInit): Promise<T> {
const token = localStorage.getItem("token");
const res = await fetch(`${BASE}${path}`, {
...init,
headers: {
"Content-Type": "application/json",
...(token ? { Authorization: `Bearer ${token}` } : {}),
...init?.headers,
},
});
if (!res.ok) throw new Error(await res.text());
return res.json();
}
export const api = {
get: <T>(path: string) => request<T>(path),
post: <T>(path: string, body: unknown) =>
request<T>(path, { method: "POST", body: JSON.stringify(body) }),
patch: <T>(path: string, body: unknown) =>
request<T>(path, { method: "PATCH", body: JSON.stringify(body) }),
delete: <T>(path: string) => request<T>(path, { method: "DELETE" }),
};

23
apps/web/src/main.tsx Normal file
View File

@@ -0,0 +1,23 @@
import React from "react";
import ReactDOM from "react-dom/client";
import { RouterProvider, createRouter } from "@tanstack/react-router";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { routeTree } from "./routeTree.gen";
import "./index.css";
const queryClient = new QueryClient();
const router = createRouter({ routeTree, context: { queryClient } });
declare module "@tanstack/react-router" {
interface Register {
router: typeof router;
}
}
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<RouterProvider router={router} />
</QueryClientProvider>
</React.StrictMode>
);

View File

@@ -0,0 +1,18 @@
import { createRootRouteWithContext, Outlet } from "@tanstack/react-router";
import { TanStackRouterDevtools } from "@tanstack/router-devtools";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import type { QueryClient } from "@tanstack/react-query";
interface RouterContext {
queryClient: QueryClient;
}
export const Route = createRootRouteWithContext<RouterContext>()({
component: () => (
<>
<Outlet />
<TanStackRouterDevtools />
<ReactQueryDevtools />
</>
),
});

View File

@@ -0,0 +1,15 @@
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/")({
component: Index,
});
function Index() {
return (
<div className="min-h-screen flex flex-col items-center justify-center gap-6">
<div className="text-6xl">🐟</div>
<h1 className="text-4xl font-bold text-ocean-800">SchwarmbLog</h1>
<p className="text-ocean-600 text-lg">Gemeinsam die Welt entdecken</p>
</div>
);
}

View File

@@ -0,0 +1,37 @@
import type { Config } from "tailwindcss";
export default {
content: ["./index.html", "./src/**/*.{ts,tsx}"],
theme: {
extend: {
colors: {
// SchwarmbLog Farbpalette Ozean/Lachs
salm: {
50: "#fff5f0",
100: "#ffe0d0",
200: "#ffb899",
300: "#ff8c5a",
400: "#ff6a2b",
500: "#e84d0e",
600: "#c43a07",
700: "#9c2d05",
800: "#7a2207",
900: "#631d09",
},
ocean: {
50: "#f0f9ff",
100: "#e0f2fe",
200: "#b9e6fd",
300: "#7dd3fc",
400: "#38bdf8",
500: "#0ea5e9",
600: "#0284c7",
700: "#0369a1",
800: "#075985",
900: "#0c4a6e",
},
},
},
},
plugins: [],
} satisfies Config;

11
apps/web/tsconfig.json Normal file
View File

@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"jsx": "react-jsx",
"outDir": "dist",
"rootDir": "src"
},
"include": ["src"]
}

19
apps/web/vite.config.ts Normal file
View File

@@ -0,0 +1,19 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { TanStackRouterVite } from "@tanstack/router-plugin/vite";
export default defineConfig({
plugins: [
TanStackRouterVite(),
react(),
],
server: {
port: 5173,
proxy: {
"/api": {
target: "http://localhost:3001",
rewrite: (path) => path.replace(/^\/api/, ""),
},
},
},
});