Your Mukti monorepo is now fully configured with industry best practices!
# Start all apps in development mode
bun run dev
# Start specific project
bun nx run @mukti/api:serve # API dev server
bun nx run @mukti/web:dev # Web dev server# Start the full local stack
docker compose up -dThis starts:
- MongoDB
- Redis
- a one-shot API seed container
- API
- Web
Compose now waits for MongoDB and Redis healthchecks, runs the API seed job, and only then starts the API container.
Seeded local users:
test@mukti.app/testpassword123admin@mukti.chat/muktifrombrainrot
Useful commands:
# Re-run the seed job explicitly
docker compose up seed
# Rebuild and restart the full stack
docker compose up -d --build
# Stop everything
docker compose down# Build all projects
bun run build
# Build specific project
bun nx run @mukti/api:build
bun nx run @mukti/web:build
# Build only changed projects
bun run affected:build# Lint all projects
bun run lint
# Lint and auto-fix
bun run lint:fix
# Format all code
bun run format
# Check formatting
bun run format:check
# Lint/test only affected projects
bun run affected:lint
bun run affected:test# Run all tests
bun run test
# Run tests with coverage
bun run test:cov
# Test specific project
bun nx run @mukti/api:test
bun nx run @mukti/api:test:watch
bun nx run @mukti/api:test:e2e# Stage your changes
git add .
# Use interactive commit CLI
bun run commitThis launches a guided prompt that helps you:
- Select commit type (feat, fix, docs, etc.)
- Choose scope (api, web, auth, etc.)
- Write proper subject and body
- Mark breaking changes
- Reference issues
<type>(<scope>): <subject>
<body>
<footer>
Example:
feat(auth): Add JWT token refresh mechanism
Implemented automatic token refresh using refresh tokens.
This prevents token expiration during long sessions.
Closes #123
feat✨ - New featurefix🐛 - Bug fixdocs📚 - Documentationstyle💎 - Code stylerefactor📦 - Refactoringperf🚀 - Performancetest🚨 - Testsbuild🛠 - Build systemci⚙️ - CI/CDchore♻️ - Maintenance
Projects: api, web, mcp-server
Infrastructure: config, ci, deps, docker, deployment, monorepo
Documentation: docs, readme
Database: db, redis
UI/UX: ui, components, styles
Testing: test, e2e
Other: release
- Computation caching - Never rebuild unchanged code
- Affected commands - Only work on what changed
- Task orchestration - Automatic dependency management
- Parallel execution - Run tasks concurrently
Cache location: .nx/cache
Visualize dependencies:
bun run graph- Guided commit message creation
- Enforced conventional commits
- Predefined types and scopes
- Emoji support
- Validates commit format
- Enforces scopes from predefined list
- Character limit enforcement
- Sentence-case subject validation
Automatically runs on git commit:
- ESLint with auto-fix on affected projects
- Prettier on affected projects
- Only runs on changed projects (fast!)
Pre-commit: Runs Nx affected lint and format
bun nx affected --target=lint --fix --parallel=3
bun nx affected --target=format --parallel=3Commit-msg: Validates commit message
bunx --bun commitlint --edit $1Config highlights:
- Single quotes
- 100 character line width
- 2 space indentation
- Trailing commas (ES5)
- Semicolons enabled
Both packages have project.json with defined targets:
@mukti/api (NestJS):
- build, serve, start, start:prod
- lint, lint:fix
- format, format:check
- test, test:watch, test:cov, test:e2e
- Uses Jest for testing
@mukti/web (Next.js):
- build, dev, start
- lint, lint:fix
- format, format:check
- type-check
- Uses Next.js built-in linting
mukti/
├── packages/
│ ├── mukti-api/ # NestJS backend
│ │ ├── src/
│ │ ├── test/
│ │ ├── project.json # Nx configuration
│ │ └── package.json
│ └── mukti-web/ # Next.js frontend
│ ├── src/
│ ├── project.json # Nx configuration
│ └── package.json
├── .husky/ # Git hooks
│ ├── pre-commit # Runs affected lint & format
│ └── commit-msg # Validates commit messages
├── .nx/ # Nx cache
├── nx.json # Nx workspace config
├── commitlint.config.js # Commit validation
├── .prettierrc # Prettier config
└── package.json # Root package with scripts
Create packages/shared for:
- Shared TypeScript types
- Utility functions
- Constants
# Usage in other packages
import { User, Conversation } from '@mukti/shared';Example workflow:
name: CI
on: [pull_request, push]
jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run affected:lint
- run: bun run affected:test
- run: bun run affected:buildUse nx cache in Docker:
FROM oven/bun:latest AS builder
WORKDIR /app
COPY . .
RUN bun install
RUN bun nx run @mukti/api:build
# Copy nx cache for faster rebuilds
COPY --from=builder /app/.nx/cache ./.nx/cacheCreate mukti.code-workspace:
{
"folders": [{ "path": "." }, { "path": "packages/mukti-api" }, { "path": "packages/mukti-web" }],
"settings": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
}For faster type-checking and IDE performance:
// tsconfig.base.json
{
"compilerOptions": {
"composite": true,
"declaration": true
}
}Next.js:
bun add -D @next/bundle-analyzer
ANALYZE=true bun nx run @mukti/web:buildPrevent unwanted dependencies:
bun add -D dependency-cruiser
bunx depcruise --initbun nx resetrm -rf node_modules packages/*/node_modules
bun installrm -rf .husky
bun run prepareecho "feat(api): Test message" | bunx commitlintbunx commitlint --print-config# Instead of testing everything
bun run test
# Only test changed code
bun run affected:testAlready configured:
bun run dev # Runs with --parallel=2Nx caches everything automatically. View cache:
ls -la .nx/cacheClear if needed:
bun nx reset# Build with production optimizations
NODE_ENV=production bun run buildInstead of git commit, use:
bun run commitThis ensures proper formatting and validation.
bun run affected:lint
bun run affected:test
bun run affected:buildOnly builds what changed = faster CI.
bun updatebun run graphSee which projects are affected by your changes.
Always include a scope in commits:
feat(auth): Add login
Not:
feat: Add login
- Nx Documentation: https://nx.dev
- Commitlint: https://commitlint.js.org
- Commitizen: https://commitizen-tools.github.io/commitizen
- Conventional Commits: https://www.conventionalcommits.org
- Bun Documentation: https://bun.sh/docs
Your monorepo now has:
✅ Nx - Smart build system with caching ✅ Commitizen - Interactive guided commits ✅ Commitlint - Commit message validation ✅ Nx Affected - Pre-commit quality checks ✅ Git Hooks - Automated quality enforcement ✅ Prettier - Consistent code formatting ✅ Bun - Fast package manager and runtime ✅ Jest - Testing framework for API ✅ Project Configs - Defined tasks for all packages
Everything runs through Nx for optimal performance and caching.
Start developing:
bun run devMake a commit:
git add .
bun run commitHappy coding! 🚀