Backend Development 3 min read

OOX: A Simple and Fast Node.js Microservice Framework

OOX is a Node.js‑based microservice solution that removes the need for route definitions and configuration files, supports both HTTP and Socket.IO, provides example code for calculator services, and includes recent updates such as AsyncLocalStorage tracing and Socket.IO 4.4.0.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
OOX: A Simple and Fast Node.js Microservice Framework

OOX is a Node.js‑based microservice framework that eliminates the need for explicit route definitions and configuration files, allowing remote services to be invoked like local functions, and can also run as a traditional single‑instance application when microservice mode is not required.

The framework keeps the service port unchanged while supporting both HTTP and Socket.IO, meeting typical web API needs as well as long‑connection streaming requirements.

Example usage includes the following files:

// demo/index.js
const calculator = require('./calculator')
exports.calc = async exp => {
const [ arg1, arg2 ] = exp.match(/\d+/g)
const [ op ] = exp.match(/[\+\-\*\/]/g)
const returns = await calculator[op](+arg1, +arg2)
return `${arg1}${op}${arg2}=${returns}`
}
// demo/calculator.js
module.exports = {
'+': (a, b) => a + b,
'-': (a, b) => a - b,
'*': (a, b) => a * b,
'/': (a, b) => a / b,
}

To run OOX as a singleton, execute:

oox index.js port=8001

To run it in microservice mode, use commands such as:

# Run index service on port 8001
oox group=demo demo/index.js port=8001
# Run calculator service on a random port and register it with the main service
oox group=demo demo/calculator.js registry=:8001

Clients can invoke the service, for example with httpie:

http :8001 action=calc params='3*5'

Recent updates include the use of AsyncLocalStorage for traceability, a stack‑overflow fix when the entry file is index.js without a service directory, and an upgrade of Socket.IO to version 4.4.0.

microservicesbackend-developmentNode.jssocket.ioOOX
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.