A distributed scientific calculator where each operation is implemented as a microservice in a different programming language.
This project implements a scientific calculator with each operation handled by an independent microservice written in a different programming language:
- Addition: Rust
- Subtraction: Go
- Multiplication: Python
- Division: Ruby
- Power: Java
- Square Root: F#
- Logarithm: PHP
- Trigonometry: Kotlin
- Memory Operations: C#
- Combinatorics/Factorial: Elixir
- Unit Conversion: TypeScript
- Matrix Operations: Julia
- Bitwise Operations: Swift
- Complex Numbers: Clojure
- API Gateway: Node.js
- Frontend: React
- Port: 8001
- Operations: a + b
- Port: 8002
- Operations: a - b
- Port: 8003
- Operations: a * b
- Port: 8004
- Operations: a / b
- Port: 8005
- Operations: a^b, a^2, a^3
- Port: 8006
- Operations: √a
- Port: 8007
- Operations: log(a), ln(a), log10(a)
- Port: 8008
- Operations: sin(a), cos(a), tan(a), etc.
- Port: 8009
- Operations: M+, M-, MR, MC
- Port: 8010
- Operations: factorial(n), permutation(n,r), combination(n,r)
- Port: 8012
- Operations: temperature(value, from, to), length(value, from, to), weight(value, from, to)
- Port: 8014
- Operations: matrix-add, matrix-multiply, matrix-determinant, matrix-inverse
- Port: 8016
- Operations: and, or, xor, not, left-shift, right-shift
- Port: 8017
- Operations: complex-add, complex-subtract, complex-multiply, complex-divide, complex-magnitude, complex-conjugate
- Port: 8000
- Routes requests to appropriate service
- Combines responses
- Port: 3001
- User interface for calculator
- Sends requests to API Gateway
- Docker and Docker Compose
# Build and start all services
docker-compose up --build
# Access the calculator web interface
open http://localhost:3001Each service exposes a REST API with JSON input/output. For example:
- Addition:
POST /addwith body{"a": 5, "b": 3}returns{"result": 8} - Subtraction:
POST /subtractwith body{"a": 5, "b": 3}returns{"result": 2} - And so on...
The API Gateway exposes a unified API at http://localhost:8000/calculate that routes operations to the appropriate service.
To add a new operation:
- Create a new service directory
- Implement the operation in a language of your choice
- Add the service to the docker-compose.yml file
- Update the API Gateway to route to the new service