Skip to content

Latest commit

 

History

History
146 lines (104 loc) · 3.47 KB

File metadata and controls

146 lines (104 loc) · 3.47 KB

ErrorSight API

Self-hosted observability backend for ErrorSight SDKs. Written in Go with support for SQLite (default) and PostgreSQL.

Features

  • OAuth2 client credentials flow for SDK authentication
  • JWT-based admin authentication with refresh tokens
  • Single-registration mode (first user becomes admin, then locks)
  • Log ingestion with batch support
  • Screenshot upload and storage
  • Gotify push notification integration
  • Dashboard stats, top exceptions, and daily error trends
  • Configurable via environment variables

Requirements

  • Go 1.26+ (for local development)
  • Docker & Docker Compose (for deployment)

Quick Start (Docker)

  1. Clone the repository:
git clone https://github.com/ErrorSight/api.git
cd api
  1. Create your environment file:
cp .env.example .env

Edit .env and set a strong ES_JWT_SECRET.

  1. Start the development stack (SQLite):
docker-compose up -d
  1. Start the production stack (PostgreSQL + Traefik + Redis + Gotify):
docker-compose -f docker-compose.prod.yml up -d

The API will be available at http://localhost:8080 in development, or at your configured DOMAIN in production.

Configuration

All configuration is done via environment variables:

Variable Default Description
DOMAIN api.errorsight.io Domain served by Traefik
ACME_EMAIL contact@errorsight.io Let's Encrypt contact email
ES_SERVER_PORT 8080 HTTP server port
ES_DATABASE_DSN host=db ... PostgreSQL connection string
ES_REDIS_ADDR redis:6379 Redis server address
ES_REDIS_PASSWORD - Redis password (optional)
ES_JWT_SECRET - Required. Secret key for signing JWTs
ES_JWT_ACCESS_TTL 15m Access token lifetime
ES_JWT_REFRESH_TTL 168h Refresh token lifetime
ES_BASE_URL https://api.errorsight.io Base URL for screenshot links
ES_STORAGE_PATH /data/screenshots Screenshot storage directory
ES_GOTIFY_URL http://gotify:80 Internal Gotify URL
ES_GOTIFY_APP_TOKEN - Gotify application token
ES_GOTIFY_ENABLED true Enable push notifications
GOTIFY_USER admin Gotify admin username
GOTIFY_PASS admin Gotify admin password

Gotify Setup

After starting the production stack:

  1. Obtain a Gotify app token by creating an application inside Gotify.
  2. Set ES_GOTIFY_APP_TOKEN in your .env.
  3. Restart the API: docker-compose -f docker-compose.prod.yml restart api.

API Endpoints

Health

GET /health

Authentication

POST /api/v1/auth/register    # First user only
POST /api/v1/auth/login
POST /api/v1/auth/refresh

Admin

GET    /api/v1/admin/config
PATCH  /api/v1/admin/config

Projects

POST   /api/v1/projects
GET    /api/v1/projects
GET    /api/v1/projects/:id
PATCH  /api/v1/projects/:id
DELETE /api/v1/projects/:id

Dashboard

GET /api/v1/dashboard/stats
GET /api/v1/dashboard/top-exceptions?limit=10
GET /api/v1/dashboard/daily-errors?days=30

OAuth2 (SDK)

POST /oauth/token             # client_credentials

Log Ingestion (SDK)

POST /v1/logs
GET  /v1/logs?level=ERROR&limit=50
POST /v1/screenshots

SDK Compatibility

This API is designed to work with the official ErrorSight SDKs:

License

MIT License. Copyright (c) 2026 Aztekode.