Privacy-Focused-Web-Analytics-Dashboard

PrivacyMetrics

Privacy-Focused Web Analytics Dashboard

A self-hosted analytics solution designed with privacy at its core. Complete data ownership, no cookies, and transparent data collection practices.

License: MIT Status: Beta TypeScript React Vite Node.js Prisma SQLite


�️ Dashboard Preview

PrivacyMetrics Dashboard

Screenshot coming soon. To see it live: run pnpm dev and open http://localhost:8080.


οΏ½πŸš€ Quick Start

Get started in minutes: πŸ“– DEVELOPER_GUIDE.md

Complete setup guide with:


πŸ’¬ Did This Work for You?

If you cloned this repo and tried it out β€” we’d love to hear from you!

Your feedback directly shapes what gets built next. Even a short β€œit worked!” helps.


✨ Current Features (v1.0.0-beta.1)

βœ… Implemented & Tested

πŸ“‹ Core Data Collected

❌ What is NOT Collected


βš–οΈ How it Compares

PrivacyMetrics vs the most popular privacy-focused analytics tools:

Feature PrivacyMetrics Plausible CE Umami Fathom
Open Source βœ… βœ… βœ… ❌
Self-Hosted βœ… βœ… βœ… ❌
Completely Free βœ… βœ… βœ… πŸ’°
No Cookies βœ… βœ… βœ… βœ…
No PII Collected βœ… βœ… βœ… βœ…
GDPR Compliant βœ… βœ… βœ… βœ…
Multi-site Support βœ… βœ… βœ… βœ…
Tracking Script Size 2KB ~1KB ~2KB ~1KB
Database SQLite PostgreSQL + ClickHouse PostgreSQL / MySQL Proprietary
Setup Time ~5 min ~30 min ~15 min N/A
Tech Stack Node.js + React Elixir + Phoenix Next.js Ruby
Custom Events ❌ (roadmap) βœ… βœ… βœ…
Data Export ❌ (roadmap) βœ… βœ… βœ…
Email Reports ❌ (roadmap) βœ… ❌ βœ…

PrivacyMetrics is the simplest to self-host β€” SQLite means zero database server setup. Clone β†’ install β†’ run.


πŸ—οΈ Tech Stack

Frontend Stack:

Backend Stack:

Tracking Script:


πŸ“ Project Structure

β”œβ”€β”€ client/                 # React frontend (React components, pages, hooks)
β”‚   β”œβ”€β”€ pages/             # Route pages (Dashboard, Login, Register, etc.)
β”‚   β”œβ”€β”€ components/        # Reusable components (UI, dashboard, hero)
β”‚   β”œβ”€β”€ hooks/             # Custom React hooks (useDashboardData, useTheme, etc.)
β”‚   └── lib/               # Utilities and helpers
β”œβ”€β”€ server/                # Express backend
β”‚   β”œβ”€β”€ routes/            # API endpoints (auth, tracking, dashboard, websites)
β”‚   β”œβ”€β”€ services/          # Business logic (tracking, aggregation, auth)
β”‚   β”œβ”€β”€ middleware/        # Authentication middleware
β”‚   └── schemas/           # Zod validation schemas
β”œβ”€β”€ shared/                # Shared TypeScript types and API definitions
β”œβ”€β”€ public/                # Static files and tracking script
β”‚   β”œβ”€β”€ pm.js             # Production tracking script (2KB)
β”‚   └── *.html            # Test HTML files
β”œβ”€β”€ prisma/                # Database schema and migrations
β”‚   β”œβ”€β”€ schema.prisma     # Data model definitions
β”‚   └── migrations/       # Database version history
β”œβ”€β”€ infrastructure/        # Deployment configs
β”‚   β”œβ”€β”€ Dockerfile        # Docker container definition
β”‚   └── *.config files    # Rail way, Netlify configs
β”œβ”€β”€ scripts/               # Utility scripts
β”‚   β”œβ”€β”€ validate-tracking.ps1  # Validation script
β”‚   └── *.sh              # Shell scripts
β”œβ”€β”€ config/                # Build configuration
β”‚   β”œβ”€β”€ vite.config.ts    # Frontend build config
β”‚   └── vite.config.server.ts  # Backend build config
β”œβ”€β”€ config-tools/          # Tool configurations
β”‚   β”œβ”€β”€ .eslintrc.json    # Linting rules
β”‚   β”œβ”€β”€ tailwind.config.ts # Tailwind CSS config
β”‚   └── tsconfig.json     # TypeScript config
└── docs/                  # Documentation (15+ guides)

