Monorepo NestJS with NextJS - Presets

Start a monorepo with NestJS and NextJS with Docker

Note: this preset bootstraps both NestJS and NextJS with Typescript and npm as the package manager.

  1. Run kool create nest+next my-project
  2. Run cd my-project
  3. Run kool run setup
  4. Run kool start

The first step may take a couple of minutes for installing all the dependencies for both Nest and Next. After built and running you can access:

  • http://localhost:81 - NestJS backend
  • http://localhost - NextJS frontend

Yes, using kool + Docker to create and work on new monorepo for NestJS and NextJS projects is that easy!

If you are using Database or Cache services for your NestJS backend you need to setup some environment variables. Check out our NestJS preset documentation.

If you haven't done so already, you first need to install Docker and the kool CLI.

Also, make sure you're running the latest version of kool. Run the following command to compare your local version of kool with the latest release, and, if a newer version is available, automatically download and install it.

$ kool self-update

Please note that it helps to have a basic understanding of how Docker and Docker Compose work to use Kool with Docker.

Use kool exec to execute a command inside a running service container:

# kool exec [OPTIONS] SERVICE COMMAND [--] [ARG...] $ kool exec backend node -v # backend is the NestJS container service $ kool exec frontend node -v # backend is the NextJS container service

Try kool run nest --help to execute the kool exec backend nest --help command in your running app container and print out information about NestJS' commands.

Similar to SSH, if you want to open a Bash session in your backend or frontend containers, run kool exec <container> bash, where <container> is the name of the service container in docker-compose.yml. If you prefer, you can use sh instead of bash (kool exec <service> sh).

$ kool exec backend bash # opens a shell on the container running NestJS $ kool exec frontend bash # opens a shell on the container running NextJS

We have more presets to help you start projects with kool in a standardized way across different frameworks.

kool.dev
By choosing "Accept all cookies" you agree to the use of cookies to help us provide you with a better user experience and to analyse website usage. Only the essential cookies are necessary for the proper functioning of our website and cannot be refused.
Check out our Cookie Policy and Privacy Policy for more information.