Thank you for your interest in contributing to Chive!
- Node.js 22+
- pnpm 8+
- Docker and Docker Compose
- Fork and clone the repository
- Install dependencies:
pnpm install - Start the test database stack:
./scripts/start-test-stack.sh - Initialize databases:
pnpm db:init - Start the development server:
pnpm dev - Create a feature branch:
git checkout -b feature/my-feature - Make your changes
- Run tests:
pnpm test - Run linters:
pnpm lint - Commit your changes (see commit conventions below)
- Push and create a pull request
Commit messages must be exactly one sentence in the imperative mood:
- Good: "Add search functionality to homepage"
- Good: "Fix authentication bug in login flow"
- Bad: "Added search" (past tense)
- Bad: "Adds search" (third person)
- Bad: "Adding search functionality" (gerund)
Keep commit messages concise and focused on what the change does.
- TypeScript strict mode enabled
- ESLint + Prettier enforced via pre-commit hooks
- TSDoc comments for all public APIs (not JSDoc)
- Active voice preferred in documentation
- No em-dashes in documentation
Frontend API types are auto-generated from the backend OpenAPI specification using openapi-typescript. This ensures type safety between frontend and backend.
- Make API changes in backend handlers (e.g., add/modify endpoints in
src/api/) - Start the dev server to expose the updated OpenAPI spec:
pnpm dev
- Regenerate types from the running server:
pnpm openapi:generate
- Verify the changes:
pnpm typecheck
web/lib/api/
├── schema.generated.ts # Auto-generated (DO NOT EDIT)
├── schema.d.ts # Domain types (manually maintained)
├── client.ts # API client using generated paths
└── query-client.ts # TanStack Query client
- Never edit
schema.generated.ts: it is overwritten on regeneration - Domain types (Eprint, Author, Review, etc.) are in
schema.d.ts - API paths are auto-generated from OpenAPI spec
- Run
pnpm openapi:generateafter any backend API changes - The OpenAPI spec is available at
http://localhost:3001/openapi.jsonwhen the dev server is running - Interactive API docs are at
http://localhost:3001/docs
- Unit tests for all business logic
- Integration tests for service interactions
- E2E tests for critical user flows
- ATProto compliance tests must pass 100%
pnpm test # Run all tests
pnpm test:unit # Unit tests only
pnpm test:e2e # End-to-end tests
pnpm test:compliance # ATProto compliance tests
pnpm test:coverage # Generate coverage report- Backend: 80% line coverage (100% for critical paths: indexing, auth, sync, validation, compliance)
- Frontend: 70% line/component coverage
All contributions must maintain ATProto compliance:
- Read from firehose (relay WebSocket stream)
- Store BlobRefs (CID pointers), NEVER blob data
- All indexes must be rebuildable from firehose
- Track PDS source for staleness detection
- NEVER write to user PDSes
- NEVER store user data as source of truth
- NEVER upload blobs to Chive storage
Run compliance checks:
pnpm test:compliance# Create a new migration
pnpm db:migrate:create migration_name
# Run migrations
pnpm db:migrate:up
# Rollback migrations
pnpm db:migrate:down- Update documentation for any API changes
- Add tests for new features
- Ensure all tests pass
- Ensure compliance tests pass (100% required)
- Request review from maintainers
- PRs should be focused and atomic
- Include clear description of changes
- Reference related issues
- Respond to feedback promptly
- Open an issue for bugs or feature requests
- Use GitHub Discussions for questions
- Email: admin@chive.pub
By contributing, you agree that your contributions will be licensed under the MIT License.