pnpm monorepo with three workspaces: - @sbt/shared: zod ScoreboardState + WebSocket protocol (single source of truth) - @sbt/server: Fastify REST + raw ws WebSocket + Drizzle/Postgres, run via tsx - @sbt/web: React + Vite + Tailwind installable PWA Real-time core: the WebSocket server holds authoritative per-board state in memory, broadcasts to all clients (editors + OBS overlays) instantly, and debounces Postgres saves (~750ms). One useScoreboardSync hook powers the editor, the no-login co-edit control page, and the read-only OBS overlay. Includes email+password auth (JWT cookie), scoreboard CRUD, logo upload, customizable scorebug (characters/stocks/score/subtitles/callout/side-swap/theme), Docker Compose + Caddy/nginx deploy configs, and docs/PLAN.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
30 lines
871 B
Docker
30 lines
871 B
Docker
# Single image: builds the web app, then runs the server which serves the API,
|
|
# the WebSocket, the uploaded logos, and the built web app.
|
|
FROM node:20-alpine AS build
|
|
RUN corepack enable
|
|
WORKDIR /app
|
|
|
|
# Install deps (cached on lockfile/manifests)
|
|
COPY pnpm-workspace.yaml package.json tsconfig.base.json ./
|
|
COPY packages/shared/package.json packages/shared/
|
|
COPY apps/server/package.json apps/server/
|
|
COPY apps/web/package.json apps/web/
|
|
RUN pnpm install
|
|
|
|
# Build the web app
|
|
COPY . .
|
|
RUN pnpm --filter @sbt/web build
|
|
|
|
FROM node:20-alpine AS runtime
|
|
RUN corepack enable
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production \
|
|
WEB_DIR=/app/apps/web/dist \
|
|
UPLOAD_DIR=/data/uploads \
|
|
HOST=0.0.0.0 \
|
|
PORT=3000
|
|
COPY --from=build /app ./
|
|
EXPOSE 3000
|
|
# Server runs TypeScript directly via tsx — no separate build step needed.
|
|
CMD ["pnpm", "--filter", "@sbt/server", "start"]
|