Skip to content

gjovanov/purestat

Repository files navigation

Purestat

Pure, clean, honest stats

License: MIT Rust Vue 3


Watch Intro Video

Intro Video: See the full product walkthrough in purestat-intro.mp4 — registration, org setup, site tracking, dashboard, goals, team invites, and billing in under 2 minutes.


Purestat is a privacy-first, cookie-free web analytics platform that gives you accurate website insights without compromising your visitors' privacy. Built with Rust for performance and reliability, it serves as a self-hostable alternative to Plausible and Fathom.

Features

Feature Description
Privacy-first Cookie-free tracking via daily-rotating SHA-256 visitor hashes
Lightweight tracker < 1KB gzipped JS snippet, SPA-aware
Real-time dashboard Live visitor count and activity stream
Goals & conversions Track custom events with properties and revenue
Multi-tenant Organizations with owner/admin/viewer roles
Stripe billing Free, Pro, and Business plans with usage limits
OAuth login Google, GitHub, Facebook, LinkedIn, Microsoft
Dark mode Full dark/light theme support
i18n ready Internationalization via vue-i18n
CSV export Export filtered analytics data
API keys Scoped programmatic access to stats
Invite system Shareable invite links for team onboarding

Tech Stack

Layer Technology
Backend Rust 1.85, Axum 0.8, JWT, argon2
Frontend Vue 3.5, Vuetify 3, Pinia 3, Chart.js
Analytics DB ClickHouse 24 (time-series events & sessions)
Config DB MongoDB 7 (users, orgs, sites, goals)
Cache Redis 7
Tracker TypeScript, Rollup, < 1KB gzipped output
Infra Docker Compose, Caddy 2 (auto-HTTPS)

Architecture

graph TB
    subgraph Client
        Browser[Browser]
        TrackerJS[purestat.js<br/>< 1KB]
    end

    subgraph "Rust Backend"
        API[API Server<br/>Axum 0.8]
        Tracker[Tracker Server<br/>Axum 0.8]
        Services[Services Layer]
        DB[DB Layer / DAOs]
        Config[Config Crate]
    end

    subgraph Databases
        MongoDB[(MongoDB 7<br/>Users, Orgs, Sites)]
        ClickHouse[(ClickHouse 24<br/>Events, Sessions)]
        Redis[(Redis 7<br/>Cache, Sessions)]
    end

    subgraph External
        Stripe[Stripe API]
        OAuth[OAuth Providers]
    end

    Browser -->|SPA| API
    TrackerJS -->|POST /api/event| Tracker
    API --> Services
    Tracker --> Services
    Services --> DB
    DB --> MongoDB
    DB --> ClickHouse
    Services --> Redis
    API --> Stripe
    API --> OAuth
    Config --> API
    Config --> Tracker
Loading

Quick Start

Prerequisites

  • Docker and Docker Compose
  • Rust 1.85+ (with cargo)
  • Bun (for frontend and tracker builds)

1. Clone the repository

git clone https://github.com/purestat/purestat.git
cd purestat

2. Start infrastructure services

docker-compose up -d

This starts MongoDB, ClickHouse, and Redis.

3. Run the backend

cargo run

4. Run the frontend

cd ui
bun install
bun dev

The application will be available at http://localhost:5173 (frontend) with the API at http://localhost:3000.

Full Docker deployment

docker-compose -f docker-compose.full.yml up -d

See docs/deployment.md for production setup with Caddy and auto-HTTPS.

Documentation

Document Description
Architecture Crate graph, request flow, scaling strategy
Data Model MongoDB collections, ClickHouse tables, indexes
API Reference Full endpoint reference with examples
JS Tracker Installation, custom events, technical details
Frontend / UI Vue app structure, stores, components, theming
Testing Integration tests, E2E tests, coverage
Deployment Docker, production, environment variables
Use Cases User flow walkthroughs

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feat/my-feature)
  3. Write tests for your changes
  4. Ensure all tests pass (cargo test -p purestat-tests)
  5. Run cargo fmt and cargo clippy
  6. Commit using conventional commits (feat:, fix:, refactor:, etc.)
  7. Open a pull request

License

This project is licensed under the MIT License.

About

Privacy-first, cookie-free web analytics platform — Rust, Axum, Vue 3, ClickHouse, MongoDB

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors