Micro type-safe wrapper for Node.js AMQP library and RabbitMQ management.

Overview

Qupi Logo

Micro type-safe wrapper for AMQP library and RabbitMQ management

GitHub Workflow Status (branch) GitHub GitHub tag (latest by date)

Description

Section in progress.

Getting Started

Qupi can be installed by Yarn or NPM:

npm install qupi
yarn add qupi

RabbitMQ is required for the proper functioning of the library. Feel free to use our docker-compose file. After installing Docker Desktop on your PC, docker compose up command will create container with RabbitMQ inside.

Example

import { ConnectionFactory, Transmitter } from 'qupi';

type User = {
  name: string;
  age: number;
};

type Mail = {
  sender: string;
  recipient: string;
  content: string;
};

const sendMail = (mail: Mail) => console.log(mail);
const addUser = (user: User) => console.log(user);

const start = async () => {
  try {
    const internalChannel = await new ConnectionFactory({
      hostname: 'localhost',
      password: 'root',
      username: 'root',
    }).createQueue('INTERNAL_QUEUE'); // createQueue method returns Qupi channel, which contains amqp channel instance and meta data.

    // Transmitters receive channel as first argument, and handler as second, which is triggered by trigger function in transmitter.
    const mailTransmitter = new Transmitter(internalChannel, sendMail);
    const userTransmitter = new Transmitter(internalChannel, addUser);

    // Transmitter class provides full autocompletion and type-safety
    mailTransmitter.trigger({
      sender: '[email protected]',
      recipient: '[email protected]',
      content: 'Hello!',
    });
    userTransmitter.trigger({
      name: 'John',
      age: 30,
    });

    mailTransmitter.trigger('Wrong!'); // TypeScript compiler throws an error
    userTransmitter.trigger({
      name: 'John',
      age: '30', // Also throws an error
    });
  } catch (error) {
    console.log(error);
  }
};

start();

Contributing

Section in progress.


Icons made by Becris from www.flaticon.com

You might also like...

Full stack CQRS, DDD, Event Sourcing framework for Node.js

Full stack CQRS, DDD, Event Sourcing framework for Node.js

reSolve is a full stack functional JavaScript framework. CQRS - independent Command and Query sides. DDD Aggregate support. Event sourcing - using eve

Dec 27, 2022

In-memory filesystem with Node's API

In-memory filesystem with Node's API

Jan 4, 2023

A simple boilerplate generator for your node express backend project! 🚀

A simple boilerplate generator for your node express backend project! 🚀

Sep 26, 2022

A nodejs module for local and remote Inter Process Communication with full support for Linux, Mac and Windows

A nodejs module for local and remote Inter Process Communication with full support for Linux, Mac and Windows

Sep 28, 2022

Actionhero is a realtime multi-transport nodejs API Server with integrated cluster capabilities and delayed tasks

Actionhero is a realtime multi-transport nodejs API Server with integrated cluster capabilities and delayed tasks

Actionhero The reusable, scalable, and quick node.js API server for stateless and stateful applications NPM | Web Site | Latest Docs | GitHub | Slack

Dec 29, 2022

:zap: RAN! React . GraphQL . Next.js Toolkit :zap: - SEO-Ready, Production-Ready, SSR, Hot-Reload, CSS-in-JS, Caching, CLI commands and more...

:zap: RAN! React . GraphQL . Next.js Toolkit :zap: - SEO-Ready, Production-Ready, SSR, Hot-Reload, CSS-in-JS, Caching, CLI commands and more...

RAN : React . GraphQL . Next.js Toolkit New version is coming... Follow up here: https://github.com/Sly777/ran/issues/677 Features Hot-Reload Ready fo

Jan 3, 2023

A tool to develop and improve a student’s programming skills by introducing the earliest lessons of coding.

A tool to develop and improve a student’s programming skills by introducing the earliest lessons of coding.

teachcode A tool to develop and improve a student’s programming skills by introducing the earliest lessons of coding. Chat: Telegram Donate: PayPal, P

Oct 25, 2022

💻 Simple and flexible CLI Tool for your daily JIRA activity (supported on all OSes)

💻 Simple and flexible CLI Tool for your daily JIRA activity (supported on all OSes)

jirax ⭐ If you are using this tool or you like it, Star on GitHub — it helps! A CLI tool for JIRA for day to day usage with JIRA.Speed up your JIRA ac

Oct 4, 2022
Releases(v0.2.2)
Owner
Grzegorz Lenczuk
Fullstack engineer, with big love and passion to game development and other things related to software. I enjoy clean code and well-designed architectures.
Grzegorz Lenczuk
Noderlang - Erlang node in Node.js

Noderlang allows Node.js programs to easily operate in BEAM environments

devsnek 2 Mar 31, 2022
wolkenkit is an open-source CQRS and event-sourcing framework based on Node.js, and it supports JavaScript and TypeScript.

wolkenkit wolkenkit is a CQRS and event-sourcing framework based on Node.js. It empowers you to build and run scalable distributed web and cloud servi

the native web 1.1k Dec 26, 2022
Clock and task scheduler for node.js applications, providing extensive control of time and callback scheduling in prod and test code

#zeit A node.js clock and scheduler, intended to take place of the global V8 object for manipulation of time and task scheduling which would be handle

David Denton 12 Dec 21, 2021
The most powerful headless CMS for Node.js — built with GraphQL and React

A scalable platform and CMS to build Node.js applications. schema => ({ GraphQL, AdminUI }) Keystone Next is a preview of the next major release of Ke

KeystoneJS 7.3k Jan 4, 2023
:desktop_computer: Simple and powerful server for Node.js

server.js for Node.js Powerful server for Node.js that just works so you can focus on your awesome project: // Include it and extract some methods for

Francisco Presencia 3.5k Dec 31, 2022
Elegant and all-inclusive Node.Js web framework based on TypeScript. :rocket:.

https://foalts.org What is Foal? Foal (or FoalTS) is a Node.JS framework for creating web applications. It provides a set of ready-to-use components s

FoalTS 1.7k Jan 4, 2023
DDD/Clean Architecture inspired boilerplate for Node web APIs

Node API boilerplate An opinionated boilerplate for Node web APIs focused on separation of concerns and scalability. Features Multilayer folder struct

Talysson de Oliveira Cassiano 3k Dec 30, 2022
🚀 A RESTful API generator for Node.js

A RESTful API generator rest-hapi is a hapi plugin that generates RESTful API endpoints based on mongoose schemas. It provides a powerful combination

Justin Headley 1.2k Dec 31, 2022
nact ⇒ node.js + actors ⇒ your services have never been so µ

nact ⇒ node.js + actors your services have never been so µ Any and all feedback, comments and suggestions are welcome. Please open an issue if you fin

Natalie Cuthbert 1k Dec 28, 2022
A Programming Environment for TypeScript & Node.js built on top of VS Code

Programming Environment for TypeScript & Node.js A battery-included TypeScript framework built on top of Visual Studio Code Website Kretes is a progra

Kretes 677 Dec 11, 2022