Skip to main content
Campus is a full-stack application that combines SvelteKit (frontend/API) with PocketBase (database/backend) in a single Docker container. This architecture uses Caddy as a reverse proxy to route traffic between the services.

Architecture

The deployment consists of three services running in a single container:
  1. SvelteKit (Port 3000) - Frontend application and custom API routes
  2. PocketBase (Port 8090) - Database, authentication, and native API
  3. Caddy (Port 8080) - Reverse proxy that routes requests

Request Routing

Caddy handles all incoming requests and routes them based on path:
  • /api/collections/*, /api/realtime, /api/files/*, /api/admins/*, /api/settings/*, /api/logs/*, /api/backups/*, /api/health → PocketBase
  • /_/* (Admin UI) → PocketBase
  • Everything else → SvelteKit

Deployment Options

The recommended way to deploy Campus is using the provided multi-stage Dockerfile. This approach:
  • Bundles all services in a single container
  • Uses Alpine Linux for minimal image size
  • Includes proper process management with tini
  • Supports multiple architectures (amd64, arm64)
See the Docker Deployment guide for details.

Platform Support

Campus has been tested and works well on:
  • Railway - Automatic deployments from GitHub
  • Fly.io - Global edge deployment
  • Any Docker host - VPS, cloud instances, on-premise

Requirements

System Requirements

  • Docker 20.10 or newer (for containerized deployment)
  • Node.js 22+ (for local development)
  • 2GB RAM minimum (4GB recommended)
  • 1GB disk space (plus space for uploaded media)

Environment Variables

Properly configure environment variables before deploying. At minimum, you should review the PocketBase URL configuration.
See Environment Variables for a complete reference.

Persistent Storage

The /pb_data directory contains your database and uploaded files. You MUST mount this as a persistent volume or your data will be lost when the container restarts.
Example Docker volume mount:
docker run -v /path/to/persistent/storage:/pb_data campus:latest

Quick Start

Build the Docker Image

cd ~/workspace/source
docker build -t campus:latest .

Run the Container

docker run -d \
  -p 8080:8080 \
  -v $(pwd)/pb_data:/pb_data \
  -e PORT=8080 \
  campus:latest
The application will be available at http://localhost:8080.

Access PocketBase Admin

The PocketBase admin interface is available at http://localhost:8080/_/. On first launch, you’ll be prompted to create an admin account.

Production Considerations

Security

  • Change default admin credentials immediately after first deployment
  • Use HTTPS in production (most platforms handle this automatically)
  • Review and configure authentication settings in PocketBase admin
  • Set appropriate CORS policies if needed

Backups

Regularly backup the /pb_data directory. This contains your entire database and all uploaded files.
PocketBase includes a built-in backup API at /api/backups/*.

Monitoring

Health check endpoint: http://your-domain.com/api/health This endpoint returns PocketBase health status and can be used for uptime monitoring.

Performance

  • PocketBase uses SQLite, which performs well for most use cases
  • For high-traffic deployments, consider using a CDN for static assets
  • Monitor disk I/O as SQLite performance depends on disk speed
  • Consider vertical scaling (more CPU/RAM) rather than horizontal scaling

Next Steps

Build docs developers (and LLMs) love