npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@openlab/deconf-api-toolkit

v5.1.3

Published

A library for running decentralised virtual conferences

Downloads

147

Readme

deconf-api-toolkit

Table of contents

deconf is a set of libraries for running decentralised virtual conferences. This toolkit is a http-agnostic node.js package for creating a headless API to run a conference.

This library is currently an adaptation from digitalinteraction/climatered-api which was the API behind the climate.red virtual summit.

The purpose of this library is to take the knowledge and experience we gained from running that conference and to expose the functionality to run more conferences.

This API toolkit is being design hand-in-hand with a UI toolkit which does the same for the visual components of the conference - work in progress

Architecture

Api toolkit is designed to be framework agnostic in terms of a http lbrary (e.g. express), but it does rely on some infrastructure.

  • It uses a redis cache to store conference resources which are served to users
  • It uses JWT authentication to authorize access to resources and links
  • It uses postgres to store attendees and track their attendance to sessions

Efforts might be made in the future to make the toolkit more agnostic but for not you can swap out modules/services by supplying something with the same interface.

How does it work

The features of the conference have been split up into interchangable modules so you can configure your own conference API with some or all of the same features.

The current modules are:

  • Accounts - coming soon
  • Attendance - Endpoints for tracking attendance to sessions
  • Carbon - Endpoints for calculating c02 savings by hosting the conference online
  • Coffee - coming soon - Endpoints for matchmaking webrtc coffee chats
  • GitScraper - coming soon - utilities for fetching, parsing & validating static content from git
  • Migrate - utilities for running migrations on the postgres database
  • Interpret - coming soon - Endpoints for running real-time audio interpretation
  • Schedule - Endpoints for the conference schedule resources

All http-releated modules return a HttpResponse instance which you can bind to your own http framework (express, koa, etc).

class HttpResponse {
  constructor(
    public status: number,
    public body: any = '',
    public headers: any = {}
  ) {}
}

These modules internally use a set of services, some of which are provided but all can be overidden to add your own implementations

  • Authentication - for authenticating requests / sockets
  • Conference - for pulling schedule resources from redis
  • Email - user-provided for sending emails to users i.e. when logging in
  • I18n - for loading translations and accessing them
  • Jwt - for signing and verifying Json Web Tokens
  • Postgres - for access to postgres with client-pooling
  • Query - for querying data from postgres
  • Redis - for fetching data from redis
  • Url - user provided for creating urls for resources / pages

Services and Modules internally use structs which are written using superstruct. see src/structs

Extensions

Some services you need to provide yourself as there is no agnostic way of implementing them and you can swap out any modules or services if you want to work differently.

Services are the internal reusable logic and modules are public-facing code that can be imported and used.

The components of the toolkit rely on dependency injection to talk to each other. A module or service is defined in three parts, say we were adding a Random module:

// First is the service interface
interface RandomModule {
  generateFloat(min: number, max: number): number
}

// Second is the service's options
// lets say it relies on a made up "Entropy" service
interface RandomOptions {
  entropy: EntropyService
}

// Third is the constructor for the module
function createRandomModule(options: RandomOptions): RandomModule {
  return {
    generateFloat(min, max) {
      return min + Math.floor(entropy.generate() * (max - min))
    },
  }
}

Development

setup

npm install

regular use

npm test

irregular use

# manually run prettier (auto-runs on git-stage)
npm run format

# manually lint typescript
npm run lint

# generate coverage and open the report
npm run coverage
open coverage/lcov-report/index.html

# generate the table of contents in this readme
npm run readme-toc

# manually compile TypeScript
npm run build

example app

# Run the docker stack and start the server
# -> Redis is on redis://localhost:6379
# -> Postgres is on postgres://user:secret@localhost:5432/user
# -> Server runs on http://localhost:3000
docker-compose up -f examples/docker-compose.yml

releasing

Git commits to this repo must follow conventional commits which lets us auto-generate the CHANGELOG.md and decide the next version of the package.

# generate a new version and publish it
npm release

setup with puggle