Skip to content

Getting started

Prerequisites

The following software must be installed before using this template:

  • Bun — all-in-one JavaScript runtime & toolkit (bundler, test runner, package manager).
  • Docker — platform for building and running containerised applications.
  • Helm (optional) — package manager for Kubernetes.
  • Kind (optional) — local Kubernetes clusters using Docker.
  • Kubectl (optional) — command-line tool for Kubernetes.

Quickstart

sh
# Clone this template
bunx degit https://github.com/this-is-tobi/template-monorepo-ts <project_name>

# Go to project directory
cd <project_name>

# Init git on the new project
git init

# Init example files
sh ./ci/scripts/init-env.sh

# Install dependencies
bun install

# Build packages
make build

Commands

A full set of commands is available through the Makefile. Run make help to list all available targets.

Setup

sh
# Prepare git hooks (husky)
make prepare

# Build all packages and apps
make build

# Remove build artifacts and node_modules
make clean

Development

sh
# Start development mode (db + turbo dev)
make dev

# Lint the code
make lint

# Format the code
make format

Database

sh
# Generate Prisma database client
make db-generate

# Deploy Prisma migrations to database
make db-deploy

# Run Prisma migrations in dev mode
make db-migrate

# Reset database and run migrations
make db-reset

Testing

sh
# Run all unit tests
make test

# Run unit tests with coverage
make test-cov

# Run full validation suite (lint, tests, builds)
make validate

# Run end to end tests - requires `make dev` open in another terminal
make test-e2e

Docker

sh
# Start dev containers with watch mode
make docker-dev-up

# Start prod containers
make docker-prod-up

# Run e2e tests in dev containers
make docker-e2e

# Run e2e tests in prod containers (CI)
make docker-e2e-ci

# Stop dev or prod containers
make docker-dev-down
make docker-prod-down

# Stop and delete dev or prod containers and volumes
make docker-dev-clean
make docker-prod-clean

Kubernetes

sh
# Initialize local Kubernetes cluster with kind
make kube-init

# Full dev workflow for Kubernetes (build + deploy)
make kube-dev

# Full prod workflow for Kubernetes (build + deploy)
make kube-prod

# Remove Kubernetes application resources
make kube-down

# Delete Kubernetes cluster
make kube-clean

# Run e2e tests in Kubernetes
make kube-e2e

Notes: Lower-level bun run scripts are also available in package.json and can target a specific workspace (e.g. bun run --cwd <package_path> <script_name>).

Access

ApplicationURL (local / docker)URL (kubernetes)
APIhttp://localhost:8081http://api.domain.local
API - swaggerhttp://localhost:8081/swagger-uihttp://api.domain.local/swagger-ui
Documentationhttp://localhost:8082http://doc.domain.local
Grafanahttp://localhost:8083-
Keycloakhttp://localhost:8084-
Prometheushttp://localhost:9090-

Notes: If containers are healthy but services are not resolved in Kubernetes, check that the domains are mapped to 127.0.0.1 in /etc/hosts. The make kube-init command handles this automatically.