Welcome Contributors!
We welcome contributions to Opinix Trade! Whether you’re fixing bugs, adding features, improving documentation, or suggesting ideas, your help is appreciated.This project is a real-time opinion trading platform where users can place bets on different events, similar to prediction markets.
Getting Started
Fork the repository
Fork Opinix Trade on GitHub to your account.
Set up development environment
Follow the Development Setup guide to configure your local environment.
Quick setup commands
Quick setup commands
Development Workflow
- Making Changes
- Commit Guidelines
- Pull Requests
Code Style Guidelines
TypeScript
TypeScript
General Rules:
- Use TypeScript for all new code
- Avoid
anytype - use proper types - Use interfaces for object shapes
- Export types when shared across files
Naming Conventions
Naming Conventions
Variables & Functions:Classes & Interfaces:Constants:
- Use camelCase
- Descriptive names
- Boolean variables start with
is,has,should
- Use PascalCase
- Interfaces don’t need
Iprefix
- Use UPPER_SNAKE_CASE for true constants
File Organization
File Organization
File naming:
- Use kebab-case for files:
order-matching.ts - Use PascalCase for component files:
OrderBook.tsx
Error Handling
Error Handling
Always handle errors properly:
Async/Await
Async/Await
Prefer async/await over promises:
Areas to Contribute
Core Features
- Portfolio management improvements
- Advanced order types (stop-loss, etc.)
- Social features (leaderboards, etc.)
- Analytics dashboard
Performance
- Order matching optimization
- Database query optimization
- Caching improvements
- WebSocket efficiency
Testing
- Unit tests
- Integration tests
- E2E tests
- Load testing
Documentation
- API documentation
- Architecture guides
- Tutorial content
- Code comments
UI/UX
- Design improvements
- Mobile responsiveness
- Accessibility
- Dark mode enhancements
DevOps
- CI/CD improvements
- Docker optimization
- Monitoring setup
- Deployment automation
Project Architecture
System Architecture
System Architecture
Understanding the architecture helps you contribute effectively:Flow:
- Client - User places order via Next.js frontend
- Backend (Server) - Validates and accepts order
- Queue - Order added to Redis queue (BullMQ)
- Worker (Engine) - Processes order from queue
- Matching Logic - Updates order book with matching
- WebSocket - Broadcasts updates to all clients
- Database - Persists state to PostgreSQL
- Order Book: In-memory structure for fast matching
- Queue: Asynchronous order processing
- WebSocket: Real-time updates
- Database: Source of truth for all data
Monorepo Structure
apps/ - Applications
apps/ - Applications
client/ - Next.js frontend
- React components
- NextAuth authentication
- Real-time WebSocket integration
- TanStack Query for data fetching
- REST endpoints
- JWT authentication
- Order management
- Event management
packages/ - Shared Packages
packages/ - Shared Packages
services/ - Background Services
services/ - Background Services
engine/ - Order matching engine
- Core matching algorithm
- Order book management
- Price calculation
- Real-time connections
- Message broadcasting
- Redis pub/sub
Testing
- Writing Tests
- Running Tests
Add tests for new features:
Database Changes
When modifying the database schema:Getting Help
GitHub Issues
Browse existing issues or create a new one
Discussions
Ask questions and discuss ideas
Documentation
Read the full documentation
Code of Conduct
Be respectful and inclusive
Recognition
All contributors are recognized in:- README.md contributors section
- GitHub contributor graph
- Release notes for significant contributions
We value all contributions, no matter how small. Every improvement helps make Opinix Trade better!