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

@@ -7,16 +7,16 @@ Este documento define la arquitectura, convenciones y especificaciones del stack
## 1. Stack Tecnológico Principal
### Runtime & Monorepo Manager
* **Runtime:** Node.js (>=20)
* **Package Manager:** [pnpm](https://pnpm.io/) 9
* **Monorepo Tooling:** pnpm workspaces + Turborepo
* **Runtime:** Bun (1.4)
* **Package Manager:** Bun (bun install / bun --filter)
* **Monorepo Tooling:** bun workspaces + Turborepo
### Backend (`apps/backend`)
* **Framework:** [Hono](https://hono.dev/) (servido con `@hono/node-server`, ejecutado con `tsx`)
* **Framework:** [Hono](https://hono.dev/) (servido con `Bun.serve`, ejecutado con `bun --watch`)
* **ORM:** [Prisma](https://www.prisma.io/)
* **Base de Datos:** PostgreSQL
* **Autenticación:** [Better Auth](https://www.better-auth.com/)
* **Validación de Entradas:** `@hono/zod-validator`
* **Validación de Entradas:** `validator` de hono (`hono/validator`) + `Zod.safeParse`
### Frontend (`apps/web`)
* **Framework / Library:** React 19+ con TypeScript
@@ -37,7 +37,7 @@ Este documento define la arquitectura, convenciones y especificaciones del stack
```text
gruperly/
├── apps/
│ ├── backend/ # Servicio Backend (Node + Hono + tsx)
│ ├── backend/ # Servicio Backend (Bun + Hono)
│ │ ├── src/
│ │ │ ├── http/ # Infraestructura HTTP (validate, problem-details, session-auth, ...)
│ │ │ ├── lib/ # Prisma (cliente + UnitOfWork), pagination, email, helpers
@@ -46,7 +46,7 @@ gruperly/
│ │ │ │ ├── routes.ts
│ │ │ │ └── features/<accion>/{route,use-case}.ts
│ │ │ ├── app.ts # Monta basePath('/api/v1') + rutas + notFound/onError (RFC 7807)
│ │ │ ├── server.ts # Entry point (serve de @hono/node-server)
│ │ │ ├── server.ts # Entry point (Bun.serve)
│ │ │ └── logger.ts # pino + pino-pretty
│ │ ├── prisma/
│ │ │ ├── schema.prisma # Generator + datasource simple
@@ -54,7 +54,7 @@ gruperly/
│ │ │ └── migrations/
│ │ ├── generated/ # Cliente generado de Prisma (gitignoreado, alias @generated/*)
│ │ ├── prisma.config.ts # Config de Prisma CLI (datasource URL, migrations)
│ │ ├── test/ # Tests vitest
│ │ ├── test/ # Tests bun test
│ │ ├── tsconfig.json
│ │ └── package.json
│ │