Skip to content

This repository is a starter kit for a TypeScript monorepo project. It is based on TypeScript, Npm, ESLint, Prettier, Jest, Turborepo and Changesets.

License

Notifications You must be signed in to change notification settings

nanlabs/ts-monorepo-boilerplate

Repository files navigation

TypeScript Monorepo Boilerplate

Changelog | Contributing

Continious Integration License: MIT

This repository is a starter kit for a TypeScript monorepo project. It is based on TypeScript, Npm, ESLint, Prettier, Jest, Turborepo and Changesets.

This project was generated using create-awesome-node-app. DON'T USE THIS TEMPLATE AS IT! Generate yours using the command and following the options in the interactive menu. Check the docs for more information!

Features

  • Monorepo - All packages are managed by Turborepo.
  • NPM Workspaces - All packages are managed by NPM Workspaces.
  • Changesets - All packages are managed by Changesets.
  • TypeScript - All packages are written in TypeScript.
  • ESLint - All packages are linted by ESLint.
  • Prettier - All packages are formatted by Prettier.
  • Jest - All packages are tested by Jest.
  • React - There is a React app inside the apps folder.
  • Nest.js - There is a Nest.js service inside the services folder.
  • Storybook - There is a Storybook playground inside the playgrounds folder.
  • Local Development Environment - Local development using Docker Compose, Serverless Offline, and Vite.

Pre-packed

Dev tools

  • TypeScript
  • Turbo - A monorepo manager for JavaScript and TypeScript
  • Changesets - A way to manage your versioning and changelogs with a focus on multi-package repositories
  • npm-run-all - Run multiple npm-scripts in parallel or sequential
  • eslint - Linting utility for JavaScript and JSX
  • prettier - Opinionated code formatter
  • husky - Git hooks made easy
  • lint-staged - Run linters against staged git files and don't let 💩 slip into your code base!

Continuous Integration

We use GitHub Actions to run our continuous integration pipeline. The pipeline is defined in the ci.yml file. The pipeline runs the following steps:

  • Linter - Runs the linter on the project (using npm run lint). This step will fail if the linter finds any errors.
  • Type Check - Runs the type checker on the project (using npm run typecheck). This step will fail if the type checker finds any errors.
  • Shell Check - Runs the shell checker on the project. This step will fail if the shell checker finds any errors.
  • Markdown Lint - Runs the markdown linter on the project. This step will fail if the markdown linter finds any errors.
  • TODOs to GitHub Issues - Creates GitHub issues for all TODOs in the project.
  • Pull Request Review - Adds a comment to the pull request with a summary of the changes.

Applications and Services

Getting Started

Requirements

  • Docker
  • Docker Compose
  • NodeJS - You’ll need to have Node 18.15.0 or later on your local development machine (but it’s not required on the server). You can use fnm to easily switch Node versions between different projects.

Setup Local Environment

  • Setup the correct NodeJS version using fnm and install dependencies.
fnm use
export NODE_AUTH_TOKEN=<your-npm-token>
npm install

NOTE: if you are working in a arm64 platform (e.g MacBook with m1 or m2 chip), you might need to run npm i turbo && npm i.

  • Run the local dev environment.
npm run local:up

Running the Applications

Each app and service has its own README.md file with instructions on how to run it locally.

Available Scripts

In the project directory, you can run:

npm run <script> Description
test Runs unit tests with Jest.
lint Lints the project for potential errors
lint:fix Lints the project and fixes all correctable errors
format Formats the project using Prettier
storybook Runs Storybook
build-storybook Builds Storybook

Contributing

  • Contributions make the open source community such an amazing place to learn, inspire, and create.
  • Any contributions you make are truly appreciated.
  • Check out our contribution guidelines for more information.

Contributors

Made with contributors-img.

About

This repository is a starter kit for a TypeScript monorepo project. It is based on TypeScript, Npm, ESLint, Prettier, Jest, Turborepo and Changesets.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published