2026-04-08 22:53:11 -03:00
2026-04-08 22:53:11 -03:00
2026-04-08 22:53:11 -03:00
2026-06-12 16:22:11 -03:00

Playzer Monorepo

Este repositorio contiene:

  • apps/frontend: React + Vite + TanStack Router/Query.
  • apps/backend: Bun + Hono + Prisma + Better Auth.
  • packages/api-contract: contratos Zod/tipos compartidos.

Requisitos

  • Bun reciente
  • PostgreSQL disponible

Setup rápido

  1. Instalar dependencias:
bun install
  1. Configurar backend:
cp apps/backend/.env.example apps/backend/.env
  1. Configurar frontend:
cp apps/frontend/.env.example apps/frontend/.env
  1. Ejecutar migraciones:
bun --filter backend prisma:migrate

Variables de entorno

Backend (apps/backend/.env)

  • DATABASE_URL
  • BETTER_AUTH_SECRET
  • BETTER_AUTH_URL
  • APP_BASE_URL
  • CORS_ORIGIN

Frontend (apps/frontend/.env)

  • VITE_API_BASE_URL

Desarrollo

Backend:

bun run dev:backend

Frontend:

bun run dev:frontend

Todo junto:

bun run dev

Prisma

Regenerar cliente después de cambios de schema:

bun --filter backend prisma:generate

Autenticación

El proyecto usa Better Auth con sesión por cookie.

  • Backend: c.get('user') y c.get('session') en contexto Hono.
  • Frontend: authClient con fetchOptions.credentials = 'include'.
  • Frontend API: Axios con withCredentials = true.
  • Backend CORS: credentials: true.

Deploy (Docker)

  • Build context: raíz del monorepo (./)
  • Dockerfile: ./Dockerfile
  • Build args requeridos:
    • DATABASE_URL
    • VITE_API_BASE_URL
    • BETTER_AUTH_SECRET
    • BETTER_AUTH_URL

Flujo recomendado de cambios de API

  1. Actualizar contrato en packages/api-contract.
  2. Implementar backend en apps/backend.
  3. Consumir contrato desde frontend (@repo/api-contract).
Description
Playzer full stack
Readme 5.3 MiB
Languages
TypeScript 99.4%
CSS 0.4%
Dockerfile 0.2%