A minimal, privacy-focused web analytics platform built with modern technologies.
- π Fast & Lightweight: Minimal tracking script with sub-millisecond response times
- π Privacy-First: No cookies, IP hashing, GDPR compliant
- π Real-time Analytics: Live visitor tracking and instant insights
- π¨ Minimal Dashboard: Clean, monochrome interface focused on essential metrics
- π³ Docker Ready: One-command setup with Docker Compose
- π Geolocation: Built-in IP geolocation with multiple fallback options
-
Clone the repository
git clone <repository-url> cd arjuna
-
Create environment file
cp env.example .env
-
Edit your credentials in
.env# Required: Set your admin credentials ADMIN_EMAIL=your-email@example.com ADMIN_PASSWORD=your-secure-password JWT_SECRET=your-random-jwt-secret-key -
Start the application
# Production mode docker-compose up -d # Development mode (with hot reload) docker-compose --profile dev up -d dev
-
Access the dashboard
- Dashboard: http://localhost:3000
- API: http://localhost:3001
-
Prerequisites
- Node.js 18+
- pnpm 10+
- PostgreSQL 15+
- Redis 7+
-
Install dependencies
pnpm install
-
Setup database
# Start PostgreSQL and Redis (or use Docker) pnpm db:up # Run migrations pnpm db:migrate
-
Start development servers
pnpm dev
Add this script to your website's HTML:
<script src="http://localhost:3001/tracker.js" defer></script>Replace localhost:3001 with your production domain.
- Go to http://localhost:3000/login
- Use the credentials from your
.envfile - Add your website domain to start tracking
| Variable | Description | Default |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | postgresql://arjuna:arjuna_dev_password@localhost:5432/arjuna |
REDIS_URL |
Redis connection string | redis://localhost:6379 |
ADMIN_EMAIL |
Dashboard admin email | admin@example.com |
ADMIN_PASSWORD |
Dashboard admin password | your_secure_password_here |
JWT_SECRET |
JWT signing secret | your_jwt_secret_key_here_change_in_production |
PORT |
Collector API port | 3001 |
VITE_API_URL |
Dashboard API URL | http://localhost:3001 |
IPINFO_TOKEN |
IPinfo.io API token (optional) | - |
Arjuna uses a hybrid approach for IP geolocation:
- IPinfo.io API (if token provided) - High accuracy, rate limited
- Local Database - Always available fallback using ip-location-api
To get better geolocation accuracy, sign up for a free IPinfo.io token at https://ipinfo.io/signup and add it to your .env:
IPINFO_TOKEN=your_ipinfo_token_hereβββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Website β β Collector β β Dashboard β
β (tracker.js) βββββΆβ (API) ββββββ (Svelte) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β PostgreSQL β
β + Redis β
βββββββββββββββββββ
- Collector (
apps/collector): Elysia.js API for collecting analytics events - Dashboard (
apps/dashboard): SvelteKit web interface for viewing analytics - Database Package (
packages/db): Drizzle ORM schema and utilities - Geo Package (
packages/geo): IP geolocation resolvers
arjuna/
βββ apps/
β βββ collector/ # Analytics API (Elysia.js)
β βββ dashboard/ # Web dashboard (SvelteKit)
βββ packages/
β βββ db/ # Database schema (Drizzle ORM)
β βββ geo/ # Geolocation utilities
βββ docker-compose.yml # Docker services
βββ Dockerfile # Multi-stage build
βββ turbo.json # Monorepo configuration
# Development
pnpm dev # Start all services in development mode
pnpm build # Build all packages and apps
pnpm lint # Lint all code
pnpm format # Format code with Prettier
# Database
pnpm db:up # Start PostgreSQL and Redis
pnpm db:down # Stop database services
pnpm db:migrate # Run database migrations
pnpm db:studio # Open Drizzle Studio# Production
docker-compose up -d # Start all services
docker-compose down # Stop all services
# Development
docker-compose --profile dev up -d dev # Start development mode
docker-compose logs -f # View logs
# Individual services
docker-compose up -d postgres redis # Database only
docker-compose up -d collector # API only
docker-compose up -d dashboard # Dashboard only- No Cookies: Uses session hashing instead of persistent cookies
- IP Hashing: Client IPs are hashed with user agent for privacy
- No Personal Data: Only collects anonymous usage statistics
- GDPR Compliant: No personal identifiable information stored
- Secure by Default: Environment-based configuration
- Sub-millisecond Tracking: Optimized collection endpoint
- Redis Caching: Fast lookups for websites, sessions, and geolocation
- Local Geolocation: In-memory IP database for instant lookups
- Minimal Footprint: Lightweight tracking script (~2KB)
MIT License - see LICENSE file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
For issues and questions, please open a GitHub issue.