Skip to content

infinilabs/mobius

Repository files navigation

Mobius

A web application scaffold built with a Go backend and React frontend, designed to connect to Google Cloud Platform.

Tech Stack

  • Backend: Go (net/http, slog, lumberjack for log rotation, YAML config)
  • Frontend: React 19, TypeScript, Vite, Tailwind CSS 4, Axios, ECharts, Lucide Icons
  • Data: PostgreSQL (Docker), Elasticsearch (Docker), BigQuery (GCP)
  • Build: Makefile + Docker

Quick Start

# 1. Copy config template
cp conf.yaml.template conf.yaml
# Edit conf.yaml with your settings

# 2. Build and run (starts Docker containers + builds + launches server)
make serve

The server starts on port 1983 by default.

Configuration

Edit conf.yaml or use the Settings page in the web UI (changes persist to conf.yaml):

server:
  port: 1983
  mode: "debug"

postgres:
  host: "localhost"
  port: 5432
  user: "mobius"
  password: "mobius"
  dbname: "mobius"

elasticsearch:
  url: "http://localhost:9200"

bigquery:
  project_id: "your-gcp-project-id"
  dataset: "mobius"
  credentials_path: ""  # leave empty to use ADC

Data Backends

Service Purpose Storage
PostgreSQL Business data (ad accounts, tasks, campaigns) data/rdb/ (Docker volume)
Elasticsearch Creatives index and search data/es/ (Docker volume)
BigQuery Analytical data (reporting, metrics) GCP (cloud)

Data directories are mounted from data/ so Docker container restarts do not cause data loss.

Build Commands

Command Description
make build-all Build frontend + backend
make build-nsjail Build NsJail sandbox locally from source (Linux)
make build-sandbox Build the agent sandbox Docker image
make serve Start Docker + build all + launch server
make docker-up Start PostgreSQL + Elasticsearch containers
make docker-down Stop containers (data preserved)
make docker-destroy Remove containers (data still preserved)
make docker-status Show container status
make clean Remove build artifacts

Development

For frontend development with hot reload:

# Start infrastructure
make docker-up

# Terminal 1: Start the Go backend
cd backend && go run .

# Terminal 2: Start Vite dev server (proxies /api to :1983)
cd frontend && npm run dev

Agent Sandboxing

To run agent commands in a secure sandbox, Mobius supports both Docker and NsJail (Linux only).

NsJail Sandbox Setup (Linux only)

To build NsJail locally, you must first install the system dependencies:

sudo apt install autoconf bison flex gcc g++ git libprotobuf-dev libnl-route-3-dev libtool make pkg-config protobuf-compiler

Then compile NsJail:

make build-nsjail

This will clone NsJail and place the compiled binary at bin/nsjail.

Infinishield Setup (Watermarking)

Mobius uses Infinishield for robust watermarking of multimedia files.

Prerequisites

To compile Infinishield, you must have the Rust toolchain (Cargo) installed. If not already installed, you can install Rust via:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Build instructions

Compile and install the binary:

make build-infinishield

This will clone Infinishield and place the compiled release binary at bin/infinishield.

API Endpoints

Method Path Description
GET /api/health Health check
GET /api/config Project config (public)
GET /api/settings Full infrastructure settings
PUT /api/settings Update settings (persists to conf.yaml)
GET /api/conversations List all conversations (summary)
POST /api/conversations Create a new conversation
GET /api/conversations/{id} Get conversation with full message history
PUT /api/conversations/{id} Rename a conversation
DELETE /api/conversations/{id} Delete a conversation
POST /api/chat Send message and stream AI response (SSE)
POST /api/upload Upload a file (multipart)

Logging

Logs are written to the logs/ directory in JSON format with automatic rotation:

  • logs/server.log — Application logs
  • logs/access.log — HTTP request logs

Log rotation: 32MB max size, 3 backups, 28-day max age, gzip compressed.

About

Mobius

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors