> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nanomon.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Self-Hosted Version

## Introduction

The self-hosted version contains all the key features that our team consider to be needed for a development phase to allow development teams to gain visibility over what are the agents actually doing, what tools are they calling, what is the RAG here and there, what input did this tool got and what outputs did it return.

## How to run nanomon locally

To run nanomon locally and start monitoring your agents all you need to do is to:

1. Copy the docker-compose/yaml example we provide bellow
2. (optionally) change the environment variables as described bellow
3. run:

   ```
   docker-compose -f <docker-compose-file-path> up
   ```

### The Docker-Compose file

This file defines the three components nanomon needs to properly run. These being the database, the backend api and the frontend (ui).

Copy the following file content and place it in a directory of your choice:

<CodeGroup>
  ```yaml nanomon.yaml theme={null}
  version: '3.8'

  services:
    # PostgreSQL Database
    postgres:
      image: postgres:16-alpine
      container_name: nanomon_db
      restart: unless-stopped
      environment:
        POSTGRES_USER: ${POSTGRES_USER:-nanomon}
        POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
        POSTGRES_DB: ${POSTGRES_DB:-nanomon}
      volumes:
        - postgres_data:/var/lib/postgresql/data
      healthcheck:
        test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-nanomon}"]
        interval: 10s
        timeout: 5s
        retries: 5
      networks:
        - nanomon_network

    # API Server
    api:
      image: jlmrodrigues/nanomon_api:latest
      container_name: nanomon_api
      restart: unless-stopped
      depends_on:
        postgres:
          condition: service_healthy
      environment:
        DB_HOST: postgres
        DB_PORT: 5432
        DB_USER: ${POSTGRES_USER:-nanomon}
        DB_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
        DB_NAME: ${POSTGRES_DB:-nanomon}
        DATABASE_URL: postgresql://${POSTGRES_USER:-nanomon}:${POSTGRES_PASSWORD:-changeme}@postgres:5432/${POSTGRES_DB:-nanomon}
        JWT_SECRET: ${JWT_SECRET:-please-change-this-secret-in-production}
        ADMIN_EMAIL: ${ADMIN_EMAIL:-admin@example.com}
        ADMIN_PASSWORD: ${ADMIN_PASSWORD:-changeme123}
        PORT: 8000
      ports:
        - "${API_PORT:-8000}:8000"
      networks:
        - nanomon_network

    # Dashboard (Web UI)
    dashboard:
      image: jlmrodrigues/nanomon_dashboard:latest
      container_name: nanomon_dashboard
      restart: unless-stopped
      depends_on:
        - api
      environment:
        API_URL: ${API_URL:-http://localhost:8000/api/v1}
      ports:
        - "${DASHBOARD_PORT:-80}:80"
      networks:
        - nanomon_network

  networks:
    nanomon_network:
      driver: bridge

  volumes:
    postgres_data:
      driver: local
  ```
</CodeGroup>

### Change the default values

The default values in the docker-compose file can be easily changed by copying the .env file contents to an .env file that must be placed in the same directoty as the docker-compose file is

<CodeGroup>
  ```yaml .env theme={null}
  # nanomon Self-Hosted Configuration
  # Copy this file to .env and customize your values

  # ===========================================
  # Admin Account (created on first startup)
  # ===========================================
  ADMIN_EMAIL=admin@example.com
  ADMIN_PASSWORD=changeme123

  # ===========================================
  # Database Configuration
  # ===========================================
  POSTGRES_USER=postgres
  POSTGRES_PASSWORD=postgres
  POSTGRES_DB=nanomon

  # ===========================================
  # Security (required - change in production!)
  # ===========================================
  # Generate with: openssl rand -base64 32
  JWT_SECRET=please-change-this-secret-in-production

  # ===========================================
  # Optional: Custom Ports
  # ===========================================
  # API_PORT=8000
  # DASHBOARD_PORT=80

  # ===========================================
  # Optional: API URL (for production deployments)
  # ===========================================
  # Set this to your public API URL (browser needs to reach it)
  # API_URL=https://api.yourdomain.com/api/v1
  ```
</CodeGroup>
