24/7 Sentiment & Signal Aggregation Backend
Always-on monitoring and sentiment analysis for social platforms using LLM-powered insights.
npm installCopy the example file:
cp .env.example .envEdit .env and fill in required values:
nano .env # or use your preferred editorMinimum required configuration:
# REQUIRED - Get from https://openrouter.ai/keys
OPENROUTER_API_KEY=sk-or-v1-YOUR_KEY_HERE
# REQUIRED if using Telegram - Get from @BotFather
TELEGRAM_BOT_TOKEN=1234567890:ABCdefGHIjklMNOpqrsTUVwxyz
# AUTO-GENERATED - Leave blank
ADMIN_API_KEY=
VIEW_API_KEYS=npm startOn first launch:
- Auto-generates
config.tomlwith example configuration - Auto-generates API keys (admin + 10 view) and saves to
.env - Displays admin API key in console - save it!
- Initializes SQLite database
Open your browser and enter your admin API key:
http://localhost:3000
curl http://localhost:3000/api/health-
Platform Connectors
- β Telegram Bot Integration
- β Discord Bot Integration
- β Twitter/X Integration
-
LLM Processing
- β OpenRouter Integration
- β Batch Processing (configurable, default 30 messages)
- β Sentiment Analysis (-100 to +100 scale)
- β Tag Extraction (60+ predefined tags)
-
Aggregation Engine
- β Source-level Aggregates
- β Tracker-level Aggregates (weighted)
- β User-level Aggregates
- β Time Buckets (1min, 5min, 1hour, 1day, 7day)
-
REST API
- β Tracker Endpoints
- β Source Endpoints
- β Snapshot API
- β Time-Series API
- β API Key Authentication
-
Database
- β SQLite with full schema
- β Automatic migrations
- β Cursor-based resumption
- β 30-day rolling debug traces
-
Dashboard
- β Minimal Web UI
- β Health monitoring
- β API documentation links
| Service | Required? | Where to Get |
|---|---|---|
| OpenRouter | π΄ YES | https://openrouter.ai/keys |
| Telegram Bot | π‘ If using Telegram | @BotFather on Telegram |
| Discord Bot | π‘ If using Discord | https://discord.com/developers |
| Twitter API | π‘ If using Twitter | https://developer.twitter.com |
Salt Index automatically generates:
- 1 Admin API key (read-write access)
- 10 View API keys (read-only access)
These keys are:
- Displayed in console during first launch
- Saved to
.envfile - Used to authenticate dashboard and API requests
To view your admin key later:
cat .env | grep ADMIN_API_KEYEdit config/config.toml to:
- Add trackers (monitored subjects)
- Configure sources (Telegram channels, Discord servers)
- Customize enabled tags
- Adjust time buckets
Example:
[[trackers]]
id = "bitcoin-tracker"
name = "Bitcoin Sentiment"
enabled = true
enabled_tags = ["optimism", "fear", "hype", "FUD"]
time_buckets = ["1min", "1hour", "1day"]
[[sources]]
id = "telegram-btc"
tracker_id = "bitcoin-tracker"
platform = "telegram"
target = "@bitcoin"
weight = 1.0-
Send message to bot:
- Open Telegram
- Message
@salt_indexbot - Send: "This is a test! I'm excited!"
-
Check logs:
tail -f logs/salt-index.log
-
Query API:
curl -H "Authorization: Bearer YOUR_ADMIN_KEY" \ http://localhost:3000/api/trackers
curl -H "Authorization: Bearer YOUR_KEY" \
"http://localhost:3000/api/trackers/test-tracker/snapshot?bucket=1hour"Response:
{
"tracker_id": "test-tracker",
"metrics": {
"sentiment": { "score": 45.2 },
"volume": {
"message_count": 124,
"author_count": 87
},
"tags": {
"optimism": 45,
"excitement": 32,
"fear": 12
}
}
}curl -H "Authorization: Bearer YOUR_KEY" \
"http://localhost:3000/api/trackers/test-tracker/timeseries?bucket=1hour&from=2026-01-30T00:00:00Z"See docs/API_SCHEMA.md for complete API documentation.
- docs/ARCHITECTURE.md - System architecture
- docs/API_SCHEMA.md - Complete API reference
- docs/DATABASE_SCHEMA.md - Database structure
- docs/CONFIGURATION.md - Configuration guide
- docs/SETUP.md - Setup and deployment guide
npm run devUses nodemon for auto-restart on file changes.
sqlite3 data/salt_index.db
SELECT * FROM trackers;
.exit# All logs
tail -f logs/salt-index.log
# Errors only
tail -f logs/error.logTelegram:
- Add bot as admin in channel
- Grant "Read Messages" permission
- Or send direct message to
@salt_indexbot
Discord:
- Enable "Message Content Intent" in bot settings
- Make sure bot is in server and has permissions
- Check
OPENROUTER_API_KEYin.env - Verify OpenRouter account has credits
- Check logs for specific error
- Wait for batch processing (default: 60 seconds timeout, configurable via
BATCH_TIMEOUT) - Messages are batched until either:
BATCH_SIZEmessages collected (default: 30), ORBATCH_TIMEOUTseconds elapsed (default: 60)
- Check logs for "Processing batch"
- Verify messages reached connectors (check logs for "queued")
# Build image
docker build -t salt-index .
# Run container
docker run -d \
-p 3000:3000 \
-v $(pwd)/data:/app/data \
-v $(pwd)/config:/app/config \
-v $(pwd)/logs:/app/logs \
--env-file .env \
salt-indexnpm install -g pm2
pm2 start src/index.js --name salt-index
pm2 logs salt-indexCreate .env from .env.example:
cp .env.example .env# REQUIRED for LLM processing
OPENROUTER_API_KEY=sk-or-v1-YOUR_KEY_HERE
OPENROUTER_MODEL=anthropic/claude-3.5-sonnet
# REQUIRED if using Telegram
TELEGRAM_BOT_TOKEN=1234567890:ABCdefGHIjklMNOpqrsTUVwxyz
# OPTIONAL - Only if using Discord
DISCORD_BOT_TOKEN=MTQ2N...
# OPTIONAL - Only if using Twitter
TWITTER_BEARER_TOKEN=...# These are filled automatically on first launch
ADMIN_API_KEY=
VIEW_API_KEYS=PORT=3000
NODE_ENV=development
DATABASE_PATH=./data/salt_index.db
# Batch Processing
BATCH_SIZE=30 # Number of messages to batch for LLM processing
BATCH_TIMEOUT=60 # Maximum time (seconds) to wait before processing incomplete batch
# Logging
LOG_LEVEL=infoSee .env.example for complete documentation with explanations for each variable.
- β Real-time message monitoring
- β LLM-powered sentiment analysis
- β Multi-platform support (Telegram, Discord, Twitter/X)
- β Weighted aggregation across sources
- β Time-bucketed statistics
- β User-level tracking
- β REST API with authentication
- β SQLite database (no external DB needed)
- β Auto-resumption after restarts
- β Configurable tag system
- β Web dashboard
- API keys auto-generated on first launch
- Keys stored in
.env(gitignored) - Admin vs view-only access levels
- No raw message storage (only aggregates)
- Backend: Node.js + Express
- Database: SQLite3
- LLM: OpenRouter (Claude, GPT, Llama, etc.)
- Platforms: Telegram Bot API, Discord.js, Twitter API v2
- Logging: Winston
MIT
- Check logs:
tail -f logs/salt-index.log - Read docs in
docs/folder - See docs/SETUP.md for detailed setup instructions
Built with β€οΈ using Node.js, Express, and SQLite
Bot: @salt_indexbot on Telegram