---
title: "Deploy Sparkz Discord Analytics"
description: "Deploy and Host Sparkz Discord Analytics with Railway."
category: "Analytics"
url: https://railway.com/deploy/sparkz-discord-analytics
---

# Deploy Sparkz Discord Analytics

Deploy and Host Sparkz Discord Analytics with Railway.

**[Deploy Sparkz Discord Analytics on Railway](https://railway.com/template/sparkz-discord-analytics)**

- **Creator:** clapfy's Projects
- **Category:** Analytics
- **Total deploys:** 1

## Template content

### AnalyticsDB https://devicons.railway.app/ClickHouse?variant=light

- **Image:** clickhouse/clickhouse-server:25.8
- **Health check:** /ping
- **Public domain:** Yes

### Sparkz-Discord-Analytics

- **Source:** https://github.com/ClapFy/Sparkz-Discord-Analytics

## Documentation

# Deploy and Host Sparkz Discord Analytics on Railway

Sparkz Analytics is a **Discord analytics** stack: a **silent bot**, **ClickHouse** for storage, and a **password-protected Next.js** dashboard. It tracks **metadata and events** (members, voice, reactions, channel activity)—**not message bodies**. This template provisions **AnalyticsDB** (ClickHouse) and **Sparkz-Discord-Analytics** together. You supply **Discord** credentials (`DISCORD_BOT_TOKEN`, `DISCORD_GUILD_ID`), dashboard **`ADMIN_USERNAME`** / **`ADMIN_PASSWORD`**, and can use **`${{secret(...)}}`** for **`NEXTAUTH_SECRET`** so Railway generates the session signing secret. After deploy, open the public URL, sign in, and use the draggable dashboard tiles.

## About Hosting Sparkz Analytics on Railway

The app service runs **`start:railway`**: the compiled **discord.js** bot in the background and **Next.js** on **`PORT`** with **`0.0.0.0`**. **Nixpacks** builds from the monorepo root (`npm ci`, `npm run build` for both workspaces). **ClickHouse** is reached over the **private network** (typically HTTP on **8123**, **`CLICKHOUSE_SECURE=false`**). On first boot the bot can run DDL from **`clickhouse/migrations/001_init.sql`** against **`CLICKHOUSE_DATABASE`** (unless **`SKIP_SCHEMA_ENSURE=true`**). Health checks use **`/api/health`**. **Message Content Intent** stays off in Discord; the stack uses **`Guilds`**, **`GuildMessages`**, **`GuildVoiceStates`**, **`GuildMessageReactions`**, and optionally **Server Members** for larger servers.

## Why Deploy Sparkz Analytics on Railway

Railway gives **private DNS** between services, a **public HTTPS URL** for the dashboard, and **repeatable** deploys from GitHub. You avoid operating ClickHouse and Node yourself while keeping analytics data in **your** project. Template variables can fix **ports**, **database name**, and **cross-service references** (`${{AnalyticsDB.*}}`) so new projects wire correctly without hand-copying hosts and passwords.

## Dependencies for Hosting Sparkz Analytics

- A **Discord application** with a **bot user** and the **intents** your guild needs (see repo README for the full list).
- **Node.js 20+** for build/runtime (provided by Nixpacks).
- **ClickHouse** (`clickhouse/clickhouse-server` or equivalent) with a **volume** for persistence where you want durable data.
- **GitHub** (or your source) connected to the **Sparkz-Discord-Analytics** service, **root directory** = repo root.

### Deployment Dependencies

- **Monorepo root** `nixpacks.toml` / `railway.toml` and **`npm run start:railway`**.
- **AnalyticsDB** variables: internal **PORT** **8123**, **PUBLIC_PORT** **443**, **`CLICKHOUSE_DB`** aligned with **`CLICKHOUSE_DATABASE`** on the app.
- **Secrets**: Discord token and guild ID; **`NEXTAUTH_SECRET`** or **`${{secret(64, "abcdef0123456789")}}`**; ClickHouse password via **`${{AnalyticsDB.CLICKHOUSE_PASSWORD}}`** (or equivalent service name).

## Common Use Cases

- **Server owners and moderators** who want joins, leaves, voice time, reactions, and per-channel activity without ingesting or storing message bodies.
- **Privacy-conscious communities** that prefer analytics on metadata only (IDs, timestamps, attachment/embed counts, flags)—no message content stored in ClickHouse.
- **Single-guild focus** operations: the bot targets one **`DISCORD_GUILD_ID`** and leaves other servers, suitable for a dedicated community or brand server.
- **Self-hosted analytics** on Railway instead of third-party Discord analytics SaaS, with data in your own ClickHouse database.
- **Power users and builders** who want append-only event data in ClickHouse for custom SQL, exports, or tooling beyond the bundled draggable dashboard.


## Similar templates

- [Betterlytics](https://railway.com/deploy/betterlytics) — Betterlytics is a cookieless analytics platform GDPR-compliant.
- [Finance Tracker](https://railway.com/deploy/finance-tracker-1) — Private multi-user household finance ledger with budgets and CSV import.
- [Matomo Analytics + MariaDB](https://railway.com/deploy/matomo-analytics-mariadb) — Privacy-friendly analytics with MariaDB and persistent volumes.

Open this page in a browser: https://railway.com/deploy/sparkz-discord-analytics
