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 start > [email protected] start /app/actionhero > node ./bin/actionhero info: actionhero >> start 2015-11-14 16:01:27 - notice: *** starting actionhero *** 2015-11-14 16:01:27 - info: actionhero member 10.0.1.15 has joined the cluster 2015-11-14 16:01:27 - notice: pid: 36087 2015-11-14 16:01:27 - notice: server ID: 10.0.1.15 2015-11-14 16:01:27 - info: ensuring the existence of the chatRoom: defaultRoom 2015-11-14 16:01:27 - info: ensuring the existence of the chatRoom: anotherRoom 2015-11-14 16:01:27 - notice: starting server: web 2015-11-14 16:01:27 - notice: starting server: websocket 2015-11-14 16:01:28 - notice: environment: development 2015-11-14 16:01:28 - notice: *** Server Started @ 2015-11-14 16:01:28 ***
# 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 bcackground window
Get started now:
mkdir ~/project && cd ~/project npm install actionhero npx actionhero generate npm install # ensure redis is running; see above npm start
mkdir ~/project && cd ~/project
npm install actionhero
npx actionhero generate
npm installto install dependencies
http://127.0.0.1:8080 in your browser to see the ActionHero in action!
Do not install ActionHero globally with
npm install -g
You can disable the features of ActionHero which require redis (cache, chat, tasks, etc) from
./config/redis.js and set
enabled = false
# ActionHero Project Layout |- config | -- api.js | -- errors.js | -- i18n.js | -- logger.js | -- redis.js | -- routes.js | -- tasks.js | -- servers | ---- web.js | ---- websocket.js | ---- socket.js |-- (project settings) | |- actions |-- (your actions) | |- initializers |-- (any additional initializers you want) | |- 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) | |- servers |-- (custom servers you may make) | |- tasks |-- (your tasks) | |- locales |-- (translation files) | |- tests |-- (tests for your API) | readme.md package.json (be sure to include 'actionhero':'x')
The map to the right describes ActionHero's default project layout.
/actions will be loaded in automatically, along
/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
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 master branch with any updates or changes.
This documentation will always reflect the master 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
For larger customers in need of a support contract, we offer an enterprise plan including everything in the Premium plan plus: