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.
| Property | Value |
|---|---|
| Directory | apps/backend/logs |
| Port | 8016 |
| Local URL | https://local.reloop.sh/api/logs |
| Swagger UI | https://local.reloop.sh/api/logs/openapi |
| Stack | ElysiaJS 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
| Variable | Required | Default |
|---|---|---|
CLICKHOUSE_URL | YES | http://localhost:8123 |
CLICKHOUSE_USER | YES | default |
CLICKHOUSE_PASSWORD | YES | reloop123 |
CLICKHOUSE_DATABASE | YES | reloop |
REDIS_URL | YES | redis://... |
PORT | YES | 8016 |
NATS_URL | YES | nats://localhost:4222 |
Development Commands
| Command | Description |
|---|---|
bun run --filter=logs dev | Start dev server with hot reloading |
bun run --filter=logs build | Compile production bundle |
bun run --filter=logs start | Run compiled production build |
bun run --filter=logs check-types | TypeScript type-check |
Architecture
| Layer | Detail |
|---|---|
| Ingestion | Subscribes to NATS delivery and tracking events. |
| Storage | Batches writes to ClickHouse logs table (MergeTree). |
| Query API | Powers dashboard analytics (opens, clicks, bounces). |
| Schema | Defined in apps/backend/logs/src/utils/clickhouse.ts. |
Was this page helpful?