Skip to main content
This guide helps you deploy the complete AiToEarn application quickly with Docker Compose.

Service Architecture

Prerequisites

  • Docker: 20.10+
  • Docker Compose: 2.0+
  • System memory: 4GB+ recommended
  • Disk space: 20GB+ recommended
Verify the installation:

Authentication Secrets

docker-compose.yml and the two config.yaml files no longer ship default authentication secrets. You must configure the following three values before starting; otherwise Compose fails immediately or the services exit after configuration validation. Requirements: at least 32 characters with no whitespace characters such as spaces or line breaks. Compose and the services validate this at startup and refuse to run otherwise.

Generate secrets

openssl rand -hex 32 produces a 64-character hexadecimal string that satisfies the length requirement.

Write the configuration

Edit both configuration files:
  • project/aitoearn-backend/apps/aitoearn-ai/config/config.yaml
  • project/aitoearn-backend/apps/aitoearn-server/config/config.yaml
Set the auth section in each file to:
Then update the AI client token in the aitoearn-server configuration:

Verify before starting

Make sure JWT_SECRET is exported in the current shell, then validate the Compose configuration:
No output means validation passed. If you see required variable JWT_SECRET is missing a value, the variable is not exported in the current shell.
  • JWT_SECRET must exactly match auth.secret in both config.yaml files, otherwise the auto-login token issued by aitoearn-init cannot be verified by the backend.
  • Changing auth.secret invalidates all issued login tokens; regenerate the auto-login token afterward.
  • Export JWT_SECRET again after reopening a terminal or rebooting the machine, otherwise docker compose refuses to start.
  • Keep this set of secrets for reinstalls and multi-instance deployments, and never commit them to a public repository.

Quick Start

Only 3 steps to run the complete AiToEarn locally.
1

Clone and start

First generate and fill in the secrets as described in Authentication Secrets, then make sure JWT_SECRET is exported in the current shell and start the stack:
The first startup pulls images and may take a few minutes. Run docker compose ps to confirm all services are healthy or running.
2

Open the web interface

Once started, open http://localhost:8080 in your browser.An admin account is created automatically on first startup, and you are logged in automatically. No manual registration is required.
3

Configure Relay (strongly recommended)

AiToEarn needs to sign in to your social media accounts (TikTok, RedNote, YouTube, etc.) to publish content. These platforms require OAuth developer credentials for authorization.
  • Without Relay: You need to apply for developer accounts on more than a dozen platforms one by one and obtain client_id/secret, which is tedious.
  • With Relay: Authorization is completed using the official aitoearn.ai credentials. One API Key covers all platforms.
How to configure:
  1. Register and sign in on aitoearn.ai (international) or aitoearn.cn (China), go to Settings → API Key, and create an API Key.
  2. Open your deployed instance in a browser and go to Configuration Management.
  3. Select Server → Relay and configure the Relay used for platform authorization.
  4. To use AI models provided by the platform, select AI → Relay and configure the AI Relay.
  5. For providers like OpenAI, Gemini, and Anthropic, you can also enter the API Key and API address in AI → Model Providers.
  6. After saving, click Save and Restart to reload the corresponding services.
A China Key pairs with https://aitoearn.cn/api, and an international Key pairs with https://aitoearn.ai/api. A mismatched environment and Key will result in a 401 error.
That’s it — AiToEarn is ready to use.

Operations Reference

Auto login is enabled by default. On first startup, the aitoearn-init service generates an admin token and saves it to a shared volume, and the aitoearn-web service reads the token to complete login automatically. The token is signed with JWT_SECRET and must match auth.secret in both config.yaml files; regenerate the token after changing auth.secret.
All application images use pull_policy: always, ensuring every docker compose up pulls the latest images.
The following settings are used for inter-service communication over the internal Docker network and usually do not need to be changed:
Configuration files are mounted into containers as writable volumes. Modify them through the configuration management UI; restart the corresponding service after saving:

Troubleshooting

Configuration Cheat Sheet

aitoearn-ai and aitoearn-server no longer read runtime parameters from the environment section of docker-compose.yml. They read the mounted config.yaml instead, which is edited through the configuration management UI.

Environment variables still kept in Compose

Last modified on November 5, 2026