← All articles

How to Start an Ionic + NestJS Project with the Monorepo Template

Step-by-step setup using the create-ionic-nest-app template: clone, generate app and API, and npm run release.

Published
How to Start an Ionic + NestJS Project with the Monorepo Template cover image

This article is part of the Ionic Framework / Capacitor Advent Calendar 2020.


I often build projects with Ionic/Angular on the frontend and NestJS + MySQL on the backend. After six months, package versions climb and default project layouts shift, so I scaffold with a simple monorepo template.


Setup Steps

  1. Keep CLI versions up to date
% npm i @ionic/cli@latest @nestjs/cli@latest -g

  1. Clone the template
% git clone git@github.com:rdlabo-team/create-ionic-nest-app.git your-project-name
% cd your-project-name
% git remote set-url origin git@github.com:your-account/your-repository.git

  1. Create the Ionic app
% npm run create:app

  1. Create the NestJS app

If you host somewhere other than Lambda, run:

% npm run create:api

For Lambda hosting, use this instead—a Serverless Framework layout:

% npm run create:api:sls

  1. Link with lerna
% npm run install

Releasing

There is no GitHub Actions template bundled, but I recommend releasing with:

% npm run release

https://zenn.dev/rdlabo/articles/1fda37f6e1025999e86e may be a useful reference.

What Is Included

  • Prettier formatting on pre-commit, configured from the start

I hope this makes it easy to start an Ionic project with an API server. See you next time.