Prerequisites
Before you start, make sure the following are available on your machine:Node.js v20+ and pnpm v9+
Node.js v20+ and pnpm v9+
Hayon uses pnpm workspaces. Install Node.js from nodejs.org (v20 LTS recommended), then install pnpm:Verify both:
MongoDB
MongoDB
Hayon stores all application data in MongoDB. You can run it locally or use MongoDB Atlas.To run locally, follow the MongoDB installation guide for your OS, then start the service:The default connection URI is
mongodb://localhost:27017/hayon.Redis
Redis
Redis is used for caching and session-related data. The backend connects using Default:
REDIS_HOST and REDIS_PORT.localhost:6379.RabbitMQ with delayed message exchange plugin
RabbitMQ with delayed message exchange plugin
RabbitMQ processes all post and analytics jobs. Hayon requires the Enable the delayed message plugin:
rabbitmq_delayed_message_exchange plugin for scheduled posts.Installation
Clone the repository
If you previously installed dependencies with npm, remove any
node_modules directories and package-lock.json files before continuing. Hayon has migrated fully to pnpm.Install all workspace dependencies
From the repository root, install dependencies for the entire monorepo at once:This installs packages for both
backend/ and frontend/ using pnpm workspaces.Configure the backend environment
Create a Populate it with the following variables:
.env file inside backend/:You don’t need every API key to get started locally. The minimum required set for the server to boot is:
NODE_ENV, PORT, FRONTEND_URL, BACKEND_URL, MONGODB_URI, ACCESS_TOKEN_SECRET, REFRESH_TOKEN_SECRET, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_CALLBACK_URL, REDIS_HOST, REDIS_PORT, RABBITMQ_URL, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, AWS_S3_BUCKET_NAME, STRIPE_SECRET_KEY, STRIPE_PUBLISHABLE_KEY, STRIPE_WEBHOOK_SECRET, STRIPE_PRO_PRICE_ID, EMAIL_USER, EMAIL_PASS, META_APP_ID, META_APP_SECRET, META_REDIRECT_URI, THREADS_APP_ID, THREADS_APP_SECRET, THREADS_REDIRECT_URI, TUMBLR_CONSUMER_KEY, TUMBLR_CONSUMER_SECRET, MASTODON_CLIENT_KEY, MASTODON_CLIENT_SECRET, MASTODON_CALLBACK_URL, MASTODON_INSTANCE_URL, GEMINI_API_KEY, and BETTER_STACK_TOKEN. These are enforced as required in backend/src/config/env.ts.Configure the frontend environment
Create a
.env.local file inside frontend/:NEXT_PUBLIC_API_BASE_URL is the base URL that the Next.js app uses for all API requests. It must match the BACKEND_URL you configured in the backend .env.Start the backend server
nodemon for hot-reloading. On startup it:- Connects to MongoDB
- Connects to Redis
- Connects to RabbitMQ and asserts all exchanges and queues
- Starts the analytics cron job (
AnalyticsCronService) - Initialises Socket.IO on the same HTTP/HTTPS server
Start the background worker
Open a second terminal and start the worker process separately from the web server:The worker connects to RabbitMQ and begins listening on the
social_posts and analytics_fetch queues. You should see:The web server and worker are independent processes. The web server enqueues jobs; the worker consumes them. Both must be running for posts to be published.
Start the frontend
First login
Hayon supports two authentication methods:- Google OAuth — Click Sign in with Google on the login page. Passport.js handles the OAuth flow; on first login a new user record is created automatically in MongoDB.
- Email / password — Register with an email address and password. An OTP verification email is sent via Nodemailer (Gmail).
Connect a social platform
Before creating a post, connect at least one social media account:Authorise the platform
Click Connect next to the platform you want to add (Bluesky, Facebook, Threads, Tumblr, or Mastodon). You’ll be redirected to that platform’s OAuth consent screen.
Create and publish your first post
Write your content
Type your post text in the composer. You can also upload an image, which Hayon will upload to AWS S3 and attach to the post payload.
Generate an AI caption (optional)
Click Generate Caption. Hayon sends your content to Google Gemini and returns platform-specific caption suggestions. Select the one you want or edit it freely.
Caption generation counts against your monthly allowance (15 on Free, 30 on Pro). The current usage is shown in the composer.
Select target platforms
Choose one or more connected platforms. Each platform you select will receive an independent job in the queue, so a failure on one platform does not block others.
Publish immediately or schedule
- Publish now — The backend publishes a message to
POST_EXCHANGEwith no delay. The worker picks it up within seconds. - Schedule — Choose a future date and time. The backend publishes a message to
POST_DELAYED_EXCHANGEwith the appropriate delay header. RabbitMQ holds the message until the scheduled time, then routes it to the worker.
Monitor the result
After submission, return to the Posts list. Each post shows per-platform status badges:
processing, completed, or failed. Real-time updates arrive via WebSocket without requiring a page refresh.If a post fails due to a transient network error, the worker automatically retries up to three times with exponential back-off before marking it as permanently failed.Running both services together
If you prefer to start the backend and frontend with a single command from the repo root:This starts the web server and the Next.js dev server concurrently, but does not start the worker. You still need to run
pnpm run worker in a separate terminal in the backend/ directory.Next steps
Architecture
Understand how the components connect and how jobs flow from creation to publishing.
Platform integrations
Read platform-specific setup guides for Bluesky, Facebook, Threads, Tumblr, and Mastodon.
Environment variables
Full reference for every environment variable the backend reads at startup.
Subscription plans
Understand Free vs Pro limits and how to upgrade via Stripe.
