Thank you for your interest in contributing to Vatix! This guide will help you get started.
- Getting Started
- Finding Issues to Work On
- Development Workflow
- Code Guidelines
- Testing Requirements
- Submitting a Pull Request
- Database Changes
- Getting Help
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/vatix-backend.git
cd vatix-backend- Set up the project following the README
- Create a branch for your work:
git checkout -b feature/your-feature-nameBrowse open issues and look for:
- Complexity tags: Easy, Medium, Hard
- Labels:
good first issue,help wanted,bug,feature - Dependencies: Check if the issue depends on others being completed first
Before starting work:
- Comment on the issue saying you'd like to work on it
- Wait for a maintainer to assign it to you
- Ask questions if anything is unclear
# Install dependencies
pnpm install
# Start database and Redis
docker compose up -d
# Generate Prisma Client (if schema exists)
pnpm prisma:generate
# Run migrations (if migrations exist)
pnpm prisma:migrate
# Start dev server
pnpm dev- Write clean, readable code
- Follow the existing code structure
- Add comments for complex logic
- Keep functions small and focused
Every feature must include tests. Add test files next to your implementation:
src/
├── services/
│ ├── database.ts
│ └── database.test.ts ← Test file
Run tests frequently:
pnpm testUse clear, descriptive commit messages:
# Good commits
git commit -m "feat: add order validation logic"
git commit -m "fix: handle null values in position calculation"
git commit -m "test: add tests for order matching engine"
# Bad commits
git commit -m "update stuff"
git commit -m "fixes"Commit message format:
feat:- New featurefix:- Bug fixtest:- Adding testsdocs:- Documentation changesrefactor:- Code refactoringchore:- Maintenance tasks
- Use strict typing - Avoid
any - Define interfaces for function parameters and return values
- Export types from
src/types/index.tsfor reuse
// Good
interface CreateOrderParams {
marketId: string;
side: OrderSide;
price: number;
}
async function createOrder(params: CreateOrderParams): Promise<Order> {
// ...
}
// Bad
async function createOrder(marketId: any, side: any, price: any): Promise<any> {
// ...
}- Use meaningful variable names
// Good
const activeMarkets = await getActiveMarkets();
// Bad
const x = await getActiveMarkets();- Keep functions small - One function should do one thing
- Avoid deep nesting - Extract nested logic into separate functions
- Add comments for complex logic - But prefer self-documenting code
- One main export per file
- Related functions in the same file
- Test files next to implementation files
- Group related functionality in directories
src/matching/
├── engine.ts # Main matching engine
├── engine.test.ts # Engine tests
├── orderbook.ts # Order book data structure
├── orderbook.test.ts # Order book tests
└── validation.ts # Order validation
- Happy paths - Normal, expected behavior
- Edge cases - Boundary conditions, empty inputs
- Error cases - Invalid inputs, database errors
- Integration - Multiple components working together
import { describe, it, expect, beforeEach } from "vitest";
describe("Order Validation", () => {
beforeEach(() => {
// Setup before each test
});
it("should accept valid orders", () => {
const order = { price: 0.5, quantity: 100 };
expect(validateOrder(order)).toBe(true);
});
it("should reject orders with invalid price", () => {
const order = { price: 1.5, quantity: 100 };
expect(() => validateOrder(order)).toThrow();
});
});# Run all tests
pnpm test
# Run specific test file
pnpm test src/matching/engine.test.ts
# Run with UI
pnpm test:ui
# Run with coverage
pnpm test:coverageAll tests must pass before submitting a PR.
- All tests pass (
pnpm test) - Code follows style guidelines
- Added tests for new functionality
- Updated documentation if needed
- No console.logs or debug code
- Prisma Client regenerated if schema changed (
pnpm prisma:generate)
## Description
Brief description of what this PR does
## Related Issue
Closes #123
## Changes Made
- Added order validation logic
- Created validation tests
- Updated error handling
## Testing
- [ ] Unit tests added
- [ ] Integration tests added
- [ ] Manual testing completed- Push your branch to your fork
- Create a Pull Request on GitHub
- Link the related issue in the PR description
- Wait for review from maintainers
- Address feedback if requested
- Merge once approved!
- Edit
prisma/schema.prisma:
model Market {
id String @id @default(uuid())
question String
endTime DateTime
status MarketStatus
// ... other fields
}- Create migration:
pnpm prisma:migrate dev --name add_market_table- Generate Prisma Client:
pnpm prisma:generate- Test the changes:
pnpm test- Name migrations descriptively:
add_orders_table,add_status_index - Never edit existing migrations
- Test migrations with both
upanddown - Include migration in your PR
- Comment on the issue you're working on
Don't spend hours stuck! Ask for help early:
- Describe what you're trying to do
- Share what you've tried
- Include error messages
- Provide code snippets
- Reviews help improve code quality
- Don't take feedback personally
- Ask questions if feedback is unclear
- Make requested changes promptly
Contributors are recognized in:
- GitHub contributor list
- Project README (for significant contributions)
- Release notes
Thank you for contributing to Vatix!