by Rowan E.

Ackee is a self-hosted, Node.js and MongoDB analytics server that tracks website traffic without cookies or unique user identification, delivering anonymized insights via a GraphQL API.
This block provides the complete Ackee self-hosted analytics server: a Node.js/Express application backed by MongoDB and exposed via a GraphQL API. It is aimed at developers who want to embed privacy-respecting web analytics directly into an existing Node.js backend or deploy it as a standalone service. The server handles visitor records, domain management, event tracking, token authentication, and aggregated statistics.
aggregations/ - MongoDB aggregation pipeline runners for views, actions, durations, active visitors, and top recordsconstants/ - Enumeration modules for browsers, devices, intervals, ranges, sortings, referrers, and moredatabase/ - Low-level CRUD helpers for every MongoDB collection (actions, domains, records, tokens, etc.)middlewares/ - Express middleware: blockDemoMode and requireAuthmodels/ - Mongoose model definitions: Action, Domain, Event, PermanentToken, Record, Tokenresolvers/ - GraphQL resolver map merged with @graphql-tools/merge; one module per entitystages/ - Reusable MongoDB aggregation stage builders (matchDomains, matchLimit, projectDuration, etc.)types/ - GraphQL SDL type definitions merged with @graphql-tools/mergeui/ - Server-rendered HTML shell, compiled SCSS/JS assets, and the bundled ackee-tracker client scriptutils/ - Internal utilities: config loader, MongoDB connector, signale logger, URL helpers, layout rendererhealthcheck.js - HTTP healthcheck script used by Docker/container orchestrationindex.js - Application entry point: connects to MongoDB then starts the HTTP serverserver.js - Builds and exports the configured Express + Apollo Server HTTP serverserverless.js - Serverless-compatible handler export (Netlify/Vercel)npm install @apollo/server @as-integrations/express5 @graphql-tools/merge \
ackee-tracker date-fns date-fns-tz debounce-promise express graphql \
graphql-scalars graphql-tag is-url is-valid-domain mongoose node-schedule \
normalize-url request-ip sanitize-filename signale uuid
Spin up an isolated sandbox and run it server-side — no local setup.
Tetrees AI Review of this version
This JavaScript cli / script completed archive review. Structure, dependency manifests, documentation, functional source, and common risk patterns were checked by the Tetrees verification pipeline; runtime phases are stated separately.
Deterministic AVCP artifact review
Pipeline avcp-2026-08-04.1 · SHA-256 d0cdbd326f50b5e1…
This version-scoped review deterministically inspects the submitted archive for structure, dependencies, documentation, functional source, and common malicious or high-risk signals. Build and test phases are reported as passed only after an isolated sandbox audition. It is not a guarantee of perfect security.
Reviewed Aug 4, 2026
Push this product straight into your AI IDE, web builder or cloud IDE.
Connect Tetrees to a compatible AI IDE, list products you own, and request the verified ZIP without exposing seller upload controls.
No reviews yet.
Sign in to join the discussion
Loading discussion…
No native modules, pod installs, or Android linking are required. Node.js 18+ is recommended (the source uses import.meta.dirname and top-level ESM).
source/ directory into your project root, e.g. ./ackee/.package.json includes "type": "module" — all source files use ESM syntax.allowImportingTsExtensions is not needed because the source is plain JS. Set "moduleResolution": "bundler" or "node16" and "allowJs": true in tsconfig.json..env file (or export environment variables):# Minimum required
MONGODB_URI=mongodb://localhost:27017/ackee
PORT=3000
# Optional
ACKEE_USERNAME=admin
ACKEE_PASSWORD=secret
ACKEE_ALLOW_ORIGIN=https://yoursite.com
ACKEE_TRACKER=custom
NODE_ENV=development # enables isDevelopmentMode
ACKEE_DEMO=true # enables isDemoMode (read-only)
utils/config.js module reads process.env directly; no additional config file is needed.node ackee/index.js
For serverless targets (Vercel/Netlify), export the handler from ackee/serverless.js instead.
import server from './ackee/server.js'
// server: http.Server (Express + Apollo integrated)
The configured HTTP server. Attach listening and error event listeners, then call server.listen(port). Used by index.js after the MongoDB connection is established. Import directly when you want to embed Ackee's server into an existing process manager.
import connect from './ackee/utils/connect.js'
// connect(dbUrl: string): Promise<typeof mongoose>
Establishes the Mongoose connection to MongoDB. Must be awaited before calling server.listen(). Returns the mongoose instance; throws on connection failure.
import { index, styles, scripts, tracker, build } from './ackee/ui/index.js'
index(): string // returns the HTML shell string
styles(): Promise<string> // compiles SCSS to CSS
scripts(): Promise<string> // bundles frontend JS
tracker(): Promise<string> // reads ackee-tracker client bundle
build(outputPath: string, fn: () => Promise<string>): Promise<void>
These functions generate and optionally write the UI assets to disk. build is used at startup or in a pre-build step to emit static files. Call styles() and scripts() only when optional peer dependencies rosid-handler-sass and rosid-handler-js-next are installed.
Start the Ackee HTTP server after connecting to MongoDB, mirroring what index.js does, but embedded inside your own startup sequence.
// src/startAckee.ts
import server from './ackee/server.js'
import connect from './ackee/utils/connect.js'
const DB_URL = process.env.MONGODB_URI ?? 'mongodb://localhost:27017/ackee'
const PORT = Number(process.env.PORT ?? 3000)
export async function startAckee(): Promise<void> {
await connect(DB_URL)
await new Promise<void>((resolve, reject) => {
server.on('error', reject)
server.listen(PORT, () => {
console.log(`Ackee listening on http://localhost:${PORT}`)
resolve()
})
})
}
Use the pre-wired serverless export so you do not need to manage the HTTP server lifecycle.
// api/analytics.ts (Vercel Edge/Serverless function)
// Vercel expects a default export that is a request handler
export { default } from '../ackee/serverless.js'
In vercel.json:
{
"functions": {
"api/analytics.ts": { "memory": 512 }
},
"env": {
"MONGODB_URI": "@mongodb_uri",
"ACKEE_USERNAME": "@ackee_username",
"ACKEE_PASSWORD": "@ackee_password"
}
}
Write compiled CSS and JS to a dist/ folder during your CI build step so the server can serve them as static files.
// scripts/buildUi.ts
import path from 'node:path'
import { styles, scripts, tracker, build } from './ackee/ui/index.js'
await build(path.resolve('dist/index.css'), styles)
await build(path.resolve('dist/index.js'), scripts)
await build(path.resolve('dist/tracker.js'), tracker)
console.log('UI assets written to dist/')
Run with: node --loader ts-node/esm scripts/buildUi.ts
index.js - Entry point: validates env, connects Mongoose, starts server.listen.server.js - Constructs the Express app, mounts Apollo Server middleware and UI routes.serverless.js - Wraps the Express app for serverless function environments.healthcheck.js - Fires an HTTP GET to localhost:{PORT}/ and exits 0/1; used by Docker HEALTHCHECK.resolvers/index.js - Merges all entity resolvers into one resolver map via @graphql-tools/merge.types/index.js - Merges all GraphQL SDL type-def modules into a single DocumentNode.aggregations/ - Each file runs a MongoDB aggregation pipeline and returns computed stats (views, actions, durations, active visitors, top records).constants/ - Pure value exports (arrays/objects) for browsers, devices, intervals, ranges, sortings, referrers, sizes, systems, views.database/ - Thin async functions wrapping Mongoose queries for each collection; called by resolvers.middlewares/ - requireAuth validates Bearer tokens; blockDemoMode returns 403 in demo mode.models/ - Mongoose schemas and model constructors for Action, Domain, Event, PermanentToken, Record, Token.stages/ - Helper functions returning MongoDB aggregation stage objects (match, limit, project).ui/ - Server-side asset pipeline plus the React frontend application under ui/scripts/.utils/ - Config reader, Mongoose connector, signale logger instance, URL sanitization helpers, HTML layout generator."type": "module" missing: All source files use bare ESM import; without this in package.json Node.js will throw SyntaxError. Fix: add "type": "module" to your package.json.MONGODB_URI not set: index.js calls process.exit(1) immediately if config.dbUrl is null. Fix: ensure the env var is exported before the process starts or loaded via a .env file using a package like dotenv loaded before import.rosid-handler-sass / rosid-handler-js-next not installed: ui.styles() and ui.scripts() do a dynamic import() of these packages; they are not listed in package.json because they are optional build-time deps. Fix: npm install rosid-handler-sass rosid-handler-js-next if you want server-side asset compilation.@apollo/server v4 with @as-integrations/express5. Do not mix with apollo-server-express v2/v3 APIs. Fix: use @as-integrations/express5 exactly as imported in server.js.signale: signale ships CJS; if bundlers complain, add "signale" to esmExternals or use createRequire. Fix: the source already handles this internally; do not re-export signale through a CJS wrapper.import.meta.dirname requires Node 20.11+: ui/index.js uses import.meta.dirname. Fix: upgrade to Node 20.11+ or polyfill with const __dirname = new URL('.', import.meta.url).pathname.I have the Ackee analytics server source checked out at `./ackee/` inside my
project, and a usage guide at `./USAGE.md`. The upstream package is `user@example.com`.
Please help me integrate it into my existing Node.js project step-by-step:
1. Read `USAGE.md` fully before writing any code.
2. Identify which files in `./ackee/` I need to import for my goal: [describe goal, e.g. "embed the GraphQL API into my existing Express app"].
3. Show me the exact imports using the real exported symbols documented in USAGE.md.
4. Write runnable ESM TypeScript/JavaScript code that wires the Ackee server (or the specific modules I need) into my existing `src/app.ts`.
5. List any additional environment variables I must set.
6. Point out any dependency version conflicts with my current `package.json`.
7. Do not invent any API names; only use symbols present in `USAGE.md` or directly visible in the source files under `./ackee/`.
Ackee is released under the MIT License. See source/LICENSE if present, or refer to the upstream repository for the full license text.
Upstream project: Ackee on GitHub - package user@example.com.
This product’s unique contribution is clean room implementation of valuable code block into AVCP compatible standard.
The full install guide and integration prompts unlock after purchase.
PHP, Laravel & Business Scripts
Free