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

@crufters/actio

v0.3.6

Published

Actio is a lightweight, batteries included Node.js framework for your backend applications.

Downloads

143

Readme

Actio is a modern, batteries included Node.js (Typescript) framework for your backend applications. It enables you to effortlessly switch between monolithic and microservices architectures.

Start out with a monolith and turn it into microservices without changing your code once you need to scale!

Get started.

npm i -S @crufters/actio

Simple

Actio values simplicity and elegance, because enjoying coding makes you more productive.

import { Service, Servicelike, startServer } from "@crufters/actio";

interface MyEndpointRequest {
  name?: string;
}

@Service()
class MyService implements Servicelike {
  constructor() {}

  // this method will be exposed as an HTTP endpoint
  async myEndpoint(req: MyEndpointRequest) {
    return { hi: req.name };
  }

  async _onInit() {
    console.log("MyService: _onInit runs whenever the server boots up.");
  }
}

startServer([MyService]);

Dependencies made easy

Your services can easily call each other just by accepting a constructor parameter:

@Service()
class MyService implements Servicelike {
  constructor(otherService: MyOtherService) {}
}

Monolith or microservices? Actio blurs the line

Service calls are just function calls. Function calls become network calls simply by configuring Actio with envars:

Without configuration, service calls are just normal function calls:
--------------------------------
|  LoginService     <-|  <-|   |
| PaymentService  ----|    |   |
|  OrderService   ---------|   |
-------------------------------|
 instance address
     0.0.0.0
  no Actio config


With some lightweight configuration a true services based
architecture can be achieved, without code changes:

-------------------                     -----------------
| PaymentService  |-------------------> | LoginService  |
|  OrderService   |-------------------> |               |
-------------------                     -----------------
 instance address                        instance address
     0.0.0.0                                 0.0.0.1
envar LOGIN_SERVICE=0.0.0.1

Calls to the login service become network calls automatically.

Batteries included

Actio is batteries included: it comes with services that help you bootstrap your system (but tries to not force you to use these) faster:

  • [x] Authentication service for login, register, oauth (facebook etc.).
  • [x] KeyValue service for saving unstructured data without creating yet another anemic endpoint/service.
  • [x] File service for file upload. Upload to a local disk or to Google Storage etc. in production.
  • [x] Config service for handling public configuration and secret values.
  • [x] System service for inspecting the Actio runtime and enabling building tools upon Actio (such as API explorers etc.).
  • [x] Payment service: a double entry ledger system with Stripe and other payment provider support.
  • [ ] ...and many others that the community might find useful.

Built with infrastructure in mind

Real world apps need persistence and many other infrastructure elements. Actio manages your infra dependencies just like your service dependencies.

  • [x] Postgres
  • [ ] Redis
  • [ ] Many more coming

Testing without the hassle

Run integration tests easily including all of your services and infrastructure dependencies. No need for mocking.

Namespaced for server savings

Actio enables you to run multiple projects from the same single server by namespaces. Save on server and maintenance cost.

Firm service boundaries

Actio isolates your services - no more sidestepping of service boundaries, be it intentional or accidental. Each service is a black box for other services, which enable you to reimplement services without breaking depending services.

The dependency injector makes sure your service tables live in different databases entirely - joins won't work across services. This and similar constraints enable you a seamless and refactor free transition to microservices - but also ensures your monolith doesn't became overly tightly coupled.

Examples and tutorials

For examples and tutorials see the Getting started guide.

Credits

Inspired by other microservices systems such as Micro and the author's previous work with Asim Aslam. Author: János Dobronszki. Contributors: Dávid Dobronszki, Asim Aslam, Viktor Veress.