Setting up your Development Environment
This guide will help you set up a development environment for creating extensions for the Calagopus Panel. Follow the steps below to get started.
Prerequisites
Before you begin, ensure you have the following installed on your machine:
- Node.js (version 24 or higher)
- pnpm (version 11 or higher)
- Rust (latest stable version)
- A code editor (e.g., Visual Studio Code)
- Git (any reasonable version)
- A PostgreSQL server (version 16 or higher) for the database
- A Redis server (version 7 or higher) for caching
Installing the Panel Locally
Step 1: Clone the Repository
Start by cloning the Calagopus Panel repository to your local machine:
git clone https://github.com/calagopus/panel.git calagopus-panel
cd calagopus-panelStep 2: Install Dependencies
Next, install the necessary dependencies using pnpm:
# Frontend dependencies
cd frontend
pnpm install
cd ..
# Database dependencies (technically optional)
cd database
pnpm install
cd ..Step 3: Set Up Environment Variables
Copy the .env.example file to .env and modify it as needed:
cp .env.example .envMake sure to configure PostgreSQL/Redis and your app encryption keys in the .env file.
Step 4: Build the Project
To build the project, run the following command from the root directory:
# build frontend, required to build the backend
cd frontend
pnpm build
cd ..
# migrate database
SQLX_OFFLINE=true cargo run -p database-migrator -- migrate
# build & run backend
SQLX_OFFLINE=true cargo runThis will compile the frontend and backend components of the Calagopus Panel.
Step 5: Running the Development Server
With a working backend, run the frontend development server:
cd frontend
pnpm dev
# start dev server on port 8081
# pnpm dev --port 8081
# backend is on port 9999
# BACKEND_PORT=9999 pnpm devBy default, the frontend will be available at http://localhost:5173, the dev server automatically proxies API requests to the backend server running at http://localhost:8000. If you use a different port for the backend, you can set the BACKEND_PORT environment variable.
Updating the Development Environment
To keep your development environment up to date with the latest changes from the main repository, you can pull the latest changes and rebuild the project:
rm Cargo.lock frontend/pnpm-lock.yaml # remove lockfiles to avoid git conflicts
git pull # if there are additional conflicts, resolve them hereThen rebuild the project:
# build frontend, required to build the backend
cd frontend
pnpm install # install any new dependencies
pnpm build
cd ..
# migrate database
SQLX_OFFLINE=true cargo run -p database-migrator -- migrate
# build & run backend
SQLX_OFFLINE=true cargo run