Skip to content

❄️ nix template for typescript monorepos with bun workspaces +/- astro starlight and flake-parts πŸ’«

License

Notifications You must be signed in to change notification settings

sciexp/typescript-nix-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

typescript-nix-template

TypeScript project template with Nix, Bun workspaces, and semantic-release.

Overview

This is a monorepo workspace containing TypeScript packages managed with Bun workspaces, Nix for development environments, and semantic-release for automated versioning.

Packages

Project structure

typescript-nix-template/
β”œβ”€β”€ packages/
β”‚   └── docs/                    # Astro Starlight documentation site
β”‚       β”œβ”€β”€ src/
β”‚       β”œβ”€β”€ public/
β”‚       β”œβ”€β”€ e2e/
β”‚       β”œβ”€β”€ tests/
β”‚       └── package.json
β”œβ”€β”€ package.json                 # Workspace root configuration
β”œβ”€β”€ tsconfig.json                # Shared TypeScript configuration
β”œβ”€β”€ flake.nix                    # Nix development environment
β”œβ”€β”€ justfile                     # Task runner commands
└── CONTRIBUTING.md              # Contribution guidelines

Getting started

Prerequisites

  • Nix with flakes enabled
  • direnv (recommended)

Setup

# Clone the repository
git clone https://github.com/sciexp/typescript-nix-template.git
cd typescript-nix-template

# Enter Nix development shell
nix develop

# Install dependencies
bun install

Development

Workspace commands

# Install all workspace dependencies
just install

# Clean all build artifacts
just clean

# Run command in specific package
just pkg docs <command>

# Run command in docs (shorthand)
just docs <command>

Package-specific commands

# Start dev server for docs
just dev

# Build docs
just build

# Run tests
just test

# Run unit tests
just test-unit

# Run E2E tests
just test-e2e

Using bun directly

# Run command in specific package
bun run --filter '@typescript-nix-template/docs' dev
bun run --filter '@typescript-nix-template/docs' build
bun run --filter '@typescript-nix-template/docs' test

# Run command in all packages
bun run --filter '@typescript-nix-template/*' test

Testing

Comprehensive testing with Vitest and Playwright:

Command Action
just test Run all tests in all packages
just test-pkg <name> Run tests in specific package
just test-unit Run unit tests in docs
just test-e2e Run E2E tests in docs
just test-watch Run Vitest in watch mode
just test-ui Run Playwright in UI mode
just test-coverage Generate test coverage report

Deployment

Cloudflare Workers

The docs package deploys to Cloudflare Workers:

# Preview locally
just cf-preview

# Deploy preview for branch
just cf-deploy-preview <branch>

# Deploy to production
just cf-deploy-production

Releases

This project uses semantic-release with conventional commits for automated versioning.

Commit format

<type>(<scope>): <subject>

See CONTRIBUTING.md for detailed guidelines.

Testing releases

# Test release for specific package
just test-release docs

# Test release for all packages
just test-release-all

Contributing

See CONTRIBUTING.md for contribution guidelines and conventional commit format.

License

MIT

Releases

No releases published

Packages

No packages published