Skip to main content

Overview

Create a service from scratch when you want complete control over your codebase. Start with an empty project, write your code, and define exactly how your application builds and runs.
Cerebrum can build it for you. Describe what you want — “create a REST API with user auth” — and Cerebrum will write the code, Dockerfile, and configuration. The details below are for when you want to understand or do it manually.
When to use this: Building custom applications, APIs, or services where you want to write all the code yourself or have Cerebrum help you build from a blank slate.

Why Start Empty

Full control

You decide everything — language, framework, dependencies, and architecture.

Clean slate

No legacy code or opinions. Build exactly what you need.

Cerebrum-powered

Let Cerebrum write your code, or do it yourself. Your choice.

Any language

Python, Node.js, Go, Rust, Java — anything that runs in a container.
Best for: Custom APIs, web applications, microservices, and any project where you’re writing the code from scratch.

Before You Start

Empty services require a Dockerfile in the project root to deploy. The dev container works without one, but deployments need it.
Decide on your programming language and framework before starting. This helps Cerebrum assist you more effectively.
The development container starts right away with a terminal. You can install dependencies and run code before writing a Dockerfile.
You can always connect your service to GitHub later to enable version control and local development.

Creating an Empty Service

Step 1Click Add Service → select Empty Service
After creation, Ardor initializes a dev container. Once ready, you can start adding code with Cerebrum’s help.

Project Structure

An empty service starts with a minimal structure. Here’s how to organize your code:
/
├── app.py                 # Main application
├── requirements.txt       # Dependencies
├── Dockerfile            # Build instructions
└── app_entrypoint.sh     # Dev container startup

Adding Your First Code

Step 1: Open the Code Editor

Click Code Editor in the toolbar to access your project files. Create your main application file.

Step 2: Write Your Application

Here’s a minimal “Hello World” for common languages:
app.py
import os
from flask import Flask

app = Flask(__name__)
port = int(os.environ.get('PORT', 8080))

@app.route('/')
def hello():
    return {'message': 'Hello from Ardor!'}

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=port)
requirements.txt
flask==3.0.0
Always bind to 0.0.0.0, not localhost or 127.0.0.1. This allows the container to accept external connections.

Dockerfile Setup

Create a Dockerfile in your project root for deployments:
FROM python:3.12-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 8080

CMD ["python", "app.py"]

Dockerfile Requirements

Your Dockerfile must:
  • EXPOSE the port your app listens on
  • CMD or ENTRYPOINT to start your application
  • Read PORT from environment variable for flexibility

Development Workflow

Using the Dev Container

The development container provides a live environment for rapid iteration:
  1. Terminal Access: Install dependencies, run commands, debug issues
  2. Hot Reload: Changes reflect immediately (with proper setup)
  3. Dev URL: Test your app via the unique development URL

Setting Up app_entrypoint.sh

Create app_entrypoint.sh to automatically start your app when the dev container restarts:
#!/bin/bash
pip install -r requirements.txt
python app.py
Without app_entrypoint.sh, the dev container starts but doesn’t run your app. You’ll need to start it manually via the terminal.

Testing Your App

  1. Wait for the dev container to initialize
  2. Open the Dev URL from the service panel
  3. Your app should respond on the configured port

Deploying Your Service

Once your code and Dockerfile are ready:
  1. Click Deploy in the top-right corner
  2. Ardor builds your Docker image from the Dockerfile
  3. The built image is deployed to the selected environment
  4. Your service is accessible via the deployment URL
Build logs are available in the Logs tab. Check them if deployment fails.

Best Practices

Use the terminal to prototype and test before writing the Dockerfile. It’s faster for iteration.
Never hardcode configuration. Use os.environ (Python), process.env (Node.js), or os.Getenv (Go).
Use slim/alpine base images. Multi-stage builds reduce final image size significantly.
Lock versions in requirements.txt, package-lock.json, or go.sum for reproducible builds.
Implement a /health endpoint for monitoring. Ardor uses this to verify your service is running.

Using Cerebrum

Let Cerebrum help you build your service:
  1. Open Copilot from the toolbar
  2. Describe what you want: “Create a REST API with user authentication”
  3. Cerebrum generates code, Dockerfile, and configuration
  4. Review and iterate with follow-up requests

Build with Cerebrum

Learn how Cerebrum can write code, debug issues, and deploy your services automatically.

Troubleshooting

Cause: Missing Dockerfile in project root.Solution: Create a Dockerfile (case-sensitive) in the root directory, not in a subdirectory.
Cause: Missing or incompatible dependencies.Solution:
  • Verify your dependency file exists (requirements.txt, package.json, etc.)
  • Test dependency installation in the dev container first
  • Check for version conflicts
Cause: Port mismatch or binding to localhost.Solution:
  • Ensure your app reads the PORT environment variable
  • Bind to 0.0.0.0, not localhost
  • Verify the EXPOSE port matches your app’s port
Cause: Missing or broken app_entrypoint.sh.Solution:
  • Check app_entrypoint.sh exists and is executable
  • Verify the script syntax (use bash -n app_entrypoint.sh to check)
  • Run commands manually in terminal to debug
Cause: Need to restart the container or app.Solution:
  • For code changes: Restart your app process
  • For dependency changes: Restart the dev container
  • Some frameworks support hot reload — configure them for faster iteration

What’s Next