r/nestjs • • Sep 22 '26

Would you use a more integrated React + NestJS stack?

I’m curious about something from people who use NestJS seriously.
If there were a way to build a full-stack application where:
NestJS remains the main application framework
You keep Nest modules, DI, guards, pipes, interceptors, routing, etc.
React is used for the UI
You don’t have to maintain a completely separate frontend application
Server-side rendering and interactive React components are both supported
The frontend/backend boundary feels more like one application rather than two separate projects
Would that actually be useful to you?
Or would you prefer the current approach of keeping NestJS as an API/backend and using something like Next.js, Vite, React Router, etc. as the frontend?
I’m specifically interested in why you’d choose one approach over the other.
What would make an integrated approach appealing, and what would make it a hard no?
Not looking for feature requests yet. I’m mainly trying to understand whether this is a problem Nest developers actually have.

3 Upvotes

31 comments sorted by

4

u/[deleted] Sep 22 '26

What you are proposing is already taken care of by a monorepo. I keep separation of concerns split, but I can still share types/utils in one ecosystem. I don’t want to work with SSR, because all the apps I’m building with nextjs are not static webpages or e-commerce sites. 

1

u/Fit-Woodpecker5308 Sep 22 '26

That make sense

1

u/Fit-Woodpecker5308 Sep 22 '26

For for your case.

1

u/Fit-Woodpecker5308 Sep 22 '26

https://github.com/acefolioDev/nest-can-react

Here is the repo link if any of you want to go through from this.

1

u/canarydev Sep 22 '26

it’s basically inertia for nest, which already exists in a few forms, so I’d probably start by looking at why those never really took off.

benefits i guess would be shared types, no CORS boundary, one auth/session story, one deploy. great for small teams and internal tools.

the tradeoff is that once you have a mobile app or another client, you need a client-independent API anyway, which removes a lot of the benefit. you’re also coupling frontend/backend deployment and taking on React build/SSR tooling that Next/Vite will probably always have a much larger ecosystem around.

personally I’d rather keep Nest as the API and share contracts/types through a package.

1

u/Fit-Woodpecker5308 Sep 22 '26

But if our frontend is using the same DI as well then I think we can consider that type of solution somehow.

1

u/Fit-Woodpecker5308 Sep 22 '26

Somehow I Designed it in that way but made sure that It should not shadow nest.js architecture. The pages are still nest.js requests and respects Gaurds,Pipes,DTOs like a normal API route will do.

1

u/portareset1 Sep 22 '26

You did DI with IoC in react?

1

u/Fit-Woodpecker5308 Sep 22 '26

Yes

1

u/portareset1 Sep 22 '26

lol show me the implementation, sounds interesting

1

u/Fit-Woodpecker5308 Sep 22 '26

@Get()
async index(@Req() request: Request, @Res() response: Response) {
await renderPage('welcome', this.welcome.getPage(), { request, response });
}

use server-entry';

export default function WelcomePage(data) {
return (
<>

<h1>{data.tagline}</h1> <Counter /> </> ); }

1

u/canarydev Sep 22 '26

good god lol why

1

u/Fit-Woodpecker5308 Sep 22 '26

Damn man😂 it’s not that bad.
DI remains nest native 😂 Even the page will be rendered from Controller I am not reinventing next.js don’t worry.

1

u/canarydev Sep 22 '26

hahaha you have a repo of this?
im actually really intrigued now.

1

u/Fit-Woodpecker5308 Sep 22 '26

Search the package

nest-can-react on npm 😅

1

u/cdragebyoch Sep 22 '26

Honestly, no. Nest JS isn't for fullstack applications and trying to use it for one is pretty much an anti-pattern. If you need fullstack, just used Next.js. TBH, most of the applications that people develop in typescript is probably better off being written in Next.js. As much as I like Nest JS, its overkill outside of enterprise or distributed environments.

1

u/Fit-Woodpecker5308 Sep 22 '26

I have given the repo link you can check this out.

1

u/Anxious-Insurance-91 Sep 22 '26

Adosnis J's?

1

u/Fit-Woodpecker5308 Sep 22 '26

No Adonis is big fish🌚 and has its own rendering engine.

1

u/Anxious-Insurance-91 Sep 22 '26

And the problem with learning something new is?

1

u/Fit-Woodpecker5308 Sep 22 '26

I actually didn’t get your point.

1

u/AnUuglyMan Sep 30 '26

I would recommend React with react doctor and NestJS Doctor. They’re a great combo.

1

u/Fit-Woodpecker5308 Sep 30 '26

I think you should try nest-can-react ( an npm package and also you can find it on github)

1

u/AnUuglyMan Sep 30 '26

I don't think so.
It seems like it's just a new package that isn't really being used yet, so it might just be noise.

1

u/Fit-Woodpecker5308 Sep 30 '26

It’s definitely early and doesn’t have meaningful adoption yet, so I wouldn’t claim it’s proven or that people should switch to it today.

1

u/Fit-Woodpecker5308 Sep 30 '26

Would love if you can review it and after that have some feedback or contributions.

1

u/Fit-Woodpecker5308 Sep 30 '26

The idea isn’t really to compete with React/Nest tooling, though. It’s exploring whether Nest can own the full-stack app while React acts as the UI/RSC layer.

1

u/iamegoistman Sep 24 '26

I think in this case angular will be best option for full stack setup. UI and backend should share some common structures.