Contributing Guide
Thank you for your interest in contributing to TypoKit! This guide covers everything you need to set up your development environment, understand the codebase, and submit high-quality contributions.
Prerequisites
Section titled “Prerequisites”Before you begin, make sure you have the following installed:
| Tool | Version | Purpose |
|---|---|---|
| Node.js | 24+ | Runtime for all packages |
| pnpm | Latest | Package manager (monorepo workspaces) |
| Git | Latest | Version control |
| Rust toolchain | Latest stable | Only needed for transform-native or plugin-axum development |
Getting Started
Section titled “Getting Started”-
Fork and clone the repository
Terminal window git clone https://github.com/<your-username>/typokit.gitcd typokit -
Install dependencies
Terminal window pnpm installThis installs all workspace dependencies and links local packages together.
-
Build all packages
Terminal window pnpm buildThis runs
nx run-many --target=build, which builds all packages in dependency order using Nx. -
Run the test suite
Terminal window pnpm testThis runs
nx run-many --target=testacross all packages. Tests use therstestrunner. -
Verify everything passes
Terminal window pnpm typecheckpnpm lint
Monorepo Structure
Section titled “Monorepo Structure”TypoKit is organized as a pnpm monorepo with Nx for build orchestration. All packages live under packages/ and are published as @typokit/*.
Core Framework
Section titled “Core Framework”| Package | Description |
|---|---|
@typokit/core | Central framework — router, handler execution, middleware pipeline |
@typokit/types | Shared TypeScript type definitions and interfaces |
@typokit/errors | Structured error types and error handling utilities |
@typokit/cli | Command-line interface for scaffolding and development |
Build-Time Transforms
Section titled “Build-Time Transforms”| Package | Description |
|---|---|
@typokit/transform-native | Rust-based native transform (SWC, NAPI bindings) |
@typokit/transform-typia | Typia-based runtime type transformations |
Server Adapters
Section titled “Server Adapters”| Package | Description |
|---|---|
@typokit/server-native | Built-in native HTTP server |
@typokit/server-express | Express.js adapter |
@typokit/server-fastify | Fastify adapter |
@typokit/server-hono | Hono framework adapter |
Platform Adapters
Section titled “Platform Adapters”| Package | Description |
|---|---|
@typokit/platform-node | Node.js runtime support |
@typokit/platform-bun | Bun runtime support |
@typokit/platform-deno | Deno runtime support |
Database Adapters
Section titled “Database Adapters”| Package | Description |
|---|---|
@typokit/db-drizzle | Drizzle ORM adapter |
@typokit/db-kysely | Kysely query builder adapter |
@typokit/db-prisma | Prisma ORM adapter |
@typokit/db-raw | Raw SQL queries adapter |
Client Libraries
Section titled “Client Libraries”| Package | Description |
|---|---|
@typokit/client | Base type-safe HTTP client |
@typokit/client-react-query | React Query integration |
@typokit/client-swr | SWR (stale-while-revalidate) integration |
Plugins & Utilities
Section titled “Plugins & Utilities”| Package | Description |
|---|---|
@typokit/plugin-debug | Debug and inspection plugin |
@typokit/plugin-ws | WebSocket support plugin |
@typokit/otel | OpenTelemetry observability integration |
@typokit/testing | Testing utilities and helpers |
Tooling
Section titled “Tooling”| Package | Description |
|---|---|
@typokit/nx | Nx plugin with custom executors and generators |
@typokit/turbo | Turbo integration |
@typokit/docs | Documentation site (Astro Starlight) |
Nx Workspace Targets
Section titled “Nx Workspace Targets”Nx manages all build tasks with dependency-aware execution. The key targets are:
| Target | Command | Description |
|---|---|---|
build | tsc -p tsconfig.json | Compile TypeScript to JavaScript |
test | rstest run --passWithNoTests | Run tests with rstest |
lint | eslint src/ | Lint source files with ESLint |
typecheck | tsc --noEmit -p tsconfig.json | Type-check without emitting |
Running targets for a specific package
Section titled “Running targets for a specific package”# Build a single packagepnpm nx build core
# Test a single packagepnpm nx test server-express
# Run all targetspnpm nx run-many --target=buildpnpm nx run-many --target=testDependency graph
Section titled “Dependency graph”You can visualize the package dependency graph:
pnpm nx graphWorking on the Rust Native Transform
Section titled “Working on the Rust Native Transform”The packages/transform-native/ package contains a Rust crate that compiles to a Node.js native addon via NAPI-RS.
Prerequisites
Section titled “Prerequisites”Install the Rust toolchain via rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shBuilding
Section titled “Building”cd packages/transform-nativepnpm build:nativecd packages/transform-nativepnpm build:native:releaseThe build produces an index.node binary using @napi-rs/cli. The crate uses SWC for parsing and supports multiple platforms (Windows x64, macOS x64/ARM64, Linux GNU/musl).
Making Changes
Section titled “Making Changes”Development workflow
Section titled “Development workflow”-
Create a feature branch
Terminal window git checkout -b feat/my-feature -
Make your changes — keep changes focused on a single concern.
-
Run quality checks before committing
Terminal window pnpm typecheck && pnpm lint && pnpm test -
Commit with a descriptive message
Follow Conventional Commits:
Terminal window git commit -m "feat(core): add middleware chaining support"Common prefixes:
feat:,fix:,docs:,refactor:,test:,chore: -
Push and open a pull request
Terminal window git push origin feat/my-feature
Code style
Section titled “Code style”- All packages use ESM modules (
"type": "module") - TypeScript strict mode is enabled
- Follow existing patterns in the package you’re modifying
- Run
pnpm lintto check for style issues
Pull Request Process
Section titled “Pull Request Process”- Ensure CI passes — the CI pipeline runs
build,typecheck,lint, andtestacross all affected packages. - Keep PRs focused — one logical change per PR makes review easier.
- Update documentation if your change affects public APIs or behavior.
- Add tests for new functionality or bug fixes.
- Respond to review feedback promptly — reviewers may request changes before merging.
CI Checks
Section titled “CI Checks”The CI pipeline validates every pull request with the following checks:
- Build — all packages compile successfully
- Typecheck — no TypeScript errors
- Lint — ESLint passes on all source files
- Test — all test suites pass
All checks must pass before a PR can be merged.
Further Reading
Section titled “Further Reading”- Architecture Overview — understand how TypoKit’s packages fit together
- Build Pipeline — deep dive into the build process
- Project Structure — how TypoKit projects are organized