memory-bank/components/server.md
The Server is a central component in Gitpod that serves as the main backend service, handling API requests, authentication, user management, workspace operations, and integration with various source code management systems. It acts as the core orchestrator for the Gitpod platform, connecting various components and providing a unified API for clients.
The primary purposes of the Server component are:
The Server operates as an Express.js application with several key components:
gitpod.v1 gRPC services (defined in .proto files within components/public-api/) for programmatic access.The server is designed as a modular application using dependency injection (Inversify) to manage components and their dependencies.
main.ts: Entry point that initializes the container and starts the serverinit.ts: Handles server initialization and setupserver.ts: Core server implementationsrc/api/: API endpoints and handlerssrc/auth/: Authentication and authorizationsrc/workspace/: Workspace managementsrc/user/: User managementsrc/orgs/: Organization managementsrc/prebuilds/: Prebuild functionalitysrc/billing/: Billing and subscription managementsrc/github/, src/gitlab/, src/bitbucket/: SCM integrationscomponents/gitpod-db: Database access layercomponents/gitpod-protocol: Shared protocol definitionscomponents/content-service-api: Content service API definitionscomponents/ws-manager-api: Workspace manager API definitionscomponents/image-builder-api: Image builder API definitionsThe Server is configured via environment variables and configuration files, including:
The Server exposes multiple API endpoints:
The Server supports multiple authentication methods:
Authorization is handled through a combination of user roles and permissions, leveraging SpiceDB for fine-grained access control checks within its service implementations (including for gRPC services).
The Server integrates with:
safeFragmentRedirect() for all HTTP redirects to prevent OAuth token inheritance attacksThe Server is typically used to: