Actionhero is a node.js API framework for both tcp sockets, web sockets, and http clients. The goal of Actionhero is to create an easy-to-use toolkit for making reusable & scalable APIs. Clients connected to an Actionhero server can consume the API, consume static content, and communicate with each other.
Actionhero servers can process both requests and tasks (delayed actions like `send e-mail` or other background jobs). Actionhero servers can also run in a cluster (on the same or multiple machines) to work in concert to handle your load.
The Actionhero API defines a single access point and accepts GET, POST, PUT and DELETE input along with persistent connection via TCP or web sockets. You define Actions which handle input and response, such as `userAdd` or `geoLocate`. HTTP, HTTPS, and TCP clients can all use these actions. The Actionhero API is not inherently 'RESTful' (which is meaningless for persistent socket connections) but can be extended to be so if you wish.
Actionhero will also serve static files for you, but Actionhero is not a 'rendering' server (like express or rails).
❯ npm run dev
> actionhero@21.0.6 dev /Users/evan/workspace/actionhero/actionhero
> ts-node-dev --transpile-only src/server.ts
Using ts-node version 8.5.2, typescript version 3.7.2
₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋₋
ACTIONHERO COMMAND >> start
⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻
192.168.7.33 @ 2019-11-27T23:29:24.255Z - notice: pid: 70962
192.168.7.33 @ 2019-11-27T23:29:24.256Z - notice: environment: development
192.168.7.33 @ 2019-11-27T23:29:24.256Z - info: *** Starting ActionHero ***
192.168.7.33 @ 2019-11-27T23:29:24.258Z - info: actionhero member 192.168.7.33 has joined the cluster
192.168.7.33 @ 2019-11-27T23:29:24.261Z - notice: Starting server: 'web' @ 0.0.0.0:8080
192.168.7.33 @ 2019-11-27T23:29:24.262Z - notice: Starting server: 'websocket'
192.168.7.33 @ 2019-11-27T23:29:24.776Z - notice: server ID: 192.168.7.33
192.168.7.33 @ 2019-11-27T23:29:24.776Z - notice: *** ActionHero Started ***
# On OSX With Homebrew:
brew install node
brew install redis
brew services start redis # this will keep redis running in the background forever
# On Ubuntu:
(sudo) apt-get install node
(sudo) apt-get install redis-server
redis-server --daemonize yes # this will keep redis running in the background for this session
# On Windows:
[download nodeJS](https://nodejs.org/en/download)
[download redis](https://github.com/MSOpenTech/redis)
run redis.exe in a background window
Get started now:
mkdir ~/project && cd ~/project
npx actionhero generate
npm install
# ensure redis is running; see above
npm dev
mkdir ~/project && cd ~/project
npm install actionhero
npx actionhero generate
npm install
to install dependenciesnpm dev
Visit http://127.0.0.1:8080
in your browser to see the Actionhero in action!
Do not install Actionhero globally with npm install -g
. Actionhero does not support running from a global (system) location, and expects to be installed locally per-project. You can learn more about why here
The next step is learning more about Actionhero's Key Concepts, Actions, Tasks, Initializers, Chat, and Servers, and how Actionhero differs from a traditional MVC-style framework.
|
|- src
| - config
| - (project settings)
|
| - actions
| -- (your actions)
|
| - initializers
| -- (any additional initializers you want)
|
| - servers
| -- (custom servers you may make)
|
| - tasks
| -- (your tasks)
|
| - bin
| -- (your custom CLI commands)
|
|- locales
|-- (translation files)
|
|- __tests__
|-- (tests for your API)
|
| - log
|-- (default location for logs)
|
|- node_modules
|-- (your modules, actionhero should be npm installed in here)
|
|- pids
|-- (pidfiles for your running servers)
|
|- public
|-- (your static assets to be served by /file)
|
readme.md
package.json
The map to the right describes Actionhero's default project layout.
Actions in /actions
will be loaded in automatically, along /initializers
and /tasks
.
/public
will become your application's default static asset location.
If you wish to customize your project's paths, you can do so within config/api.js
in the config.general.paths
section.
Want to see an example application using Actionhero? You can check out the code and follow the detailed guide here (https://github.com/Actionhero/Actionhero-tutorial). This project demonstrates many of the core features of Actionhero in a simple project.
The www.actionherojs.com website and documentation is hosted on Heroku, and built from this codebase. You can submit pull requests to the main branch with any updates or changes.
This documentation will always reflect the main branch of Actionhero, and therefore may be slightly ahead of the latest release on NPM.
The Actionhero server is open source, under the Apache-2 license
Actionhero runs on Linux, OS X, and Windows
You always have access to the Actionhero team via Slack and Github
We provide support for corporate & nonprofit customers starting at a flat rate of $200/hr. Our services include:
We have packages appropriate for all company sizes. Contact us to learn more.
We provide support for corporate & nonprofit customers starting at a flat rate of $200/hr. Our services include:
We have packages appropriate for all company sizes. Contact us to learn more.
For larger customers in need of a support contract, we offer an enterprise plan including everything in the Premium plan plus: