Thank you for contributing to Crypto Vision. This guide covers the workflow, standards, and conventions used across the monorepo.
- Getting Started
- Development Environment
- Branch Strategy
- Code Standards
- Commit Conventions
- Testing Requirements
- Pull Request Process
- Package-Specific Guidelines
- Documentation
# Clone the repository
git clone https://github.com/nirholas/crypto-vision.git
cd crypto-vision
# Install root dependencies
npm install
# Copy environment template
cp .env.example .env
# Start development server
npm run devFor package-specific setup, see each package's README under packages/*/README.md.
- Node.js ≥ 22 (required — uses modern APIs)
- npm (package manager)
- Docker (optional — for containerized runs and PostgreSQL/Redis)
- Python 3.11+ (optional — for model training scripts in
packages/ucai)
- TypeScript strict mode is enforced — configure your editor to use the workspace TypeScript version
- ESLint flat config is at
eslint.config.js - Path aliases:
@/*maps tosrc/*
See the root README.md for the full environment variable reference. At minimum:
- No API keys needed for basic development (market data endpoints work without keys)
- At least one LLM API key (
GROQ_API_KEY,GEMINI_API_KEY, etc.) for AI endpoints REDIS_URLfor Redis caching (falls back to in-memory LRU)
main— primary development branch, always deployable- Feature branches — branch from
main, merge via PR - Naming:
feat/description,fix/description,refactor/description,docs/description
- Strict mode — no
anytypes, no@ts-ignore, no type assertions unless documented - Error handling — every async call needs try/catch, every API response needs validation
- Self-documenting code — prefer clear naming over comments; when comments are needed, explain why, not what
- DRY — extract shared logic into helpers, but avoid over-abstraction for single-use cases
- Path aliases — use
@/imports (import { cache } from '@/lib/cache') in root service code
- Source adapters (
src/sources/) — one file per external API, consistent fetch + cache + error handling - Route modules (
src/routes/) — Zod validation, source adapter calls, standardized responses - Middleware — applied globally in
src/index.ts, route-specific middleware in route files
- ESLint is the linter — run
npm run lintbefore committing - Unused variables prefixed with
_are allowed - Prefer
constoverlet, avoidvar - Use template literals over string concatenation
Follow Conventional Commits:
<type>(<scope>): <description>
[optional body]
[optional footer]
| Type | Usage |
|---|---|
feat |
New feature |
fix |
Bug fix |
refactor |
Code restructuring without behavior change |
docs |
Documentation only |
test |
Adding or updating tests |
perf |
Performance improvement |
ci |
CI/CD pipeline changes |
chore |
Maintenance, dependency updates |
| Scope | Area |
|---|---|
api |
Core API routes or middleware |
sources |
Data source adapters |
lib |
Shared library modules |
bot |
Crypto Vision Telegram bot |
workers |
Ingestion/indexing workers |
dashboard |
Dashboard app |
news |
News app |
swarm |
Pump agent swarm package |
mcp |
MCP server packages |
infra |
Infrastructure/deployment |
agents |
Agent definitions |
feat(api): add perps funding rate aggregation endpoint
fix(sources): handle CoinGecko 429 rate limit with exponential backoff
docs(swarm): add pump-agent-swarm README
test(routes): add integration tests for DeFi endpoints
refactor(lib): extract circuit breaker into standalone module
Every PR must pass:
npm run lint # ESLint
npm run typecheck # TypeScript strict compilation
npm test # Vitest unit + integration tests| Directory | Type | Runner |
|---|---|---|
tests/lib/ |
Unit tests for src/lib/ |
npm test |
tests/routes/ |
Route-level tests | npm test |
tests/integration/ |
Multi-route API flows | npm test |
tests/e2e/ |
End-to-end smoke tests | npm run test:e2e |
tests/fuzz/ |
Fuzz testing | npm test |
tests/benchmarks/ |
Performance benchmarks | npm test |
tests/load/ |
Load testing (k6) | Manual |
src/**/__tests__/ |
Co-located unit tests | npm test |
- 50% statement coverage minimum (enforced by vitest config)
- New code should include tests — aim for >80% coverage on new modules
import { describe, it, expect } from 'vitest';
describe('ModuleName', () => {
it('should handle the expected case', () => {
// Arrange
const input = createTestInput();
// Act
const result = processInput(input);
// Assert
expect(result).toEqual(expectedOutput);
});
it('should handle edge cases', () => {
expect(() => processInput(null)).toThrow();
});
});See docs/TESTING.md for the full testing strategy.
- Branch from
mainwith a descriptive name - Implement changes following code standards above
- Test locally:
npm run lint && npm run typecheck && npm test - Commit with conventional commit messages
- Push and open a PR against
main - Description — include:
- What changed and why
- How to test
- Screenshots for UI changes
- Breaking changes (if any)
- Review — address feedback, keep commits clean
- Merge — squash merge preferred for feature branches
- Lint passes (
npm run lint) - Type check passes (
npm run typecheck) - Tests pass (
npm test) - New code has tests
- Documentation updated if API changed
- No secrets or API keys in code
- OpenAPI spec updated if endpoints changed
- Follow the existing route → source → cache pattern
- Add new routes to the mount list in
src/index.ts - Register route in the API directory map
- Add Zod schemas for request validation
- Update
openapi.yamlfor new endpoints
- Follow the EventBus pattern for inter-agent communication
- All agents extend the same initialization pattern
- Trading components integrate with the P&L tracker
- Update barrel exports in subdirectory
index.tsfiles - See
packages/pump-agent-swarm/README.md
- Follow Model Context Protocol specification
- Tools are defined with Zod schemas for parameters
- Each tool should have error handling and input validation
- Follow Next.js conventions
- Each app manages its own dependencies
- See app-specific contributing guides in
apps/*/CONTRIBUTING.md
- New API endpoint → update
openapi.yamlandREADME.mdAPI table - New package → create
packages/{name}/README.md - Architecture change → update
docs/ARCHITECTURE.md - New data source → update
docs/DATA_SOURCES.md - Deployment change → update
docs/DEPLOYMENT.mdandinfra/README.md - New test category → update
docs/TESTING.md
- Use clear, direct language
- Include code examples for non-obvious usage
- Keep docs close to code — prefer co-located READMEs over distant docs
- Use tables for structured information
- Include "getting started" sections in package READMEs
- Check existing docs in
docs/directory - Review
agents/docs/for agent-specific questions - Open an issue for architectural discussions