How to Host Networked-Aframe on a Server

Once you've followed Networked-Aframe's getting started guide and have a local instance of NAF the next step is to deploy your code to a server so you can share your experience over the internet.

There are many ways to host your experience, ranging from super simple but without much customization, to quite complex with lots of customization. This post will describe the various methods from simplest to most complex.

Glitch.com (~5 minute setup time)

Cost: Free!

Custom domain: Not yet

Steps:

  1. Sign up for a Glitch.com account (you can sign in with GitHub)

  2. Open the Networked-Aframe Glitch Starter Pack

  3. Click "Remix your own"

That's it! You can then click "Show" and you have a working example of NAF running at that URL. Open the URL in multiple tabs and you'll see the other avatars. If you're just in proof of concept phase I highly recommend you stop reading here and just use Glitch. It's also the defacto way the A-Frame community shares bugs and shows off examples, so its worth becoming familiar with it.

Heroku (~2 hours setup time)

Cost: Free tier

Custom domain: Yes

Steps:

  1. Sign up for a Heroku account

  2. Follow the hosting NodeJS on Heroku guide

  3. Repeat the guide's steps but for your own local Networked-Aframe instance (created here)

Amazon Web Services (AWS) (~4 hours setup time)

Cost: Free tier for new customers

Custom domain: Yes

Steps:

  1. Sign up for an AWS account

  2. Follow the hosting NodeJS on AWS guide

  3. Make sure ports TCP 80 and TCP 443 (only if you're using SSL, see below) are open in the security group

  4. Push your local Networked-Aframe experience to a GitHub repo

  5. Git clone your repo onto the AWS instance

  6. Run npm install pm2 -g to install the pm2 process manager (this keeps your app alive even when you log off your server)

  7. Start the app with PORT=80 pm2 start server/easyrtc-server.js