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:
- Generate Angular code via Backend AI API
- Push to GitLab (gograbspace group)
- Build via GitLab CI pipelines
- 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:
- Platform code generation
- GitLab project management
- CI configuration generation
- Deployment orchestration
2. GitLab (gitlab.com/gograbspace)
Provides:
- Source code hosting
- CI/CD pipeline execution
- Build artifact management
- Deployment triggers
3. Cloudflare Pages
Delivers:
- Global edge hosting
- Automatic SSL
- Preview deployments
- ISR cache invalidation
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:
- Static assets to edge CDN
- Server functions for SSR
- Preview URLs for branches
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:
- ✅ Automated testing
- ✅ Build verification
- ✅ Deployment audit trail
- ✅ Rollback capability
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
- Build errors → Check GitLab CI logs
- Deploy errors → Verify Cloudflare credentials
- 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)
- 400 CI/CD minutes/month
- 5GB storage
- Unlimited private repos
Cloudflare Pages (Free Tier)
- 500 builds/month
- 1 concurrent build
- Unlimited sites
- Unlimited bandwidth
Scaling Options
| Need | Solution |
|---|---|
| More CI minutes | GitLab Premium ($19/user/month) |
| More builds | Cloudflare Pro ($20/month) |
| Custom domains | Cloudflare (included free) |