next and nest
This commit is contained in:
1 parent
55f69fbbb4
commit
90125aede9
30 files changed
+3754
-344
No files matched your search
@@ -1,36 +1,51 @@
|
||||
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
||||
Monorepo con [npm workspaces](https://docs.npmjs.com/cli/v10/using-npm/workspaces) que combina un backend [NestJS](https://nestjs.com) y un frontend [Next.js](https://nextjs.org).
|
||||
|
||||
## Getting Started
|
||||
## Estructura
|
||||
|
||||
First, run the development server:
|
||||
```
|
||||
apps/
|
||||
api/ NestJS — servidor HTTP real del proyecto
|
||||
web/ Next.js (App Router) — frontend
|
||||
```
|
||||
|
||||
En **desarrollo y producción se levanta un único servidor**: `apps/api` (Nest) arranca, monta sus controladores bajo el prefijo `/api`, y luego delega cualquier otra ruta al request handler programático de Next.js (`apps/web`). No hay dos puertos ni dos procesos — Nest "sirve" a Next.
|
||||
|
||||
Ver `apps/api/src/main.ts` para el detalle de la integración.
|
||||
|
||||
## Empezar
|
||||
|
||||
Instala las dependencias una sola vez desde la raíz (los workspaces se resuelven juntos):
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
### Desarrollo
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
# or
|
||||
bun dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
Levanta Nest en modo watch (`nest start --watch`), que a su vez prepara Next en modo desarrollo. Todo queda disponible en [http://localhost:3000](http://localhost:3000) (API bajo `/api/*`).
|
||||
|
||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||
### Build y producción
|
||||
|
||||
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
||||
```bash
|
||||
npm run build # compila apps/web (next build) y luego apps/api (nest build)
|
||||
npm run start # node apps/api/dist/main.js
|
||||
```
|
||||
|
||||
## Learn More
|
||||
### Solo frontend (aislado)
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
Si necesitas iterar en `apps/web` sin levantar Nest:
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
```bash
|
||||
npm run dev --workspace=@pdv/web
|
||||
```
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
||||
Ten en cuenta que en ese modo las rutas `/api/*` de Nest no estarán disponibles.
|
||||
|
||||
## Deploy on Vercel
|
||||
## Notas de configuración
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
||||
- El custom server de Next (`next({ dev, dir })`) no es compatible con `output: "standalone"` — no lo actives en `apps/web/next.config.ts` mientras Nest siga sirviendo el build.
|
||||
- `apps/api` usa TypeScript 6.x (distinto de `apps/web`, que usa TypeScript 5.x) porque `@nestjs/cli`/`nest build` aún no soportan la API programática del compilador de TypeScript 7.
|
||||
Reference in new issue
Block a user