Performance: Hybrid applications
Hybrid applications impact initial load speed and runtime responsiveness by combining server-side and client-side rendering.
import { Controller, Get, Render } from '@nestjs/common'; @Controller() export class AppController { @Get() @Render('index') root() { return { message: 'Hello from server' }; } } // Client-side JS is code-split and lazy-loaded only when needed
import { Controller, Get, Render } from '@nestjs/common'; @Controller() export class AppController { @Get() @Render('index') root() { return { message: 'Hello from server' }; } } // Heavy client-side JS bundle loaded without code splitting
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Server-side render only | Minimal DOM nodes initially | 1 reflow on initial load | Low paint cost | [OK] Good |
| Hybrid with large JS bundle | Many DOM nodes hydrated | Multiple reflows during hydration | High paint cost due to JS execution | [X] Bad |
| Hybrid with code splitting | DOM nodes hydrated progressively | Single reflow per chunk | Moderate paint cost | [!] OK |
const app = await NestFactory.create(AppModule);
app.connectMicroservice({ transport: Transport.TCP });
await app.startAllMicroservices();
await app.listen(3000);
console.log('App is running');const app = await NestFactory.create(AppModule);
app.connectMicroservice({ transport: Transport.REDIS });
await app.listen(3000);
await app.startAllMicroservices();Pass the test and this pattern moves unknown