← Back to Blog Devlog

Escaping Next.js App Router Hell: Migrating our Admin Dashboard Backend to NestJS and TypeORM

The goal

We wanted a web app with real user management, subscription tiers, and a Django-style admin panel. We started with the modern setup: Next.js 15 plus Payload CMS v3.

What actually happened

We weren't building features. We were fighting the experimental boundary rules of React Server Components (RSC). The moment a server module or database function touched a client component without a clean serialization handshake or a 'use server' directive, Next.js threw a 500. The meta-framework was costing us all our time.

The switch

We dropped the rendering layer and moved to a separated backend: NestJS + TypeORM + SQLite.

Pulling the data engine out of the front-end hydration rules gave us predictable behavior. TypeORM maps our schema with plain TypeScript classes and decorators:

typescript

@Entity()
export class User {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ unique: true })
  email: string;

  @Column({ default: 'user' })
  role: string;
}


What's next

NestJS is module- and dependency-injection based (AuthModule, UserModule, BillingModule), so we can add heavier logic like Stripe webhooks or subscription checks without risking the core data tables.