Admin analytics overview
The analytics endpoint aggregates user data across the entire platform and returns a summary of key metrics.Metrics explained
Total users
The total number of registered accounts on the platform, regardless of plan or activity status.
Active users
Users with
isDisabled: false. These accounts can log in and use the platform normally.Inactive users
Users with
isDisabled: true. These accounts have been deactivated by an admin and cannot log in.Paid users
Users currently on the Pro plan with an active Stripe subscription.
Monthly growth
Percentage growth in registered users over the past month.
Top plan
The most common subscription plan across all users — either
"Free" or "Professional".Monitoring platform health
Beyond the analytics endpoint, a healthy Hayon deployment depends on several background services. Use the following checklist when diagnosing platform issues.MongoDB connection
MongoDB connection
All user data, posts, subscription state, and usage counters are stored in MongoDB. A failed or slow MongoDB connection will cause
500 errors across all API routes. Monitor connection pool health and query latency, especially on findAllUsers queries which scan the entire users collection.Redis availability
Redis availability
Redis is used for session caching and rate limiting. If Redis goes down, request throttling may stop working, potentially exposing the API to abuse. Check Redis connectivity and memory usage.
RabbitMQ workers
RabbitMQ workers
Post scheduling in Hayon relies on RabbitMQ queues and background worker processes. If workers stop consuming, scheduled posts will queue up but not publish. Monitor queue depth and consumer count in the RabbitMQ management UI.
Stripe webhook delivery
Stripe webhook delivery
Subscription upgrades, renewals, and cancellations are all driven by Stripe webhooks. If the
/api/payments/webhook endpoint is unreachable or returning errors, subscription state will fall out of sync. Check the Stripe Dashboard under Developers → Webhooks for failed delivery attempts and replay them if needed.AWS S3 media uploads
AWS S3 media uploads
Post media (images, videos) is stored in AWS S3. Monitor bucket availability and IAM key validity. A failed S3 upload will prevent media-rich posts from being created.
Hayon uses structured logging via a
logger utility throughout the backend. Application logs are your primary diagnostic tool. Set the log level to debug in development for full request and event traces.Viewing system-wide post statistics
Post statistics are aggregated at the user level through theusage field on each user document. To understand platform-wide posting activity:
- Call
GET /api/admin/get-all-usersto retrieve all user records. - Aggregate
usage.postsCreatedandusage.captionGenerationsacross all users. - Compare against
limits.maxPostsandlimits.maxCaptionGenerationsto identify users approaching their limits.
Managing platform connections across users
Social platform connections (Bluesky, Tumblr, Facebook, Threads, Mastodon) are stored per user. As an admin, you can investigate connection issues by:- Retrieving the user’s full document via
GET /api/admin/get-all-usersand inspecting their platform credentials. - Deactivating accounts that are abusing platform integrations using
PATCH /api/admin/update-user-activity/:id. - Revoking Pro access for accounts suspected of exceeding fair-use thresholds using
PATCH /api/admin/update-user-plan/:id.
Platform OAuth tokens are stored per user and are not visible to other users. Admins can see account metadata but platform credentials are encrypted at rest.
Rate limiting configuration
Hayon enforces two categories of rate limits:Plan-based usage limits
Enforced at the middleware layer via
checkUserPostLimit and checkUserGenerationLimit. These limits are stored on the user document and checked on every relevant API call.Network-level rate limiting
Configured via Redis-backed middleware on the Express server. This protects against API abuse and DDoS patterns by limiting the number of requests per IP or token within a time window.
PLAN_LIMITS configuration in src/config/plans.ts:
Background worker monitoring
Hayon uses RabbitMQ-backed background workers to process scheduled posts. Key things to monitor:Check queue depth
In the RabbitMQ management UI, navigate to Queues and verify that your scheduled post queue is being consumed. A growing queue with no consumers indicates workers are down.
Inspect failed messages
Dead-lettered messages in the DLQ (Dead Letter Queue) represent posts that failed to publish after retry attempts. Review these regularly and cross-reference with application logs to identify recurring platform API failures.
Restart workers if needed
Workers are independent Node.js processes. If a worker crashes, restart it using your process manager (PM2, systemd, or Docker). Workers automatically reconnect to RabbitMQ on startup.
