Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/LENINMORENO13/OpsMind/llms.txt

Use this file to discover all available pages before exploring further.

By the end of this guide you will have a fully operational OpsMind instance running on your machine, a registered user account, a JWT token in hand, and a live monitor actively tracking an HTTP endpoint — all in under five minutes. The only external dependency beyond Docker is a free Google Gemini API key, which powers the AI-based incident diagnosis engine.
1

Prerequisites

Make sure the following tools are installed and available on your PATH before continuing:
RequirementNotes
GitFor cloning the repository
DockerEngine v24 or newer recommended
Docker ComposeIncluded in Docker Desktop; use docker compose (v2 plugin)
Gemini API keyFree tier available — obtain one at https://aistudio.google.com/
You do not need Node.js installed locally; everything runs inside Docker containers.
2

Clone the Repository

Clone the OpsMind repository and change into the project directory:
git clone https://github.com/LENINMORENO13/OpsMind.git && cd OpsMind
3

Configure Environment Variables

Copy the provided example file to create your local .env:
cp .env.example .env
Open .env in your editor. It should look like this:
.env
# Servidor Express
PORT=3000

# Conexión a la Base de Datos (Prisma)
DATABASE_URL="postgresql://postgres:TU_CONTRASEÑA_AQUÍ@localhost:5432/opsmind_db?schema=public"

# Gemini AI (Análisis inteligente de incidentes)
GEMINI_API_KEY=tu_api_key_aqui
Update each value as described below:
VariableWhat to set
PORTLeave as 3000 unless that port is already taken on your machine.
DATABASE_URLWhen running via Docker Compose the database host must be db (the Compose service name), not localhost. See the pre-configured value Docker Compose injects for the api service — you only need this file for local non-Docker runs.
GEMINI_API_KEYPaste the API key you obtained from Google AI Studio. This is the only value you must change before starting.
Docker Compose overrides DATABASE_URL and JWT_SECRET automatically for the api container (see docker-compose.yml). The .env file is primarily used for local development outside of Docker, but GEMINI_API_KEY is read from it by Compose via the ${GEMINI_API_KEY} interpolation, so you must set it there.
4

Start with Docker Compose

Build the images and start both the PostgreSQL database and the API server:
docker compose up --build
Docker Compose will:
  1. Pull the postgres:15-alpine image and start the db service.
  2. Build the api image from the local Dockerfile (Node 20 Alpine).
  3. Run npx prisma db push inside the container to apply the schema to PostgreSQL.
  4. Start the Express server and the node-cron scheduler.
Once you see output similar to the following, the platform is ready:
opsmind-api  | --- Monitoring System ---
opsmind-api  | Servidor corriendo en el puerto 3000
URLDescription
http://localhost:3000API root (redirects to Swagger UI)
http://localhost:3000/api-docsInteractive Swagger documentation
localhost:5433PostgreSQL (mapped from container port 5432)
5

Register a User

Create your account by posting to the auth registration endpoint:
curl -X POST http://localhost:3000/api/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "you@example.com",
    "password": "your-secure-password"
  }'
A successful response returns a 201 status with a JSON body confirming the new user was created.
6

Login and Obtain a JWT

Log in with the credentials you just registered to receive a signed JWT:
curl -X POST http://localhost:3000/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "you@example.com",
    "password": "your-secure-password"
  }'
The response payload looks like this:
Response
{
  "data": {
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
  }
}
Copy the value of data.token — you’ll include it as a Bearer token on every subsequent request to protected endpoints.
7

Create Your First Monitor

Register the first HTTP service you want OpsMind to watch. Replace <YOUR_TOKEN> with the JWT from the previous step:
curl -X POST http://localhost:3000/api/v1/monitors \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <YOUR_TOKEN>" \
  -d '{
    "name": "My API",
    "url": "https://opsmind-e07b.onrender.com"
  }'
OpsMind records the monitor and immediately marks it PENDING. The background cron worker will perform the first health check within the next five minutes and update lastStatus to UP, DEGRADED, or DOWN.
8

Check the Status of All Monitors

Retrieve the current health snapshot for every registered monitor:
curl -X GET http://localhost:3000/api/v1/monitors/status/all \
  -H "Authorization: Bearer <YOUR_TOKEN>"
The response lists each monitor alongside its lastStatus, latest trend, and the most recent check timestamp — giving you an at-a-glance view of your entire monitored fleet.
The fastest way to explore every available endpoint — including monitor history and AI insights — is the Swagger UI at http://localhost:3000/api-docs. You can authorise directly in the UI using the Authorize button (paste your JWT there) and execute live requests without leaving your browser.

Build docs developers (and LLMs) love