Home > Enterprise >  Npm Install Strapi to existing NextJS project
Npm Install Strapi to existing NextJS project

Time:06-21

I'm new to React, NextJS, and Npm, I recently created a Next app using this command: npx create-next-app@latest And now I want to add Strapi to the same project. I used this command to install Strapi: npx create-strapi-app@latest my-project --quickstart Using this command, it will create a new project, for Strapi. I see that the Next and the Strapi projects share a lot of files, such as the files in the node_modules folder. Is there a way to have those in the same project? or would that make a mess?

CodePudding user response:

I came to the conclusion that having those two apps on two different directories, with each having their own config files, and other modules, is the right way. We will end up with a lot of files and folders that exist in both apps, but it is simply best that we isolate these two apps from each other completely, because:

  • They have different config files, in most of the folders.
  • they are two different apps, Stapi being the backend api and the admin dashboard, and the Nextjs app being the rest of the website.
  • If those two apps were combined, we would end up with a directory-structure that would be very hard to work with.

In a larger project we might have more api or apps that run independently, and it's best to have those on different directories and ports. And having some duplicate files across all the apps, wouldn't affect performance, and wouldn't take much storage.

  • Related