---

## πŸ”§ Development

### Prerequisites
- Node.js 18.0 or higher
- pnpm (or npm/yarn)

### Installation & Setup

```bash
# 1. Install dependencies
pnpm install

# 2. Initialize database
pnpm db:push   # or: npx prisma db push

# 3. Start development servers
pnpm dev

Access the application:

Common Development Commands

# Development
pnpm dev              # Start both frontend and backend
pnpm dev:frontend     # Frontend only (hot reload)
pnpm dev:api          # Backend only (hot reload)

# Building
pnpm build            # Build client and server
pnpm build:client     # Frontend only
pnpm build:server     # Backend only

# Quality checks
pnpm test             # Run tests
pnpm typecheck        # TypeScript validation
pnpm lint             # Eslint check
pnpm format.fix       # Format code with Prettier
pnpm quality-check    # Run all checks

# Database
pnpm db:push          # Sync database schema
pnpm db:reset         # Reset database
pnpm db:seed          # Seed sample data (if configured)

# Production
pnpm start:prod       # Run production build

πŸ“– Documentation

All technical documentation is located in the docs/ folder:

Document Purpose Audience
DEVELOPER_GUIDE.md Complete setup and development guide All developers
API_DOCUMENTATION.md REST API reference with examples Backend developers
BACKEND_SETUP_GUIDE.md Backend configuration and setup Backend developers
FRONTEND_BACKEND_INTEGRATION_GUIDE.md How frontend connects to API Frontend developers
TRACKING_SCRIPT_GUIDE.md How to integrate tracking on websites Website integrations
TRACKING_QUICK_REFERENCE.md Quick tracking reference Quick setup
WEBSITE_MANAGEMENT_GUIDE.md Website CRUD operations Website operations
PROJECT_STRUCTURE.md Detailed project architecture All developers
CODE_QUALITY_SCANNING_GUIDE.md Code quality and CI/CD setup DevOps/QA
FREE_HOSTING_GUIDE.md Deployment options (free tier) DevOps/Deployment

Quick Links:


πŸ” Security & Privacy

Privacy by Design

βœ… No Cookies - Never sets any tracking cookies
βœ… No Fingerprinting - Only uses hashed IP addresses for visitor identification
βœ… Session-Based Storage - Data expires with browser session
βœ… No Cross-Site Tracking - Each website is completely isolated
βœ… Transparent Collection - Clear documentation on what data is collected
βœ… Self-Hosted Option - Full control and data ownership

Backend Security

βœ… JWT Authentication - Secure token-based API authentication
βœ… Password Hashing - Bcryptjs for secure password storage
βœ… CORS Protection - Proper cross-origin request validation
βœ… Protected Routes - Authentication middleware on API endpoints
βœ… Input Validation - Zod schemas for request validation

Data Protection


πŸ“¦ Deployment

Ready to deploy? Choose your platform:

Quick Deployment Options

Detailed deployment guide: FREE_HOSTING_GUIDE.md


πŸ› Issues & Support

Found a bug? Have a feature request?


πŸ“‹ Project Status

v1.0.0-beta.1 (Current)

What’s Working:

Known Limitations:

Future Roadmap:


πŸ“ License

MIT License - See LICENSE file for full details

All documentation is in one place: DEVELOPER_GUIDE.md

For internal notes and older docs: See confidential_docs/ folder


πŸ“£ Give Feedback

Discussions are open β€” this is the best place to share thoughts, ask questions, or suggest improvements.

Channel Use it for
πŸ’‘ Ideas Feature requests and suggestions
πŸ™‹ Q&A Setup help and how-to questions
πŸŽ‰ Show & Tell Share what you built with it
πŸ’¬ General Anything else

β†’ Open a Discussion


🀝 Contributing

Contributions are welcome! Read the full guide: CONTRIBUTING.md

Quick steps:

  1. Fork β†’ create a branch β†’ make changes β†’ pnpm quality-check β†’ open a PR

Please review our Code of Conduct before contributing.


Repository:

Documentation:

External Resources:


πŸ’‘ Philosophy

PrivacyMetrics is built on the principle that analytics don’t require invasive tracking. We believe:


Made with ❀️ for privacy-conscious developers

Questions? Start with DEVELOPER_GUIDE.md, join the discussion, or open an issue. πŸš€