$ show electerious/Ackee
Ackee is a self-hosted, privacy-focused web analytics tool. It tracks page views, durations, referrers, browsers, devices, operating systems, screen sizes, languages, and custom events without using cookies or collecting personally identifiable information. Visitor identity is anonymized via SHA-256 hashing of IP + user agent + domain ID with a daily rotating salt. The architecture is a full-stack Node.js application: an Express server with Apollo Server for GraphQL, a React single-page application frontend (using `createElement` instead of JSX), and MongoDB for persistence. The backend provides a GraphQL API for querying aggregated statistics and managing domains, events, and authentication tokens. The frontend consumes this API via Apollo Client and renders a dashboard with reusable card and presentation components. Key design patterns include a `pipe` utility for chaining resolver middleware (auth, demo mode blocking), modular MongoDB aggregation stages stored in `src/stages/`, and a custom build pipeline using Rosid handlers. The application supports multiple deployment targets: Docker, Heroku, Vercel, Netlify, and manual Node.js processes.
The LLM identified 3 files worth highlighting for reuse:
A generic `pipe` function that chains resolver functions sequentially, passing the result of each step as input to the next. Used throughout the resolvers to compose authentication, demo mode blocking, and actual logic. Extractable as a standalone utility for any Node.js middleware pipeline.
Provides timezone-aware date calculations for last hours, days, months, and years with configurable tolerances. Leverages the `Time-Zone` HTTP header to compute date ranges in the user's local time. Reusable in any application needing timezone-sensitive date math without external dependencies.
A reusable MongoDB aggregation stage that filters documents by an array of domain IDs. Part of a family of modular pipeline stages (`matchDomains`, `matchEvents`, `projectDuration`, `projectMinInterval`) that can be composed to build arbitrary analytics aggregations. Each stage is a pure function returning a MongoDB aggregation stage object, making them unit-testable and framework-agnostic.