Dolphin Server Modules

2.2.4 · active · verified Wed Apr 22

Dolphin Server Modules is the core utility package for the Dolphin Framework, an ultra-lightweight and modular backend ecosystem built on native Node.js. It provides fundamental functionalities for building Web, Microservices, and Industrial IoT applications, focusing on Auth, CRUD, Models, and Controllers. The current stable version is 2.2.4, with a recent feature release cadence indicated by updates like v2.2.1 and v2.2 bringing CLI usage and dynamic API proxies. Key differentiators include its zero-dependency core built on native `http` and `events`, universal compatibility with tools like Mongoose and Zod, support for Express-compatible multi-handler middleware, and native IIoT support via binary plugins for protocols like HL7 and Modbus. It also offers a unique server-served client library, eliminating the need for client-side NPM installations.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates setting up a basic Dolphin web server with GET and POST routes, showcasing JSON serialization and context object usage.

import { createDolphinServer } from 'dolphin-server-modules/server';

const app = createDolphinServer();

app.get('/ping', (ctx) => {
  return { message: 'pong', version: '1.5.6' };
});

app.get('/hello/:name', (ctx) => {
  const name = ctx.params.name;
  return { greeting: `Hello, ${name}!` };
});

app.post('/data', async (ctx) => {
  const body = await ctx.req.json(); // Access raw request body
  console.log('Received data:', body);
  return { status: 'received', data: body };
});

app.listen(3000, () => console.log('🐬 Dolphin swimming on port 3000'));

view raw JSON →