Logs

Set up, configure, and run the Reloop logs microservice locally.

Complete Base Setup First

Ensure you've finished the Setup and have ClickHouse running (bun docker:up).

Service Overview

Event logging and analytics — ingests delivery/tracking events into ClickHouse.

PropertyValue
Directoryapps/backend/logs
Port8016
Local URLhttps://local.reloop.sh/api/logs
Swagger UIhttps://local.reloop.sh/api/logs/openapi
StackElysiaJS ClickHouse Redis NATS

Quick Start

Run from the monorepo root:

bun run --filter=logs dev

The service starts with hot reloading on port 8016.

Environment Configuration

Variables live in apps/backend/logs/.env. Running bun env:setup from the root auto-populates this file.

CLICKHOUSE_URL=http://localhost:8123
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=reloop123
CLICKHOUSE_DATABASE=reloop
REDIS_URL=redis://:reloop123@localhost:6379
PORT=8016
BASE_URL="https://local.reloop.sh"
NATS_URL=nats://localhost:4222
NODE_ENV=development

Reference Table

VariableRequiredDefault
CLICKHOUSE_URLYEShttp://localhost:8123
CLICKHOUSE_USERYESdefault
CLICKHOUSE_PASSWORDYESreloop123
CLICKHOUSE_DATABASEYESreloop
REDIS_URLYESredis://...
PORTYES8016
NATS_URLYESnats://localhost:4222

Development Commands

CommandDescription
bun run --filter=logs devStart dev server with hot reloading
bun run --filter=logs buildCompile production bundle
bun run --filter=logs startRun compiled production build
bun run --filter=logs check-typesTypeScript type-check

Architecture

LayerDetail
IngestionSubscribes to NATS delivery and tracking events.
StorageBatches writes to ClickHouse logs table (MergeTree).
Query APIPowers dashboard analytics (opens, clicks, bounces).
SchemaDefined in apps/backend/logs/src/utils/clickhouse.ts.

Was this page helpful?

Edit this page