Start a monorepo with NestJS and NextJS with Docker
Note: this preset bootstraps both NestJS and NextJS with Typescript and
npmas the package manager.
kool create nest+next my-project
kool run setup
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.
Run Commands in Docker Containers
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
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.
Open Sessions in Docker Containers
Similar to SSH, if you want to open a Bash session in your
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
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.