This project implements a modular, independent, and scalable microservices architecture based on Hexagonal Architecture (Ports & Adapters). The goal is to separate business logic from infrastructure dependencies, making the system more flexible, testable, and maintainable.
β
Deno β A fast, secure runtime for JavaScript and TypeScript
β
Oak β A web framework for Deno, similar to Express.js
β
Deno KV or MySQL β For data storage
β
RabbitMQ or NATS β For inter-service communication
β
Deno Deploy or Docker β For deployment
This project follows Hexagonal Architecture, which includes:
- Core (Business Logic) β Contains the core domain logic without dependencies on frameworks or databases
- Ports β Interfaces for interacting with external services
- Adapters β Implementations of ports that connect to databases and messaging systems
π¦ src
β£ π core # Business logic and domain models
β£ π ports # Input and output interfaces
β£ π adapters # Adapters for database and external services
β£ π services # Independent microservices
β£ π infra # Infrastructure settings like messaging and database
β£ π api # API controllers for service communication
β π main.ts # Application entry point
Install Deno and verify the installation:
deno --version
deno run -A src/main.ts
docker build -t my-microservice .
docker run -p 3000:3000 my-microservice
Microservices communicate via RabbitMQ or NATS. To run RabbitMQ with Docker:
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:management
To deploy on Deno Deploy:
deno deploy
Or using Docker Compose:
version: '3'
services:
app:
build: .
ports:
- "3000:3000"
depends_on:
- database
database:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mydb
Run with:
docker-compose up -d
This project demonstrates a modern and scalable microservices architecture using Deno and Hexagonal Architecture. The design ensures independent services, high testability, easy scalability, and flexible deployment. π