Add member accounts, follow-based leaderboard, and dedicated Postgres

Members register via email+password (scrypt) or Google OAuth — same
signed-cookie + scrypt pattern as LokiLab (lib/auth.ts, member-password.ts,
member-auth.ts, google-oauth.ts), own AUTH_SECRET and own OAuth client,
own dedicated Postgres database (lokiloto-db on Coolify), fully isolated
from LokiLab's own DB and auth.

Leaderboard tracks who follows Loki's picks most accurately — members
star a pick from the results panel (FollowButton), resolution reuses
LokiLab's own lastDraw.won, no money or pooled play involved anywhere.
Leaderboard page renders a horizontal bar chart (recharts) plus a ranked
list.

Profile page: public nickname (required to appear on the leaderboard),
list of followed picks. Header now carries nav + a user menu (avatar
dropdown when signed in, "Connexion" button otherwise).

Dockerfile runs prisma migrate deploy at container start via
docker-entrypoint.sh, same pattern as LokiLab.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Nazim Kri
2026-10-30 09:02:26 -04:00
co-authored by Claude Sonnet 5
parent fc69d4a668
commit c3a0a7b765
36 changed files with 2419 additions and 27 deletions
+12 -1
View File
@@ -1,10 +1,13 @@
# LokiLoto — Next.js 16 standalone, for Coolify.
FROM node:22-alpine AS base
RUN apk add --no-cache libc6-compat
RUN apk add --no-cache libc6-compat openssl
WORKDIR /app
FROM base AS deps
COPY package.json package-lock.json* ./
# prisma/schema.prisma is needed before install: the "prisma" package's own
# postinstall hook runs `prisma generate`, which fails without it.
COPY prisma ./prisma
RUN npm install --no-audit --no-fund --include=dev
FROM base AS builder
@@ -22,6 +25,14 @@ RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
# Prisma CLI for migrate deploy at container start — see docker-entrypoint.sh.
# Kept out of ./node_modules so it never shadows the app's own traced
# runtime deps; the entrypoint points NODE_PATH at it only for this command.
COPY --from=deps --chown=nextjs:nodejs /app/node_modules ./cli-deps/node_modules
COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma
COPY --from=builder --chown=nextjs:nodejs /app/docker-entrypoint.sh ./docker-entrypoint.sh
RUN chmod +x ./docker-entrypoint.sh
USER nextjs
EXPOSE 3000
ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["node", "server.js"]