mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-18 11:02:54 +00:00
- Add table of contents for easier navigation - Add Prerequisites section with required tools and versions (Go 1.26+, Rust 1.94+, Node.js 22+, etc.) - Add detailed Setup section with database setup and build instructions - Add Project Structure section documenting repository layout - Expand Development Workflow with linting, formatting, and testing steps - Add detailed Code Style sections for Go, Rust, and Type
8.0 KiB
8.0 KiB
Contributing to TaaS Platform
Thank you for your interest in contributing to the TaaS Platform! This document provides guidelines for contributing to the project.
Table of Contents
- Getting Started
- Project Structure
- Development Workflow
- Code Style
- Testing
- Commit Message Format
- Pull Request Process
- CI/CD
- Release Process
- Reporting Issues
- License
Getting Started
Prerequisites
- Go 1.26+: Download
- Rust 1.94+:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh - Node.js 22+: Download
- pnpm:
npm install -g pnpm - Docker: Install
- PostgreSQL 15+: Install
- Redis: Install
- Kubernetes: Install (for production deployment)
- Helm 3+: Install (for production deployment)
- MongoDB 7.0+: Install (required for free5GC only)
Setup
- Fork the repository
- Clone your fork:
git clone https://github.com/nutcas3/telecom-platform.git cd telecom-platform - Install dependencies:
make install-deps - Set up databases:
make db-setup make db-migrate - Build all components:
make all
Project Structure
telecom-platform/
├── apps/
│ ├── api-server/ # Go BSS API server
│ ├── carrier-connector/ # Go ES2+ carrier integration
│ ├── charging-engine/ # Rust real-time charging
│ ├── packet-gateway/ # Rust eBPF packet processing
│ ├── cli/ # Go CLI tool
│ └── web-dashboard/ # Next.js management UI
├── sdk/
│ └── typescript/ # TypeScript SDK
├── deployments/
│ ├── docker/ # Dockerfiles
│ ├── kubernetes/ # K8s manifests
│ ├── helm/ # Helm charts
│ └── free5gc/ # 5G core network config
├── monitoring/ # Prometheus/Grafana configs
└── scripts/ # Setup and utility scripts
Development Workflow
-
Create a feature branch:
git checkout -b feature/your-feature-name -
Make your changes:
- Write clear, documented code
- Follow language-specific style guides
- Add tests for new functionality
- Update documentation as needed
-
Run linters:
make lint -
Run tests:
make test -
Format code:
make fmt -
Commit your changes:
git add . git commit -m "feat: add new feature" -
Push to your fork:
git push origin feature/your-feature-name -
Create a Pull Request
Code Style
Go
- Follow Effective Go
- Use
gofmtfor formatting:make fmt-go - Run
golangci-lintbefore committing:make lint-go - Use descriptive variable and function names
- Add godoc comments for exported functions
- Handle errors explicitly, don't ignore them
Rust
- Follow Rust API Guidelines
- Use
cargo fmtfor formatting:cargo fmt - Run
cargo clippybefore committing:make lint-rust - Use
Result<T, E>for error handling - Prefer
unwrap()only in tests - Document unsafe blocks with safety comments
TypeScript
- Follow Airbnb Style Guide
- Use Prettier for formatting:
make lint-ui - Use ESLint for linting
- Use TypeScript strict mode
- Prefer functional programming patterns
- Add JSDoc comments for public APIs
Testing
Testing Strategy
- Unit Tests: Test individual functions and methods in isolation
- Integration Tests: Test service interactions with real dependencies
- End-to-End Tests: Test complete workflows across services
- Race Detection: Use
-raceflag for Go tests to detect data races
Running Tests
# Run all tests
make test
# Run Go tests with race detection
make test-go
# Run Rust tests in release mode
make test-rust-release
# Run TypeScript tests
pnpm -r test
Test Coverage
- Aim for >80% code coverage on new code
- Run coverage reports before submitting PRs
- Add tests for bug fixes to prevent regressions
Commit Message Format
We use Conventional Commits:
<type>(<scope>): <subject>
<body>
<footer>
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasksperf: Performance improvementsci: CI/CD changes
Scopes:
api: API server changescharging: Charging engine changesgateway: Packet gateway changesconnector: Carrier connector changescli: CLI tool changesdashboard: Web dashboard changessdk: TypeScript SDK changesinfra: Infrastructure changesdocs: Documentation changes
Examples:
feat(api): add eSIM deletion endpoint
fix(charging): correct credit deduction logic
docs: update deployment guide
perf(gateway): optimize eBPF packet processing
ci: add race detection to tests
Pull Request Process
- Update documentation if needed
- Add tests for your changes
- Ensure all tests pass:
make test - Run linters:
make lint - Format code:
make fmt - Update CHANGELOG.md with your changes
- Request review from maintainers
- Address review feedback promptly
- Wait for approval and merge
PR Checklist
- Code follows project style guidelines
- Tests added/updated and passing
- Documentation updated
- CHANGELOG.md updated
- No merge conflicts
- Commit messages follow conventional commits
CI/CD
GitHub Actions
The project uses GitHub Actions for:
- Linting: golangci-lint, clippy, ESLint
- Testing: Go tests with race detection, Rust tests, TypeScript tests
- Building: Docker images for all services
- Security: Trivy vulnerability scanning
Branch Protection
mainanddevelopbranches are protected- PRs require at least one approval
- CI must pass before merging
- No direct pushes to protected branches
Release Process
- Update version numbers in relevant files
- Update CHANGELOG.md with release notes
- Create release branch:
git checkout -b release/v1.0.0 - Run full test suite:
make test - Build Docker images:
make docker-build - Tag release:
git tag -a v1.0.0 -m "Release v1.0.0" - Push tag:
git push origin v1.0.0 - Create GitHub release with notes
- Deploy to production:
make k8s-deploy-helm
Reporting Issues
When reporting bugs or requesting features:
- Use GitHub Issues with appropriate templates
- Provide clear description of the problem
- Include reproduction steps
- Add relevant logs or screenshots
- Specify environment details:
- OS and version
- Go/Rust/Node.js versions
- Database versions
- Kubernetes version (if applicable)
Code Review
We review all contributions. Expect:
- Feedback on code quality and best practices
- Suggestions for improvements and optimizations
- Questions about implementation decisions
- Requests for tests or documentation
- Security considerations for sensitive code
Security
- Report security vulnerabilities privately to maintainers
- Never commit secrets, API keys, or passwords
- Use Vault for secret management in production
- Follow OWASP guidelines for security best practices
License
By contributing, you agree that your contributions will be licensed under the MIT License.