User Platform Pipeline - GitLab + Cloudflare

End-to-end deployment pipeline for AI-generated user platforms

🌐 User Platform Pipeline - GitLab + Cloudflare

AI-generated platforms are deployed via GitLab CI to Cloudflare Pages


Overview

When a user creates a platform through GoGrab, we:

  1. Generate Angular code via Backend AI API
  2. Push to GitLab (gograbspace group)
  3. Build via GitLab CI pipelines
  4. Deploy to Cloudflare Pages
┌─────────────────────────────────────────────────────────────────────────────┐
│                    User Platform Deployment Pipeline                         │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐    ┌────────────┐ │
│  │   GoGrab     │    │   Backend    │    │   GitLab     │    │ Cloudflare │ │
│  │   Editor     │───►│   AI API     │───►│   CI/CD      │───►│   Pages    │ │
│  │              │    │              │    │              │    │            │ │
│  └──────────────┘    └──────────────┘    └──────────────┘    └────────────┘ │
│                                                                              │
│  User creates        AI generates:       Pipeline runs:     Deployed to:     │
│  platform config     - Angular app       - yarn install     - SSR/Static     │
│                      - SSR config        - yarn build       - Edge caching   │
│                      - .gitlab-ci.yml    - wrangler deploy  - ISR support    │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘

Components

1. Backend AI API (ai-api.gograb.space)

Responsible for:

2. GitLab (gitlab.com/gograbspace)

Provides:

3. Cloudflare Pages

Delivers:


Pipeline Stages

Stage 1: Code Generation

// Backend AI API generates:
{
  files: [
    'src/app/app.component.ts',
    'src/app/app.routes.ts',
    'src/main.ts',
    'src/main.server.ts',      // SSR entry
    'server.ts',                // Express server
    'angular.json',             // Build config
    '.gitlab-ci.yml',           // CI pipeline
    'package.json',
  ],
  config: {
    ssr: true,
    prerender: ['/'],
    cloudflareProject: 'client-platform'
  }
}

Stage 2: GitLab Push

// GitSyncService pushes to GitLab
await gitSyncService.syncPlatformToRepo({
  tenantId: 'tenant-123',
  projectName: 'client-platform',
  files: generatedFiles,
  commitMessage: 'feat: initial platform generation'
});

Stage 3: CI Pipeline

Auto-generated .gitlab-ci.yml:

stages:
  - install
  - build
  - deploy

variables:
  NODE_VERSION: "20"
  CLOUDFLARE_PROJECT_NAME: "client-platform"

install:
  stage: install
  image: node:${NODE_VERSION}-alpine
  script:
    - yarn install --immutable
  cache:
    paths:
      - node_modules/

build:
  stage: build
  needs: [install]
  script:
    - yarn build --configuration=production
  artifacts:
    paths:
      - dist/

deploy:production:
  stage: deploy
  needs: [build]
  script:
    - npm install -g wrangler
    - wrangler pages deploy dist/browser --project-name=$CLOUDFLARE_PROJECT_NAME
  environment:
    name: production
    url: https://${CLOUDFLARE_PROJECT_NAME}.pages.dev
  rules:
    - if: $CI_COMMIT_BRANCH == "main"

Stage 4: Cloudflare Deployment

Pipeline deploys to Cloudflare Pages:


Infrastructure Configuration

GitLab Settings

Setting Value
Group gograbspace
Visibility Private
CI Minutes 400/month (free tier)
Runners Shared GitLab runners

Cloudflare Settings

Setting Value
Account [email protected]'s Account
Plan Free (upgradeable)
Build System Wrangler v3
Framework Angular

Environment Variables

GitLab CI Variables (set in project settings):

CLOUDFLARE_ACCOUNT_ID=xxxxx
CLOUDFLARE_API_TOKEN=xxxxx

Backend AI API (in .env.local):

GITLAB_URL=https://gitlab.com
GITLAB_API_TOKEN=glpat-xxxxx
CLOUDFLARE_ACCOUNT_ID=xxxxx
CLOUDFLARE_API_TOKEN=xxxxx

Verification Commands

Test Connections

# GitLab connection
yarn test:gitlab

# Cloudflare connection
yarn test:cloudflare

# Full E2E pipeline
yarn e2e:pipeline

Health Checks

# Check deployed platform
curl https://client-platform.pages.dev/

# Check GitLab project
curl -H "PRIVATE-TOKEN: $GITLAB_API_TOKEN" \
  https://gitlab.com/api/v4/projects/gograbspace%2Fclient-platform

Deployment Modes

1. Standard Deployment (Recommended)

Full GitLab CI pipeline:

2. Direct Deployment (Emergency)

Skip GitLab CI, deploy directly:

yarn deploy:wrangler client-platform ./dist/browser main

⚠️ Use only for emergencies - bypasses CI/CD


SSR & Prerendering

User platforms support:

Feature Description
SSR Server-side rendering for dynamic pages
Prerender Static HTML generation for specified routes
ISR Incremental Static Regeneration with cache invalidation

Configuration in angular.json:

{
  "projects": {
    "platform": {
      "architect": {
        "prerender": {
          "options": {
            "routes": ["/", "/about", "/contact"]
          }
        }
      }
    }
  }
}

Error Handling

Pipeline Failures

  1. Build errors → Check GitLab CI logs
  2. Deploy errors → Verify Cloudflare credentials
  3. Runtime errors → Check Cloudflare Functions logs

Webhook Notifications

Pipeline status webhooks sent to:

POST https://backend-api.gograb.io/api/build-pipeline/webhook

Payload:

{
  "status": "success|failed",
  "deploymentId": "deploy-123",
  "pipelineId": 12345,
  "commitSha": "abc123",
  "url": "https://client-platform.pages.dev"
}

Cost Considerations

GitLab (Free Tier)

Cloudflare Pages (Free Tier)

Scaling Options

Need Solution
More CI minutes GitLab Premium ($19/user/month)
More builds Cloudflare Pro ($20/month)
Custom domains Cloudflare (included free)

See Also