Contributing
Welcome to CORTEX! This guide helps you get started with contributing to the project.
Getting Started
Prerequisites
- Node.js 20+
- pnpm 8+
- Docker & Docker Compose
- Git
Setup
# Clone the repository
git clone https://dev.azure.com/cortex/cortex-platform/_git/cortex-platform
cd cortex-platform
# Install dependencies
pnpm install
# Start infrastructure
docker-compose -f infra/docker/docker-compose.yml up -d
# Setup database
cd apps/core
pnpm db:migrate
pnpm db:seed
# Start development
pnpm dev
Development Workflow
1. Create a Branch
# Feature branch
git checkout -b feature/add-user-export
# Bug fix branch
git checkout -b fix/login-rate-limit
# Hotfix branch
git checkout -b hotfix/security-patch
2. Make Changes
- Write code following the code style guide
- Add tests for new functionality
- Update documentation if needed
3. Run Checks
# Lint code
pnpm lint
# Run tests
pnpm test
# Build
pnpm build
4. Commit Changes
Follow Conventional Commits:
# Format
type(scope): description
# Examples
feat(auth): add MFA support
fix(users): correct pagination offset
docs(api): update endpoint documentation
test(rbac): add permission inheritance tests
5. Create Pull Request
- Create PR against
developbranch - Fill out the PR template
- Request reviews from team members
- Address feedback
Code Review Guidelines
For Authors
- Keep PRs focused and small (< 400 lines preferred)
- Write a clear description of changes
- Include screenshots for UI changes
- Respond to feedback promptly
For Reviewers
- Be constructive and specific
- Approve when satisfied, request changes if needed
- Consider:
- Does the code work?
- Is it well-tested?
- Is it maintainable?
- Does it follow conventions?
Project Structure
cortex-platform/
├── apps/
│ ├── core/ # Backend API (NestJS)
│ ├── cortex-web/ # Frontend (Next.js)
│ └── docs/ # Documentation
├── packages/ # Shared packages
├── infra/ # Infrastructure
└── pipelines/ # CI/CD
Testing
Running Tests
# All tests
pnpm test
# Specific package
pnpm --filter core test
# Watch mode
pnpm --filter core test:watch
# Coverage
pnpm --filter core test:cov
Writing Tests
describe('UserService', () => {
let service: UserService;
beforeEach(async () => {
const module = await Test.createTestingModule({
providers: [UserService],
}).compile();
service = module.get(UserService);
});
it('should create user', async () => {
const user = await service.create(createUserDto);
expect(user.email).toBe(createUserDto.email);
});
});
Documentation
Updating Docs
- Navigate to
apps/docs - Edit markdown files in
docs/ - Preview with
pnpm start - Submit PR with changes
Documentation Standards
- Use clear, concise language
- Include code examples
- Keep examples up-to-date with code
- Use proper markdown formatting
Getting Help
- Check existing issues and PRs
- Ask in team chat channels
- Review the documentation
- Contact maintainers
License
CORTEX is proprietary software. See LICENSE file for details.