mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-18 13:49:40 +02:00
Extract the credit system from mana-core-auth into a standalone service. Uses Hono framework on Bun runtime instead of NestJS. Service includes: - Personal credit balance with optimistic locking - Immutable transaction ledger - Stripe payment integration (PaymentIntents, Checkout Sessions) - Guild shared pools with per-member spending limits - Gift code system (simple, personalized, split, first_come, riddle) - Service-to-service internal API (X-Service-Key auth) - JWT validation via JWKS from mana-core-auth (jose library) Architecture: - 27 files, ~2.2k LOC (vs ~4.1k in NestJS) - Drizzle ORM schemas adapted for standalone DB (no FK to auth tables) - Zod validation instead of class-validator - Manual service instantiation instead of NestJS DI - Hono middleware for JWT + service key auth Port: 3060 Database: mana_credits (separate from mana_auth) Next steps: Update CreditClientService URL, update mana-core-auth registration hooks, configure Docker + Cloudflare Tunnel. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
18 lines
484 B
Docker
18 lines
484 B
Docker
FROM oven/bun:1 AS production
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files and install
|
|
COPY package.json bun.lock* ./
|
|
RUN bun install --frozen-lockfile 2>/dev/null || bun install
|
|
|
|
# Copy source
|
|
COPY src ./src
|
|
COPY tsconfig.json drizzle.config.ts ./
|
|
|
|
EXPOSE 3060
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
|
CMD bun -e "fetch('http://localhost:3060/health').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))"
|
|
|
|
CMD ["bun", "run", "src/index.ts"]
|