DEV Community

Cover image for looking for answers !, strapi vs nest js for my next project

looking for answers !, strapi vs nest js for my next project

warrior.dev on May 05, 2020

I have never worked with any of the 2, I come from the world of laravel and typescript.
I want to explore these options for a new project, but I can't decide.
If you have to compare them, how would they compare?

Collapse
 
brokenthorn profile image
Paul-Sebastian Manole • Edited

Strapi is a general purpose CMS with lots of plugins, which can make it good for backend data server, content server, media server, and so on (many kinds of APIs). Officially advertised as: "Open source Node.js Headless CMS to easily build customisable APIs".

NestJS is an MVC framework which handles the lowest levels of serving content/data in something like a CMS, or a custom application. Officially advertised as: "A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications on top of TypeScript & JavaScript (ES6, ES7, ES8)".

Strapi is written in JavaScript and is venture capital funded.

NestJS is written in TypeScript and is very robust and very flexible and has a few very well written plugins, microframeworks and solutions, or "extensions", like for example nestjxs/crud which instantly gives you a well designed OpenAPI REST server. These provide scaffolds to build custom solutions on. In the end you can achieve something like Strapi but be a lot more flexible and robust, albeit at the cost of more development time.

Also with Strapi you can build your API graphically (or not), with NestJS you need to do it programmatically (with code).

If you're building a general purpose app, or you're a very small shop, or a small company looking to replace WordPress, choose Strapi, it's faster to get going. (this doesn't mean Strapi is not good for large companies, but very much depends on what you're building)

If you're very serious about your applications, you prefer code to a graphical UI, and you're building some very custom solution that needs to be extended over time, needs to be very robust, and follow a strong and well understood application architecture (MVC, NestJS looks a lot like Angular), can't have (many) runtime errors, needs to stay performant always, think large enterprise stuff, then you're probably better off choosing NestJS.

That's based on my personal experience and I've only just written my first backend with NestJS but previously I tried Strapi. Have to say that I prefer NestJS even if this is a personal project. It's a lot more flexible and robust (for example I can better enforce referential integrity, which is something you can't do with Strapi. This can lead to less headaches down the road.).

Collapse
 
warriordev profile image
warrior.dev

Thank you very much! Very good answer! It helps me to clarify the picture a lot!

Collapse
 
brokenthorn profile image
Paul-Sebastian Manole • Edited

Thank you. Glad I could help. I hope I didn't paint Strapi in a bad light. Maybe I should have said that what took me a few days to write in NestJS, only took me a few minutes to bootstrap in Strapi using the GUI. But like I said, with NestJS I have more control at the finger tips and more power (which I cared for a lot more, like writing my database schema such that referential integrity gets built into the database schema, and not left over to the client or backend service to enforce with application logic which adds the need to write more unit tests).

Collapse
 
mdmajidali profile image
Mohammed Majid Ali

1000 Likes!

Collapse
 
fransafu profile image
Francisco Javier Sánchez Fuentes

Hello!

Nextjs has good documentation and structure (folder, pattern design, etc.), maybe if you want good community support and more details on "How to implement it?", It is a good option.

Good luck!

Collapse
 
warriordev profile image
warrior.dev

Thanks for you response, i got an autocomplete error, but what do you think in nestjs vs strapi to model a backend, in terms of add more functionabilities over the time

Collapse
 
fransafu profile image
Francisco Javier Sánchez Fuentes

Nest.js is a "lightweight development framework" and Strapi is a "Headless Content Management System". The first has all tools to make your Back-end server, but Strapi has plugins for extending its functionalities and It's a CMS (big difference).

What do you want? That is the response. You want to make your CMS? or you want to make a "simple" app?

Collapse
 
geekdencode profile image
Den

I want to use strapi to automatically create a database and a basic api (e.g. authorization), and nest js to implement interesting functionality using a database of users from strapi. What do you think about that?

Collapse
 
warriordev profile image
warrior.dev

That's is the same approach i have.
I'm using in my current project strapi for simple things and nestjs for the business logic 💪🚀

Collapse
 
sylveryte profile image
Sandeep Sahani

How is it going for you guys, strapi+nestjs? I'm also thinking about same approach.