refactor: migrate monorepo from pnpm to Bun runtime and workspaces

- root: bun workspaces via package.json, packageManager bun@1.4.0, scripts use bun --filter
- backend: Bun.serve, bun test (vitest removed), bun --watch dev script, tsconfig types bun
- tests: migrate 6 test files from vitest to bun:test (mock.module)
- validate: replace @hono/zod-validator with hono validator + zod safeParse (fixes TS2589)
- lockfile: bunfig.toml saveTextLockfile, regenerated bun.lock (text) for turbo
- docs: AGENTS.md, README.md, stack.md updated to Bun stack
This commit is contained in:
Jose Selesan
2026-09-14 10:58:56 -03:00
parent 4b1f356fab
commit 6246bf2341
21 changed files with 1125 additions and 4936 deletions

View File

@@ -4,9 +4,9 @@ Monorepo de Gruperly. Consulta [stack.md](./stack.md) para arquitectura y especi
## Stack
- Package manager: [pnpm](https://pnpm.io/) 9
- Monorepo: pnpm workspaces + Turborepo
- Backend (`apps/backend`): Node + Hono (`@hono/node-server`) + Prisma + PostgreSQL + Better Auth
- Package manager: [Bun](https://bun.sh/) 1.4
- Monorepo: bun workspaces + Turborepo
- Backend (`apps/backend`): Bun + Hono (`Bun.serve`) + Prisma + PostgreSQL + Better Auth
- Frontend (`apps/web`): React 19 + TypeScript + TanStack Router + TanStack Query + Tailwind v4
- Shared (`packages/shared`): esquemas Zod, tipos, `Result` y Problem Details compartidos
@@ -14,7 +14,7 @@ Monorepo de Gruperly. Consulta [stack.md](./stack.md) para arquitectura y especi
```text
apps/
backend/ # Backend (Node + Hono + Prisma, tsx)
backend/ # Backend (Bun + Hono + Prisma)
web/ # Frontend (React PWA)
packages/
shared/ # Esquemas Zod y tipos compartidos
@@ -24,16 +24,16 @@ packages/
## Comandos
```bash
pnpm install # Instala dependencias de todos los workspaces
pnpm dev # Levanta la API (4000) y la web (6173) vía Turborepo
pnpm typecheck # tsc --noEmit en todos los paquetes
pnpm lint # biome check (backend y shared)
pnpm --filter @gruperly/backend test # vitest (backend)
pnpm --filter @gruperly/backend db:push # Aplica el esquema de Prisma a la base de datos
pnpm --filter @gruperly/backend db:studio # Abre Prisma Studio
bun install # Instala dependencias de todos los workspaces
bun dev # Levanta la API (4000) y la web (6173) vía Turborepo
bun run typecheck # tsc --noEmit en todos los paquetes
bun run lint # biome check (backend y shared)
bun --filter @gruperly/backend test # bun test (backend)
bun --filter @gruperly/backend db:push # Aplica el esquema de Prisma a la base de datos
bun --filter @gruperly/backend db:studio # Abre Prisma Studio
```
## Setup de base de datos
1. Crea una base PostgreSQL y copia `apps/backend/.env.example` → `apps/backend/.env`, ajustando `DATABASE_URL`.
2. Ejecuta `pnpm --filter @gruperly/backend db:generate` y `pnpm --filter @gruperly/backend db:push` (o `pnpm --filter @gruperly/backend db:migrate` en desarrollo).
2. Ejecuta `bun --filter @gruperly/backend db:generate` y `bun --filter @gruperly/backend db:push` (o `bun --filter @gruperly/backend db:migrate` en desarrollo).