Skip to content

shiva-api — Setup

shiva-api is an optional external REST API server. It lets external systems (dashboards, Discord bots, mobile apps) read and write server data over HTTP.

Installation

bash
npm install -g @shiva-fw/api
shiva-api init

Or as a service alongside your FiveM server using the Docker Compose setup.

Configuration

Edit shiva-api.config.json:

json
{
    "port": 3000,
    "secret": "your-jwt-secret",
    "database": {
        "host": "127.0.0.1",
        "port": 3306,
        "user": "shiva",
        "password": "your-db-password",
        "database": "shiva"
    },
    "cors": {
        "origins": ["https://your-panel.example.com"]
    }
}

Starting the Server

bash
shiva-api start
# API available at http://localhost:3000

Authentication

All API requests require a JWT token. Generate one:

bash
shiva-api token --user admin --expires 30d

Include in requests:

http
Authorization: Bearer eyJhbGci...

Next Steps

Released under the MIT License.