Skip to main content

Installation Guide

This comprehensive guide will walk you through setting up a complete Campus development environment.

System Requirements

  • Operating System: Linux, macOS, or Windows (with WSL recommended)
  • RAM: Minimum 4GB (8GB recommended)
  • Disk Space: At least 500MB for dependencies and database

Prerequisites

Install Bun Runtime

Bun is a fast JavaScript runtime used as an alternative to Node.js.
curl -fsSL https://bun.sh/install | bash
Verify the installation:
bun --version
Campus requires Bun for its superior performance in package management and JavaScript execution. Version 1.0+ is recommended.

Install PocketBase

PocketBase is an open-source Backend-as-a-Service that powers Campus’s backend.
1

Download PocketBase

Visit pocketbase.io/docs and download the executable for your operating system:
  • Linux (AMD64)
  • macOS (ARM64/Intel)
  • Windows (AMD64)
2

Extract and Move Executable

Extract the downloaded archive and move the pocketbase executable to your project root:
# Extract (adjust filename as needed)
unzip pocketbase_*_linux_amd64.zip

# Make executable
chmod +x pocketbase
3

Verify Installation

Check that PocketBase is working:
./pocketbase --version

Install Git

Git is required for cloning the repository.
sudo apt update
sudo apt install git

Installation Steps

1

Clone the Repository

Clone the Campus repository from GitHub:
git clone https://github.com/mgpcampos/campus.git
cd campus
This downloads the complete source code including:
  • Frontend application code (src/)
  • PocketBase migrations (pb_migrations/)
  • PocketBase hooks (pb_hooks/)
  • Static assets (static/)
2

Install Project Dependencies

Use Bun to install all required npm packages:
bun install
This installs:Core Dependencies:
  • svelte (v5.43.14) - Reactive framework
  • @sveltejs/kit (v2.49.0) - Application framework
  • pocketbase (v0.26.3) - Backend client SDK
  • tailwindcss (v4.1.17) - CSS framework
  • zod (v3.25.76) - Schema validation
  • sveltekit-superforms (v2.28.1) - Form management
Additional Libraries:
  • bits-ui - Headless UI components
  • lucide-svelte - Icon library
  • date-fns - Date utilities
  • sanitize-html - HTML sanitization
  • sharp - Image processing
3

Configure Environment (Optional)

Campus works out of the box with default settings. For custom configuration, create a .env file:
cp .env.example .env
Edit .env to customize:
  • API endpoints
  • PocketBase URL
  • Other environment-specific settings
Never commit your .env file to version control as it may contain sensitive information.
4

Initialize Database

Place the PocketBase executable in the project root (if not already there), then run migrations:
./pocketbase migrate
This creates the SQLite database and applies all migration files from pb_migrations/ to set up:
  • User tables and authentication
  • Posts, comments, and interactions
  • Spaces and groups
  • Events and calendar entries
  • Materials repository
  • Academic profiles
Migrations are automatically tracked. Re-running migrate will only apply new migrations.
5

Start the Backend Server

Launch PocketBase in development mode:
./pocketbase serve
PocketBase will start on http://localhost:8090 with:
  • Admin dashboard: http://localhost:8090/_/
  • API endpoint: http://localhost:8090/api/
  • Realtime subscriptions enabled
On first run, you’ll be prompted to create an admin account via the dashboard. This is separate from regular user accounts.
6

Start the Frontend Server

Open a new terminal window (keep PocketBase running) and start the development server:
bun run dev
The frontend will be available at http://localhost:5173 with:
  • Hot module replacement (HMR)
  • Fast refresh for Svelte components
  • Development error overlay
Both servers must run simultaneously. The frontend (port 5173) communicates with the backend (port 8090).

Project Structure

Understanding the codebase organization:
campus/
├── src/
│   ├── lib/              # Reusable components, utilities, stores
│   ├── routes/           # SvelteKit file-based routing
│   └── app.html          # Main HTML template
├── pb_migrations/        # PocketBase database migrations (JS)
├── pb_hooks/             # Server-side PocketBase hooks
├── static/               # Public static assets
├── package.json          # Dependencies and scripts
├── svelte.config.js      # SvelteKit configuration
├── tailwind.config.js    # Tailwind CSS configuration
├── vite.config.ts        # Vite build configuration
└── pocketbase            # PocketBase executable (you add this)

Available Scripts

Campus includes several npm scripts for development:
# Start development server with HMR
bun run dev

Verification

Confirm your installation is successful:
1

Check Backend

Visit http://localhost:8090/_/ to access the PocketBase admin dashboard.
2

Check Frontend

Visit http://localhost:5173 to see the Campus application.
3

Create Test Account

Register a new user account and verify you can:
  • Log in successfully
  • View your profile
  • Access the main feed

Troubleshooting

After installing Bun, you may need to:
  • Restart your terminal
  • Add Bun to your PATH manually
  • Run: source ~/.bashrc or source ~/.zshrc (Linux/macOS)
On Linux/macOS, ensure the executable has proper permissions:
chmod +x pocketbase
If ports 5173 or 8090 are in use:Frontend (Vite): Edit vite.config.ts to change the dev server port.Backend (PocketBase):
./pocketbase serve --http=0.0.0.0:8091
Then update your frontend to connect to the new port.
If migrations fail:
  • Ensure pb_migrations/ folder exists and contains migration files
  • Delete pb_data/ folder and run migrations again (⚠️ deletes all data)
  • Check PocketBase console output for specific error messages
If you see import errors:
# Clear Bun cache
rm -rf node_modules
rm bun.lock
bun install

# Sync SvelteKit types
bun run prepare

Next Steps

Quickstart Guide

Follow our quickstart for a streamlined setup experience

Project Structure

Learn about the codebase organization and architecture

Development Workflow

Best practices for developing with SvelteKit and PocketBase

Deployment

Deploy Campus to production with Docker or traditional hosting
For additional help, refer to the official documentation:

Build docs developers (and LLMs) love