Skip to main content
Deploy S4Kit to SAP BTP Cloud Foundry for scalable, production-ready hosting.

Prerequisites

  • Cloud Foundry CLI installed
  • Logged in: cf login
  • Target set: cf target -o <org> -s <space>

Architecture

ApplicationPurposePort
s4kit-backendAdmin API + Auth8080
s4kit-proxySDK proxy service8080
s4kit-frontendNext.js dashboard8080
All apps use the Bun buildpack.

Deployment

1

Create Services

# PostgreSQL & Redis (external or SAP BTP managed)
cf create-user-provided-service s4kit-postgres -p '{"uri":"postgresql://..."}'
cf create-user-provided-service s4kit-redis -p '{"uri":"redis://..."}'

# Secrets
cf create-user-provided-service s4kit-secrets -p "{
  \"ENCRYPTION_KEY\": \"$(openssl rand -hex 32)\",
  \"BETTER_AUTH_SECRET\": \"$(openssl rand -base64 32)\"
}"
2

Deploy Apps

# From monorepo root
cf push -f packages/platform/backend/manifest.yml
cf push -f packages/platform/proxy/manifest.yml

# Frontend (requires build)
cd packages/platform/frontend
NEXT_PUBLIC_API_URL=https://s4kit-backend.YOUR-DOMAIN ./deploy-cf.sh
3

Verify

cf apps
curl https://s4kit-backend.YOUR-DOMAIN/health
curl https://s4kit-proxy.YOUR-DOMAIN/health/live

Configuration

VariableDefaultDescription
MODEselfhostselfhost or saas (multi-tenant)
FRONTEND_URLmanifestFrontend URL for CORS
COOKIE_DOMAINautoCross-subdomain cookies

Scaling

cf scale s4kit-proxy -i 3 -m 512M    # More API throughput
cf scale s4kit-backend -i 2 -m 256M  # More admin users

XSUAA (SAP Identity)

cd packages/platform/backend
cf create-service xsuaa application s4kit-xsuaa -c xs-security.json
Role templates: S4KitOwner, S4KitAdmin, S4KitDeveloper

Troubleshooting

IssueSolution
Module errorscf restage s4kit-backend --no-cache
Redis refusedCheck cf env s4kit-backend | grep redis
Cookie issuesSet COOKIE_DOMAIN manually
Wrong API URLRebuild frontend with correct NEXT_PUBLIC_API_URL

Full CF Guide

Complete Cloud Foundry deployment guide →