Tutorials


Introduction


Welcome to Actionhero! These tutorials are here to provide a more story-driven guide to how things work. These tutorials are meant to partner with the Actionhero Documentation to provide a full guide un using the framework.


Key Concepts


If you are new to Actionhero, we suggest visiting the key concepts page first, which will put these tutorials into context.


Actionhero Core


Actions

Actions are the core of Actionhero, and the main way you respond to your user's requests.

Tasks

Tasks are how your execute background jobs, like sending emails or contacting a third-party API. In Actionhero, you can trigger tasks manually or run them on a schedule.

Initializers

Initializers are for connecting to databases, loading data, and generally preparing your API to process requests. Initializers are the place to define any common methods you plan to use in your Actions and Tasks.

Middleware

Actionhero's Middleware system makes it easy to add authentication, logging, and other custom behavior to your Actions and Tasks

Testing

Actionhero includes a robust testing framework that works with Jest for testing JS and TS projects. You can easily test your Actions and Tasks with either real connections or mocks.

Cache

Actionhero includes a powerful cache system based on Redis. It can be used to store and retrieve data, but also to create more complex data structures based on queues and expiring object.

Chat

Actionhero's chat system is for more than just peer-to-peer communications. It is a robust way to share data between clients and your servers. Game coordination, messaging, and sharing state are all possible via Actionhero's chat system.

CLI

Actionhero includes tools to build CLI scripts that integrate with your application. Need to migrate a database or seed data in a repeatable way? Check out Actionhero's CLI tooling.


Actionhero Servers


Servers

Actionhero is unique in that it allows you to build or add many types of servers into one application. Not only can you support HTTP and Web Socket, but you can add custom protocols like Quick and Protobuf to your application and easily reuse your Actions!

Web Server

Actionhero ships with a robust web server to handle RESTful APIs. Routing, versioning, and more are included.

Websocket Server

Building on the included web server, Actionhero's Web Socket Server includes everything you need for a realtime application on the web or in your mobile applications.


Configuration and Development


Running Actionhero

Actionhero is ready for your production deployments - with support for hot reloading, clustered process management, and multiple ways of logging.

Configuration

Actionhero is built following the ideals of the 12-factor application. That means you can easily configure and deploy your app to a number of environments.

REPL and Debugging

Actionhero includes a REPL so you can interactively explore your application can work with your data. You can also use node.js' robust debugging ecosystem with your Actionhero project.

File Server

Actionhero comes with a file server which makes it easy for you to integrate assets with your API responses, and serve up API playgrounds and documentation.

Logging

Actionhero uses Winston to create multi faceted logs for your application.


Advanced Topics


Plugins

Actionhero is built to enable a robust ecosystem of plugins to share functionality. You can add community plugins or make your own to share functionality within your company.

Cluster

Actionhero can be run either as a solitary server or as part of a cluster. The goal of these cluster helpers is to allow you to create a group of servers which will share state and each be able to handle requests and run tasks. You can add or remove nodes from the cluster without fear of data loss or task duplication.

Production Notes

Actionhero has been used by many companies in both large and small deployments. Let us share some best practices with you to design your Actionhero deployment in the best possible way.

Upgrade Path

Upgrading big Actionhero projects to a new major might require some effort. Every Actionhero version has it's own specific project files which you generate using `Actionhero generate` command... but this guide helps you move from one version to the next.

Typescript

Actionhero has moved from being a Javascript project to a Typescript project in version 21. This guide explains how to move your existing Javascript project to Typescript, and how to enjoy all the enhancements of this new version.