Cypher is an open-source, self-hosted Platform-as-a-Service (PaaS) designed to simplify the deployment and management of applications directly from your Git repositories. It integrates with GitHub for authentication and repository access, uses Docker for building and running applications, and provides a web interface for managing your deployments.
(This project uses a monorepo structure, containing both the backend and frontend code in a single repository for easier management and contribution.)
Note: The initial development of this project was accelerated using AI-assisted coding ("Vibe coding") to establish a Minimum Viable Product (MVP). The current codebase serves as a functional foundation but may not fully reflect the final intended architecture or core essence of the envisioned product. Further refinement and development are ongoing.
- GitHub Integration: Authenticate using your GitHub account, list accessible repositories, and configure specific branches for automatic builds via webhooks.
- Automated Docker Builds: Trigger builds manually or automatically on push events to configured branches. View build status and logs in real-time via Server-Sent Events (SSE).
- Container Management: View the status of running application containers, manage scaling (number of instances), and access container logs via WebSockets.
- Runtime Configuration: Configure environment variables, port mappings, volumes, labels, and network settings for your deployed applications.
- Web UI: A user-friendly interface (built with React/TypeScript and Shadcn UI) for managing repositories, builds, and containers.
- Notifications: Get build status updates via Discord webhooks (optional).
- Real-time Updates: Container status updates are pushed to the UI via WebSockets.
Cypher consists of two main components located within this monorepo:
- Backend (
cypher-backend): A Python application built with FastAPI. It handles:- API endpoints for the frontend.
- GitHub OAuth authentication and API interaction.
- Webhook processing for automated builds.
- Interaction with the Docker daemon (via
docker-py) for building images and managing containers (start, stop, remove, scale, logs). - Database operations (MongoDB via
pymongo) for storing user data, repository configurations, build status/logs, container runtime configs, etc. - Real-time updates via WebSockets (container status) and Server-Sent Events (build logs).
- Frontend (
cypher-frontend): A single-page application built with React, TypeScript, Vite, Tailwind CSS, and Shadcn UI. It provides the user interface for interacting with the backend API.
- Docker & Docker Compose: Required for building and running application containers. Install Docker
- Python: Version 3.10+ (check
cypher-backend/pyproject.tomlfor specifics). Poetry is used for dependency management. - Node.js & Bun: Required for the frontend. Check
cypher-frontend/package.jsonfor version specifics. Install Node.js, Install Bun - MongoDB: A running MongoDB instance is required for the backend database. Install MongoDB or use a cloud provider/Docker container.
- Git: Required for cloning the repository.
-
Clone the repository:
# Replace <repository-url> with the actual URL git clone <repository-url> cd cypher
-
Backend Setup (
cypher-backend):- Navigate to the backend directory:
cd cypher-backend - Install dependencies using Poetry:
poetry install
- Configure environment variables:
- Copy the example environment file:
cp .env.example .env
- Edit the
.envfile with your specific settings (see Configuration section below).
- Copy the example environment file:
- Activate the virtual environment:
poetry shell
- Run the backend server (usually with uvicorn):
(Adjust host/port as needed)
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
- Navigate to the backend directory:
-
Frontend Setup (
cypher-frontend):- Navigate to the frontend directory (from the project root):
cd cypher-frontend - Install dependencies using Bun:
bun install
- Configure environment variables (if necessary). The primary variable is usually the backend API URL. Check
src/config.tsor look for.envfile usage invite.config.ts. EnsureVITE_API_BASE_URL(or similar) points to your running backend (e.g.,http://localhost:8000). - Run the frontend development server:
(This usually starts the server on
bun run dev
http://localhost:5173or similar)
- Navigate to the frontend directory (from the project root):
-
Access the Application: Open your browser and navigate to the frontend URL (e.g.,
http://localhost:5173).
The backend requires several environment variables set in the .env file:
MONGO_URI: Connection string for your MongoDB instance (e.g.,mongodb://localhost:27017/).MONGO_DB_NAME: Name of the database to use (e.g.,cypher_paas).SECRET_KEY: Required. A strong, random secret key for JWT token signing. Generate one usingopenssl rand -hex 32.GITHUB_CLIENT_ID: Required. Your GitHub OAuth Application Client ID.GITHUB_CLIENT_SECRET: Required. Your GitHub OAuth Application Client Secret.GITHUB_CALLBACK_URL: Required. The callback URL configured in your GitHub OAuth App (must match the backend endpoint, e.g.,http://localhost:8000/auth/callback).FRONTEND_URL: Required. The base URL of your running frontend application (e.g.,http://localhost:5173). Used for redirects after login/logout.GITHUB_WEBHOOK_SECRET: Required for auto-builds. A secret string used to verify incoming GitHub webhooks. Create a strong secret and configure it in your GitHub repository webhooks.DOCKER_REGISTRY_URL(Optional): URL of your private Docker registry if pushing images.DOCKER_REGISTRY_USERNAME(Optional): Username for your Docker registry.DOCKER_REGISTRY_PASSWORD(Optional): Password or access token for your Docker registry.DISCORD_WEBHOOK_URL(Optional): URL for the Discord webhook to send build notifications.ALLOWED_ORIGINS: Comma-separated list of origins allowed for CORS (e.g.,http://localhost:5173,http://127.0.0.1:5173). Adjust based on your frontend URL.
Important:
- Create a GitHub OAuth App. Set the "Authorization callback URL" to your backend's callback endpoint (e.g.,
http://localhost:8000/auth/callback). - For automatic builds, configure webhooks in your GitHub repositories. Point them to
<your-backend-url>/webhooks/github, select thepushevent, set the content type toapplication/json, and enter the same secret you defined inGITHUB_WEBHOOK_SECRET.
- Login: Access the frontend URL and click the login button to authenticate via GitHub.
- Dashboard: View configured repositories and recent builds.
- Repositories:
- View repositories accessible via your GitHub account.
- Configure repositories for Cypher by selecting branches for automatic builds.
- Builds:
- Trigger manual builds for configured repositories/branches.
- View build history, status, and logs (including real-time streaming).
- Containers:
- View the status of running containers grouped by repository.
- Manage container instances (start, stop, remove, scale).
- Configure runtime settings (ports, environment variables, volumes, labels, network).
- View container logs (real-time streaming).
Contributions are welcome! Please feel free to open an issue to discuss bugs or feature requests, or submit a pull request.
Please adhere to the following guidelines:
- Code Style:
- Python (Backend): Follow PEP 8 guidelines and use the Black code formatter. Ensure code is formatted before committing.
- TypeScript/React (Frontend): Follow standard TypeScript/React best practices and use the configured ESLint and Prettier setup. Ensure code is formatted before committing (e.g., using
bun run format).
- Commit Messages: Use the Conventional Commits specification for clear and automated commit history (e.g.,
feat:,fix:,chore:,docs:). - Coding Standards: Follow established design patterns and conventions within the project. Keep code clean, readable, and maintainable.
- Testing: Add relevant tests for new features or bug fixes.
- Pull Requests: Ensure your PRs are focused, well-described, and pass any configured CI checks.
This project is licensed under the MIT License - see the LICENSE file for details.