A modern TypeScript monorepo template built with pnpm workspaces, featuring multiple packages, examples, and comprehensive development tooling.
├── packages/ # Core packages
│ ├── core/ # Core functionality
│ ├── utils/ # Utility functions // Not used yet
│ └── client/ # Client package that uses core & utils // Not used yet
├── examples/ # Usage examples
│ ├── basic/ # Basic usage example
│ └── advanced/ # Advanced usage example
├── docs/ # Documentation
└── scripts/ # Development scripts- Node.js >= 18
- pnpm >= 8
# Install dependencies
pnpm install
# Build all packages
pnpm build
# Run tests
pnpm test
# Start development mode
pnpm dev# Basic example
pnpm run examples:basic
# Or run directly with pnpm
pnpm -F basic-example start
# Knowledge base example
pnpm -F basic-example start:kbCore functionality package providing base services and configuration.
pnpm build- Build all packagespnpm test- Run all testspnpm test:watch- Run tests in watch modepnpm test:coverage- Run tests with coveragepnpm lint- Lint all packagespnpm lint:fix- Fix linting issuespnpm format- Format code with Prettierpnpm typecheck- Run TypeScript type checkingpnpm dev- Start development mode (watch mode + tests)pnpm clean- Clean all build outputs
# Add dependency to a specific package
pnpm -F @xpert-ai/core add lodash
# Add dev dependency to root
pnpm add -D -w prettier
# Add workspace dependency
pnpm -F @xpert-ai/client add @xpert-ai/coreThis project uses Changesets for version management:
# Create a changeset
pnpm changeset
# Bump versions
pnpm bump-version
# Publish pending release versions
pnpm changeset publishThe GitHub Actions release workflow publishes to npm via trusted publishing (OIDC), so it does not require an NPM_TOKEN secret.
- Framework: Vitest
- Coverage: v8 provider
- Config:
vitest.config.ts
Run tests:
pnpm test # Run all tests
pnpm test:watch # Watch mode
pnpm test:coverage # With coverage
pnpm -F @xpert-ai/core test # Package-specific tests- Package Manager: pnpm with workspaces
- Build System: TypeScript with tsc-multi
- Linting: ESLint with TypeScript support
- Formatting: Prettier
- Testing: Vitest
- Version Management: Changesets
- Git Hooks: Husky
Each package follows a consistent structure:
packages/[package-name]/
├── src/ # Source code
├── tests/ # Test files
├── dist/ # Build output (gitignored)
├── package.json # Package configuration
└── tsconfig.json # TypeScript configurationpnpm-workspace.yaml- Workspace configurationtsconfig.json- Root TypeScript configtsc-multi.json- Multi-package build configurationeslint.config.mjs- ESLint configurationvitest.config.ts- Test configuration.prettierrc- Code formatting rules
- ✅ Modern TypeScript - Latest TypeScript with strict configuration
- ✅ Monorepo Structure - Multiple packages with shared tooling
- ✅ Workspace Dependencies - Internal package references with
workspace:^ - ✅ Dual Build Output - Both CommonJS and ESM builds
- ✅ Comprehensive Testing - Unit tests with coverage reporting
- ✅ Code Quality - ESLint, Prettier, and type checking
- ✅ Development Tools - Watch mode, hot reload, and development scripts
- ✅ Version Management - Automated versioning and changelog generation
- ✅ Examples & Documentation - Real usage examples and comprehensive docs
- Development: Use
pnpm devfor watch mode development - Testing: Write tests in
[package]/tests/directories - Building: Run
pnpm buildto compile all packages - Versioning: Use
pnpm changesetto document changes - Publishing: Merge the release PR and let GitHub Actions publish via npm trusted publishing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run
pnpm lintandpnpm test - Create a changeset with
pnpm changeset - Submit a pull request
MIT License - see LICENSE file for details.