DeployForge is a premium, self-hosted, Git-backed static site deployment platform built on Next.js. It features a stunning 3D interactive design system, real-time deployment visualizers, automated framework detection, and a unique serverless-friendly deployment workaround named the Monorepo Static Mesh Architecture.
Hosting user-submitted static sites directly from a serverless Next.js application (like one deployed on Vercel) presents two major challenges:
- Serverless Limitations: Serverless functions have strict execution timeout limits (typically 10-60s), read-only filesystems, and lack the system tools required to run arbitrary package installs and builds (
npm install && npm run build). - Dynamic Sub-path Routing: Deployed sites must be mapped to sub-paths (
/sites/{siteId}) without breaking absolute asset paths (e.g.,href="/style.css"orsrc="/app.js").
DeployForge solves these limitations using an ingenious git-backed monorepo deployment pipeline:
sequenceDiagram
autonumber
actor User as User Dashboard
participant API as DeployForge API
participant GH as GitHub API
participant Actions as GitHub Actions Runner
participant Vercel as Vercel Deployment
User->>API: Click "Launch Deploy"
API->>API: Create Deployment record (QUEUED)
API->>GH: Dispatch 'deploy-site' event to parent repository
GH->>Actions: Trigger 'deploy-site.yml' Workflow
rect rgb(15, 15, 30)
Note over Actions: Build Phase
Actions->>Actions: Clone user's target repository
Actions->>Actions: Run 'npm install && npm run build'
end
rect rgb(15, 15, 30)
Note over Actions: Path Rewriting Workaround
Actions->>Actions: Copy built files to DeployForge 'public/sites/{siteId}'
Actions->>Actions: Regex rewrite absolute HTML links (href="/ to href="/sites/{siteId}/)
end
Actions->>GH: Commit & Push files back to DeployForge main branch
GH->>Vercel: Trigger automatic Vercel redeployment
Actions->>API: POST /api/deploy/status (Update status to READY)
Vercel->>User: Static files become live under /sites/{siteId}
- Triggering the Build: When a deployment is initiated, the API fires a GitHub
repository_dispatchevent (event_type: deploy-site) to the DeployForge repository itself, sending along configuration parameters (e.g., build commands, output folders, callback URLs, and secrets). - Isolated GitHub Actions Runner: The workflow runs on free GitHub Actions servers. It checks out DeployForge, clones the user's repository, installs dependencies, and runs the designated build command (e.g.
npm run build). - Asset Isolation & Directory Placement: The compiled assets are placed in the host repository's
public/sites/{siteId}/directory. - HTML Link Rewriting:
Since static sites are typically built to run at the root domain level, references to scripts and stylesheets use absolute paths (e.g.,
<script src="/main.js">). When served under a sub-path (/sites/{siteId}), these links break. The runner solves this by running a custom shell command to rewrite links in HTML pages:find "public/sites/${SITE_ID}" -name "*.html" -exec \ sed -i "s|href=\"/|href=\"${BASE_PATH}/|g; s|src=\"/|src=\"${BASE_PATH}/|g" {} \;
- Git Commit-Back: The runner commits the new static site folder to DeployForge's main branch and pushes the changes.
- Vercel Redeployment: Because the parent project is linked to Vercel, the push triggers Vercel to automatically rebuild and redeploy the DeployForge platform. The new site's assets are instantly bundled as static resources in the new production environment.
- Next.js Routing Integration: Next.js serves the folders using a dynamic fallback route:
- Location:
app/sites/[siteId]/[[...slug]]/route.ts - Behavior: Serves matching assets from
public/sites/{siteId}/{slug}. If the file has no extension or is missing, it automatically attempts to serve the directory'sindex.htmlfile to facilitate Single Page Application (SPA) routing.
- Location:
To help navigate the codebase, here is a mapping of key components:
- Deploy Request Handler:
app/api/deploy/route.tsβ API endpoint that triggers the deployment pipeline. - Status Callback Handler:
app/api/deploy/status/route.tsβ Webhook endpoint that GitHub Actions updates with building/success/error statuses. - GitHub Actions Workflow:
.github/workflows/deploy-site.ymlβ Builds and compiles target sites. - Next.js Config Pawtcher:
scripts/patch-nextconfig.jsβ Prepares Next.js projects for subpath hosting by injecting options. - Asset Path Rewriter:
scripts/rewrite-paths.jsβ Dynamically updates absolute CSS, HTML, and JS links. - Routing Router:
app/sites/[siteId]/[[...slug]]/route.tsβ Dynamic Next.js route that serves the static assets.
- Antigravity Sandbox:
components/interactive/AntigravityPlayground.tsxβ The Three.js physics sandbox on the home page. - Star Topology Map:
components/dashboard/MeshMap.tsxβ Nodes representing active projects. - Globe Deployments:
components/3d/GlobeDeployments.tsxβ Visualizes network nodes in 3D.
- Framework Auto-Detector:
lib/detectFramework.tsβ Auto-scans package files to configure optimal builds. - AES-256 Env Encryptor:
lib/encryption.tsβ Secures environment variables with Web Crypto APIs. - Prisma Schema:
prisma/schema.prismaβ Database models for Users, Sites, and Deployments.
The landing page includes an Antigravity Sandbox built with React Three Fiber, Drei, and custom interactive components. Users can toggle physics modes:
- Standard: Static elements.
- Antigravity πΈ: Zero-gravity mode. Users can grab, toss, and orbit page components (headers, buttons, pills) in 3D space.
- Gravity π: Simulates normal gravitational pull, making elements fall and bounce against the page bounds.
The dashboard features an interactive 3D map depicting active projects as nodes orbiting the DeployForge core. It visualizes:
- Node connection states in real-time.
- Hover cards displaying live status (
READY,BUILDING,ERROR) and URLs. - Real-time network statistics (Ready vs. Error vs. Deploying).
When connecting a repository, DeployForge scans the file structure using the GitHub API to identify project configurations:
- Next.js: Detects
next.config.{js,ts,mjs}β‘οΈnpm run buildβ‘οΈ.next/out - Vite: Detects
vite.config.{js,ts,mjs}β‘οΈnpm run buildβ‘οΈdist - Astro: Detects
astro.config.{mjs,ts}β‘οΈnpm run buildβ‘οΈdist - React: Detects
package.jsonβ‘οΈnpm run buildβ‘οΈbuild - Static HTML: Default configuration serving from root
..
Monitors the GitHub Actions deployment execution step-by-step from the dashboard, streaming progress and status updates (Queued, In Progress, Success, Failed) using a terminal-inspired console interface.
To prevent sensitive credentials and target site tokens from being stored in plaintext, DeployForge implements AES-256-GCM encryption using the Web Crypto API. Values are dynamically decrypted on-the-fly when dispatching deployment events.
Create a .env file in the root of the project:
# Auth Configuration
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-nextauth-secret-key"
# GitHub OAuth App Credentials
GITHUB_CLIENT_ID="your_github_oauth_client_id"
GITHUB_CLIENT_SECRET="your_github_oauth_client_secret"
# Vercel Integration
VERCEL_API_TOKEN="your_vercel_personal_token"
VERCEL_TEAM_ID="" # Optional: Leave blank for personal account
# Database Settings
DATABASE_URL="file:./dev.db" # SQLite local database path
# Encryption (Generate with: openssl rand -hex 32)
ENV_ENCRYPTION_KEY="your_32_byte_hex_encryption_key"
# Monorepo Host Details (Where DeployForge is hosted)
GITHUB_PAT="your_github_personal_access_token"
DEPLOYFORGE_REPO_OWNER="github_username"
DEPLOYFORGE_REPO_NAME="deploy-forge"- GitHub OAuth App: Create an OAuth app under GitHub Developer Settings. Set the callback URL to
${NEXTAUTH_URL}/api/auth/callback/github. - Personal Access Token (PAT): Create a classic PAT with
repoandworkflowscopes so the application can trigger repository dispatch events and write back to the codebase. - Repository Secret: Inside the DeployForge GitHub repository settings, add a secret named
DEPLOYFORGE_PATcontaining the same Personal Access Token. This enables the Actions runner to commit changes back to the repository.
-
Clone the repository:
git clone https://github.com/Shivala-08/deploy-forge.git cd deploy-forge -
Install dependencies:
npm install
-
Initialize the database:
npx prisma generate npx prisma db push
-
Start the development server:
npm run dev
Open http://localhost:3000 to view the application.