Thank you for your interest in contributing to TopGun! This document provides guidelines and instructions for contributing.
Before you begin, ensure you have the following installed:
- Node.js >= 18.0.0
- pnpm 10.13.1 or later (package manager)
- Git
npm install -g pnpm@10.13.1Or using corepack:
corepack enable
corepack prepare pnpm@10.13.1 --activategit clone https://github.com/YOUR_USERNAME/topgun.git
cd topgunpnpm installpnpm buildThis builds all packages in the monorepo in the correct order.
topgun/
├── packages/ # Core packages (npm publishable)
│ ├── core/ # @topgunbuild/core - CRDT, types, utilities
│ ├── client/ # @topgunbuild/client - Browser/Node client
│ ├── server/ # @topgunbuild/server - WebSocket server
│ ├── adapters/ # @topgunbuild/adapters - Storage adapters
│ ├── react/ # @topgunbuild/react - React bindings
│ └── adapter-better-auth/ # @topgunbuild/adapter-better-auth
│
├── apps/ # Applications
│ ├── docs-astro/ # Documentation site
│ └── admin-dashboard/
│
├── examples/ # Example applications
│ ├── notes-app/ # PWA notes app with offline sync
│ ├── todo-app/ # Todo app example
│ └── ...
│
└── tests/ # Integration tests
├── e2e/ # End-to-end tests
└── load/ # Load/performance tests
The packages have the following dependency hierarchy:
@topgunbuild/core (no internal deps)
↓
@topgunbuild/client, @topgunbuild/server (depend on core)
↓
@topgunbuild/adapters, @topgunbuild/react (depend on client/server)
Run all package tests:
pnpm testRun tests for a specific package:
pnpm --filter @topgunbuild/core test
pnpm --filter @topgunbuild/client test
pnpm --filter @topgunbuild/server testpnpm test:coverageOr for a specific package:
pnpm --filter @topgunbuild/core test:coveragepnpm test:e2epnpm test:load- Navigate to the package or work from root with filters:
# Build specific package
pnpm --filter @topgunbuild/core build
# Run tests in watch mode (if configured)
pnpm --filter @topgunbuild/core test- If your changes affect dependent packages, rebuild them:
pnpm buildStart the development server:
pnpm start:serverRun an example app:
cd examples/todo-app
pnpm install
pnpm dev-
Create a feature branch from
main:git checkout -b feature/your-feature-name
-
Make your changes following the code style guidelines
-
Write/update tests for your changes
-
Run the full test suite:
pnpm test -
Build all packages to ensure no TypeScript errors:
pnpm build
- Clear, descriptive title
- Description of what changes were made and why
- Reference any related issues (e.g., "Fixes #123")
- All tests pass
- No TypeScript errors
- New features include tests
Use clear, descriptive commit messages:
feat(core): add new CRDT merge strategy
fix(client): resolve sync race condition
docs: update API documentation
test(server): add cluster integration tests
chore: update dependencies
Format: type(scope): description
Types: feat, fix, docs, test, chore, refactor, perf
- Use TypeScript for all source code
- Enable strict mode
- Prefer explicit types over
any - Use interfaces for object shapes
- Export types alongside implementations
- Keep functions small and focused
- Write self-documenting code with clear naming
- Add comments for complex logic
- Follow existing patterns in the codebase
All packages use tsup for building. Each package outputs:
- CommonJS (
dist/index.js) - ESM (
dist/index.mjs) - Type declarations (
dist/index.d.ts)
- GitHub Issues: For bug reports and feature requests
- Discussions: For questions and general discussion
By contributing to TopGun, you agree that your contributions will be licensed under the BSL-1.1 license.