A sophisticated multi-language microservices application built with Go, Python, Ruby, and TypeScript that provides comprehensive code analysis, review, and metrics calculation.
This project consists of four microservices:
- Go Service (
go-service/) - Fast code parsing, diff analysis, and metrics calculation - Python Service (
python-service/) - AI-powered code review with pattern detection and quality scoring - Ruby Service (
ruby-service/) - Web API aggregator that orchestrates the other services - JS/TS Service (
js-service/) - API Gateway with request routing, rate limiting, and service health monitoring
- Code Parsing: Multi-language file parsing with language detection
- Diff Analysis: Intelligent diff calculation between code versions
- Code Metrics: Lines of code, complexity, functions, classes analysis
- Code Review: Automated code review with issue detection
- Quality Scoring: Overall code quality scoring based on multiple factors
- RESTful APIs: Clean REST APIs for all services
- CI/CD: Complete GitHub Actions workflows for all languages
polyglot-codebase/
├── go-service/ # Go microservice
│ ├── cmd/ # Application entry point
│ ├── internal/ # Internal packages
│ ├── api/ # HTTP handlers
│ └── go.mod # Go dependencies
├── python-service/ # Python microservice
│ ├── src/ # Source code
│ ├── tests/ # Test files
│ └── requirements.txt
├── ruby-service/ # Ruby microservice
│ ├── app/ # Application code
│ ├── spec/ # RSpec tests
│ └── Gemfile
├── js-service/ # TypeScript API Gateway
│ ├── src/ # TypeScript source code
│ ├── package.json # Node.js dependencies
│ └── tsconfig.json # TypeScript configuration
├── .github/workflows/ # CI/CD pipelines
└── docker-compose.yml # Docker orchestration
- Go 1.21+
- Python 3.10+
- Ruby 3.2+
- Node.js 20+ and npm
- Docker and Docker Compose (optional)
- Clone and setup:
cd polyglot-codebase
make build- Run all services:
make run-all- Run tests:
make test- Run linters:
make lintdocker-compose up --buildGET /health- Health checkPOST /parse- Parse code filePOST /diff- Analyze code differencesPOST /metrics- Calculate code metrics
GET /health- Health checkPOST /review- Review code qualityPOST /review/function- Review specific function
GET /health- Health checkGET /status- Status of all servicesPOST /analyze- Full code analysis (aggregates Go + Python)POST /diff- Diff analysis with reviewPOST /metrics- Metrics with quality score
GET /- API Gateway information and available endpointsGET /health/health- Gateway health checkGET /health/status- Status of all microservicesGET /api/go/*- Proxy requests to Go serviceGET /api/python/*- Proxy requests to Python serviceGET /api/ruby/*- Proxy requests to Ruby service
curl -X POST http://localhost:8082/analyze \
-H "Content-Type: application/json" \
-d '{
"content": "def hello():\n print(\"Hello, World!\")",
"path": "hello.py"
}'curl -X POST http://localhost:8082/metrics \
-H "Content-Type: application/json" \
-d '{
"content": "package main\n\nfunc main() {\n println(\"Hello\")\n}"
}'The project includes comprehensive CI workflows:
- Go CI: Tests, builds, lints with golangci-lint
- Python CI: Tests with pytest, linting with flake8/black/mypy
- Ruby CI: Tests with RSpec, linting with RuboCop
- Integration Tests: End-to-end service integration tests
All workflows run on push and pull requests.
cd go-service
go test -v ./...cd python-service
pytest tests/ -vcd ruby-service
bundle exec rspec spec/- Go Service: Add new parsing logic in
internal/parser/ - Python Service: Extend review rules in
src/code_reviewer.py - Ruby Service: Add new endpoints in
app/app.rb
- Go: Follow standard Go conventions, use
golangci-lint - Python: Follow PEP 8, use
blackfor formatting - Ruby: Follow Ruby style guide, use
rubocop - TypeScript: Follow TypeScript best practices, use
eslintfor linting
MIT License - feel free to use this project for learning and development.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Ensure all CI checks pass
- Submit a pull request