Introduction

Deploying your monorepo to Netlify/Porter is relatively straightforward, but there are a handful of things to be aware of. The frontend deployment is relatively straightforward, but the backend deployment can be a little more complex and need a bit more attention.
For a more detailed guide on deploying a monorepo to Netlify, see the official documentation.

Prerequisites

Before continuing, ensure you have:
  • A Netlify account. It is typically easiest to sign up with your GitHub account, as we’ll also be deploying directly from the GitHub repository.
  • A Porter account. It is typically easiest to sign up with your GitHub account, as we’ll also be deploying directly from the GitHub repository.
  • Published your repo to GitHub. If you haven’t done this yet, you can follow the instructions here.
  • Optional. If you’re planning to deploy your documentation site to Mintlify, you’ll need to have a Mintlify account.

Frontend Deployment

1

Add new project in Netlify

Go to your Netlify dashboard and click the Add New Site button, and select Import an existing project.
2

Import your monorepo

Select the Github option and select your repository from the list of repositories.
3

Configure Project

Netlify will automatically detect that you have a monorepo, and should have correctly populated all the required fields.The project root directory should be automatically detected, but if it isn’t, you can manually set it to the folder where your frontend is stored. In this project, that is apps/web.
4

Deploy

Click the Deploy button to deploy your project.

Backend deployment

1

Add new service in Porter Cloud

Go to your Porter dashboard and click the + New application button.
2

Import your monorepo

Select the Git repository option and select your repository from the list of repositories and click Connect.
3

Configure Project

Porter will automatically detect that you have a monorepo, but for the backend we need to change the default configuration.
  • Configure your project name
  • Change the Root Directory to the folder where your backend is stored. In this project, that is apps/api
  • For build method, select ‘Docker’ and select the Dockerfile path
  • Create an ‘api’ application service
  • Add the start command poetry run python run.py
  • Select CPU as 0.3 Cores and RAM as 900 MB
  • Add your Environment Variables (maybe add from .env file as that would be easier)
4

Deploy

Click the Deploy app button to deploy your project. Once built, the API should be running at the URL provided.

Documentation deployment

For a more detailed explanation, visit the offical documentation
Connecting to an existing repository with Mintlify is a little bit tricky, as their walkthrough currently seems to only support creating a new repository. However, it is possible to connect an existing repository by following the steps below.
1

Sign in to Mintlify

Sign in to Mintlify. You will further be prompted to Sign in with GitHub. Follow the onscreen instructions.
2

Select Monorepo

Configure your deployment to be pointed to your docs directory. Ensure set up as a monorepo is selected.
3

Install Mintlify app to GitHub

From the Mintlify dashboard, click Things to Do and then click Enable automatic updates.