Git Product home page Git Product logo

actio's Introduction

Actio

The Node.js framework for monoliths and microservices.

License: AGPL v3

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.

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:

  • Authentication service for login, register, oauth (facebook etc.).
  • KeyValue service for saving unstructured data without creating yet another anemic endpoint/service.
  • File service for file upload. Upload to a local disk or to Google Storage etc. in production.
  • Config service for handling public configuration and secret values.
  • System service for inspecting the Actio runtime and enabling building tools upon Actio (such as API explorers etc.).
  • 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.

  • 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.

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.