Skip to main content
New protocol version released: This page may contain outdated information.

Installation

The HAIP Server can be installed and deployed in multiple ways. Choose the method that best fits your environment and requirements.

Prerequisites

Node.js

Version 18.0.0 or higher

npm

Version 8.0.0 or higher

Git

For cloning the repository

Method 1: From Source

1

Clone the Repository

git clone https://github.com/haiprotocol/haip cd haip/haip-server
2

Install Dependencies

bash npm install
3

Build the Project

bash npm run build
4

Start the Server

bash # Development mode npm run dev # Production mode npm start

Method 2: Docker

Pull the Image

Run the Container

Using Docker Compose

Create a docker-compose.yml file:
Run with:

Method 3: NPM Package

Available Now: The HAIP Server is available on npm as @haip/server.
npm version npm downloads License: MIT

Environment Configuration

The server can be configured using environment variables:

Required Environment Variables

Optional Environment Variables

Flow Control Configuration

Development Setup

Install Development Dependencies

Run Tests

Development Scripts

Production Setup

Security Considerations

  1. JWT Secret: Use a strong, unique secret key
  2. Environment: Set NODE_ENV=production
  3. HTTPS: Use HTTPS in production with proper certificates
  4. Firewall: Configure firewall rules appropriately
  5. Rate Limiting: Consider additional rate limiting for production

Example Production Configuration

Docker Production Setup

Verification

After installation, verify the server is running correctly:

Health Check

Expected response:

Statistics

Expected response:

WebSocket Connection

Troubleshooting

Common Issues

  1. Port Already in Use
  2. JWT Secret Not Set
  3. Permission Denied
  4. Docker Issues

Logs

Check the server logs for debugging:

Next Steps