🔧 chore: create @manacore/shared-nestjs-setup and migrate 8 backends

- Create shared package with bootstrapApp(), configureCors(), configureValidation()
- Migrate: chat, calendar, contacts, zitare, clock, planta, presi, nutriphi
- Skip complex backends: manadeck, picture, todo, skilltree, questions, storage

Savings: ~280 LOC (8 backends × 35 LOC each)
This commit is contained in:
Till-JS 2026-01-29 17:25:51 +01:00
parent 840f6d7ff3
commit fbd315eac0
21 changed files with 280 additions and 314 deletions

View file

@ -20,6 +20,7 @@
"dependencies": {
"@google/generative-ai": "^0.21.0",
"@manacore/shared-nestjs-auth": "workspace:*",
"@manacore/shared-nestjs-setup": "workspace:*",
"@manacore/shared-storage": "workspace:*",
"@nestjs/common": "^10.4.15",
"@nestjs/config": "^3.3.0",

View file

@ -1,38 +1,9 @@
import { NestFactory } from '@nestjs/core';
import { ValidationPipe } from '@nestjs/common';
import { bootstrapApp } from '@manacore/shared-nestjs-setup';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
// Enable CORS for web app
const corsOrigins = process.env.CORS_ORIGINS?.split(',').map((origin) => origin.trim()) || [
'http://localhost:3000',
'http://localhost:5173',
'http://localhost:5191',
'http://localhost:3001',
];
app.enableCors({
origin: corsOrigins,
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
credentials: true,
});
// Enable validation
app.useGlobalPipes(
new ValidationPipe({
whitelist: true,
transform: true,
forbidNonWhitelisted: true,
})
);
// Set global prefix for API routes
app.setGlobalPrefix('api/v1');
const port = process.env.PORT || 3022;
await app.listen(port);
console.log(`Planta backend running on http://localhost:${port}`);
}
bootstrap();
bootstrapApp(AppModule, {
defaultPort: 3022,
serviceName: 'Planta',
additionalCorsOrigins: ['http://localhost:5191'],
excludeFromPrefix: [], // no exclusions
});