How to Deploy the Smart Contracts for AiToEarn: Docker Architecture Guide
AiToEarn does not contain blockchain-based smart contracts; deploying the platform requires launching its containerized Docker stack consisting of NestJS backend services, Next.js frontend, and AI microservices.
The AiToEarn project (available at yikart/AiToEarn) operates as a traditional AI-powered content creation platform rather than a Web3 application. While the query specifically targets smart contract deployment, the repository contains no Solidity code or blockchain interactions. Instead, "deploying" AiToEarn means orchestrating its Docker Compose stack, as implemented in the official source code.
Understanding the Architecture
Since AiToEarn runs without smart contracts, the deployment process targets a multi-service Docker architecture defined in docker-compose.yml. The stack comprises seven interconnected services:
- Nginx: Reverse proxy serving as the unified entry point on port 8080 (see lines 74-84 of
docker-compose.yml) - aitoearn-web: Next.js frontend application (internal port 3000)
- aitoearn-server: NestJS backend API (internal port 3002)
- aitoearn-ai: AI model orchestration service (internal port 3010)
- MongoDB: Document database for persistent data storage
- Redis: Caching layer and queue management
- RustFS: S3-compatible object storage for media assets (ports 9000/9001)
All services communicate over the internal Docker network aitoearn-network, with Nginx handling external routing and SSL termination.
Prerequisites
Before initiating deployment, verify your environment meets these requirements:
- Docker version 20.10 or newer (
docker --version) - Docker Compose version 2.0 or newer (
docker compose version) - Minimum resources: 4 GB RAM and 20 GB available disk space
Step-by-Step Deployment Process
1. Clone the Repository
Download the complete source tree to your deployment server:
git clone https://github.com/yikart/AiToEarn.git
cd AiToEarn
This provides access to the orchestration files and configuration templates located in project/aitoearn-backend/apps/.
2. Launch the Docker Stack
Deploy all services with a single command:
docker compose up -d
Docker pulls the pre-built images (aitoearn/aitoearn-ai, aitoearn/aitoearn-server, aitoearn/aitoearn-web) and initializes the MongoDB, Redis, and RustFS auxiliary services. The -d flag runs containers in detached mode.
3. Verify Container Health
Confirm all services started successfully:
docker compose ps
All containers should display healthy or running status, indicating that the healthchecks defined in docker-compose.yml have validated database connections and service availability.
4. Access the Web Interface
Navigate to http://localhost:8080 in your browser. The initial startup automatically provisions an admin account and authenticates you into the dashboard. According to README_EN.md (lines 68-70), no manual database initialization is required.
Configuring the Relay Service
AiToEarn uses a Relay service to aggregate OAuth credentials for social media platforms, eliminating the need for individual API keys per platform.
Generate API Credentials
Visit aitoearn.ai or aitoearn.cn to generate a Relay API key for your deployment.
Update Environment Configuration
Edit docker-compose.yml and append the following variables under the aitoearn-server service's environment block:
environment:
RELAY_SERVER_URL: https://aitoearn.ai/api
RELAY_API_KEY: your-api-key-here
RELAY_CALLBACK_URL: http://127.0.0.1:8080/api/plat/relay-callback
Apply the changes by restarting the specific container:
docker compose restart aitoearn-server
This configuration is documented in DOCKER_DEPLOYMENT_EN.md (lines 83-92).
Advanced Customization Options
AI Model Endpoints
Replace the placeholder keys (sk-placeholder) in project/aitoearn-backend/apps/aitoearn-ai/config/config.js with production API keys from providers like OpenAI or unified gateways such as one-api.
External Object Storage
To use Amazon S3 instead of the bundled RustFS, modify the ASSETS_CONFIG JSON environment variables in both aitoearn-ai and aitoearn-server service definitions within docker-compose.yml. The application supports any AWS S3 API-compliant storage backend.
Security Hardening
Before production deployment, change all default passwords (password) and JWT secrets (change-this-jwt-secret) in the configuration files. These values are read-only mounted into containers from project/aitoearn-backend/apps/aitoearn-server/config/config.js, requiring container restarts after modification.
Summary
- AiToEarn contains no Solidity or blockchain smart contracts; the entire platform runs as containerized microservices orchestrated via Docker Compose.
- Primary deployment command is
docker compose up -dusing thedocker-compose.ymlfile at the repository root. - Core services include the NestJS backend (
aitoearn-serveron port 3002), Next.js frontend (aitoearn-webon port 3000), and AI orchestration layer (aitoearn-aion port 3010). - Public access is exposed only through Nginx on port 8080, with internal services isolated on the
aitoearn-networkbridge. - Relay configuration enables OAuth aggregation for social publishing, configured via environment variables in the server container.
- Configuration files in
project/aitoearn-backend/apps/[service]/config/config.jscontrol database connections, AI models, and authentication settings.
Frequently Asked Questions
Does AiToEarn use blockchain smart contracts?
No. Despite the project name suggesting Web3 mechanics, the yikart/AiToEarn repository contains no blockchain code, Solidity files, or on-chain transactions. All business logic executes within standard Docker containers running Node.js and Python applications, making deployment a matter of container orchestration rather than contract deployment.
Which ports need to be publicly exposed for AiToEarn deployment?
Only port 8080 (Nginx) requires public exposure. The remaining services—including MongoDB (27017), Redis (6379), and the internal microservices (3000, 3002, 3010)—communicate over the isolated aitoearn-network Docker bridge and should remain inaccessible from external networks for security.
How do I update the AI service configuration after deployment?
Modify the configuration file at project/aitoearn-backend/apps/aitoearn-ai/config/config.js, then execute docker compose restart aitoearn-ai. Since the repository files are mounted as read-only volumes into the containers, any changes to configuration code require container restarts to take effect.
Can I deploy AiToEarn without using the bundled RustFS storage?
Yes. Edit the ASSETS_CONFIG environment variable in docker-compose.yml for both aitoearn-server and aitoearn-ai services to point to external S3-compatible endpoints. The platform supports any object storage provider implementing the AWS S3 API, allowing you to replace RustFS with managed solutions like AWS S3, MinIO, or Wasabi.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →