{"library":"seneca","title":"Seneca Microservices Framework","description":"Seneca is a mature Node.js microservices framework designed to help organize application business logic through a pattern-matching approach to message passing. Currently at stable version 3.38.0, its release cadence is active but irregular, with a focus on stability and a smaller core. Key differentiators include its flexible pattern-matching for defining commands, transport independence that abstracts message delivery, and a robust ecosystem of plugins for common microservice concerns like data storage, user management, and distributed logic. The framework emphasizes breaking down applications into 'stuff that happens' rather than strict data models, providing a flexible toolkit for building Minimum Viable Products and complex distributed systems. It supports Node.js versions 10 and above and ships with TypeScript types.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install seneca"],"cli":null},"imports":["const Seneca = require('seneca')","import Seneca from 'seneca'","const Seneca = require('seneca'); const { Eraro, Jsonic, Nid, Patrun } = Seneca.util;"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"'use strict'\n\nvar Seneca = require('seneca')\n\nfunction rejector () {\n  this.add('cmd:run', (msg, done) => {\n    return done(null, {tag: 'rejector'})\n  })\n}\n\nfunction approver () {\n  this.add('cmd:run', (msg, done) => {\n    return done(null, {tag: 'approver'})\n  })\n}\n\nfunction local () {\n  this.add('cmd:run', function (msg, done) {\n    this.prior(msg, (err, reply) => {\n      return done(null, {tag: reply ? reply.tag : 'local'})\n    })\n  })\n}\n\nSeneca()\n  .use(approver)\n  .listen({type: 'http', port: '8260', pin: 'cmd:*'})\n\nSeneca()\n  .use(rejector)\n  .listen(8270)\n\nfunction handler (err, reply) {\n  console.log(err, reply)\n}\n\nSeneca()\n  .use(local)\n  .act('cmd:run', handler)\n\nSeneca()\n  .client({port: 8270, pin: 'cmd:run'})\n  .client({port: 8260, pin: 'cmd:run'})\n  .use(local)\n  .act('cmd:run', handler)\n\nSeneca()\n  .client({port: 8260, pin: 'cmd:run'})\n  .client({port: 8270, pin: 'cmd:run'})\n  .use(local)\n  .act('cmd:run', handler)","lang":"javascript","description":"This example demonstrates defining and loading plugins, setting up HTTP listeners for microservices, and client-side message dispatching with pattern matching and priority handling.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}