Learn More

ActionHero is a multi-transport Node.JS API Server with integrated cluster capabilities and delayed tasks.

ActionHero was built from the ground up to include all the features you expect from a modern API framework. This includes all the features listed below and more. ActionHero also knows when to get out of the way to allow you to customize your stack to fit your needs.

Servers

Web

Web Server Docs

ActionHero can act as a HTTP or HTTPS API server. With integrated routing, it is easy to create RESTful resources. ActionHero can also serve static files.

curl "http://127.0.0.1:8080/api/" -d "action=actionsView"
  

Web Socket

Websocket Server Docs

ActionHero uses Primus to provided a robust and reliable nodejs websocket implementation. ActionHero web socket clients can fall back to long-polling and other transports to ensure they are connected. Primus allows you to choose the underlying websocket implementation of your choice.

var A = new ActionheroClient;
A.connect();
A.action("actionsView", function(data){ console.log(data); })
  

Socket

Socket Server Docs

ActionHero ships with the ability to be a line TCP or TLS server. ActionHero clients can speak a wire protocol that sends lines of JSON. Actions can be processed asynchronously and in parallel. The API server and the built-in chat system provide all you need for a communication or game application.

> telnet localhost 5000
Trying 127.0.0.1...
Connected to localhost.
{"welcome":"Hello! Welcome to the actionhero api"}
> say myChatRoom hello
{"ok"}
  

Your Own

Custom Server Docs

Most importantly, ActionHero's modular server architecture allows you to define your own servers and protocols. Learn how in the ActionHero documentation.

Features

Easy-To-Use Actions

Action Docs

With ActionHero, you create 'actions' which can respond to any type of connection. They process incoming parameters and offer a response to the client. ActionHero takes care of routing and responding to each connection type for you.

exports.action = {
  name: 'randomNumber',
  description: 'I generate a random number',
  action.inputs: {
    'required' : [],
    'optional' : []
  },
  outputExample: {randomNumber: 123}
  run: function(api, data, next){
    data.response.randomNumber = Math.random();
    next();
  }
}
  

Built-In Tasks

Task Docs

Background tasks are first-class citizens in ActionHero. You can enqueue a task from anywhere in the application. Tasks can be recurring or single-run. ActionHero's task system is powered by Resque, so it is compatible with a number of other applications and frameworks.

api.tasks.enqueue(
    "sendWelcomeEmail",
    {to: [email protected]'},
    'default',
function(error, toRun){
  // done!
});

var task = {
  name:          "sendWelcomeEmail",
  description:   "I will send a new user a welcome email",
  queue:         "default",
  frequency:     0,
  run: function(api, params, next){
    api.sendEmail(params.email, function(error){
      if(error){ api.log(error, 'error'); }
      next();
    })
  }
};
  

Cluster-Ready

Action Cluster Docs

ActionHero uses Redis to store and share data. With first-class cache functions, decentralized communications, and distributed workers, you can be sure that your application to as big of a cluster as you need.

Multiple Servers and Transports

Introduction Docs

The ActionHero API makes it simple to create a traditional HTTP(S) API, but it also lets you easily extend your API to TCP and websocket clients, all of which are included of course. ActionHero also easily lets you write your own servers to handle custom transports, ensuring you can connect with & federate all your existing services.

Routing

Route Docs

ActionHero ships with a robust router to make mapping HTTP requests to your actions a breeze. Easily wire-up your actions in RESTful patterns ensuring that your client applications can easily connect. Wildcard matching, URL-decomposition, and query extraction are all built in.

API First Development

www.api-first.com

ActionHero makes API-First development easy by enforcing a strict separation of views and application logic and removing barriers to API creation. Versioning your actions is simple and integrates well with Agile or XP team workflows.

Chat

Chat Docs

ActionHero (optionally) facilitates real-time communication not only from server-to-client, but also client-to-client! ActionHero's chat system allows for streaming of both public and private messages between clients. Complete with middleware and extensions, you can create chat services, multi-player games, and more!

Deployment Tools

Deployment Docs

It is simple to deploy ActionHero with our included CLI tools. You can launch your server as a single instance or as part of a larger deployment cluster. Tools for 0-downtime deployments and robust monitoring and logging hooks make ActionHero a dream platform for your operations team.

File Server

File Server Docs

Every server needs to serve files to its clients (even those that don't speak HTTP), and ActionHero is no exception. Configured to asynchronously stream file contents, ActionHero provides an robust file server which can live in parallel with your API, allowing for a fully featured server.

Localization

Localization Docs

ActionHero is deeply integrated with `i18n` to allow you to customize every string your clients might see. You can customize how language is determined for your API consumers, and respond to your clients in the way they are used to. This includes modular error responses and API input hints.

Community

Resources

Downloads

Learn

Companies Using ActionHero