Prerequisites
Before you begin, ensure you have the following installed:- Latest version of Bun
- Latest version of Docker (optional, but recommended)
- A modern web browser (Early 2024 onwards)
- A code editor (Visual Studio Code recommended)
If you don’t have or can’t install Docker, you can run the database and economy service manually. See the alternative setup section below.
Installation Steps
Configure environment variables
Copy the example environment file and modify it:Edit
Site/.env to configure your environment variables:Site/.env
The password, port, and RCCService key may be changed as required for your setup.
Start the database and economy service
Use Docker Compose to start the required services:This starts:
- Database (SurrealDB) on port 8000
- Economy service on port 2009
Start the development server
Navigate to the Site directory and start the dev server:Navigate to the link shown in your terminal (remember not to use HTTPS for local development).
Alternative Setup (Without Docker)
If you can’t install Docker, you can run the services manually:Install SurrealDB
Download and install SurrealDB for your platform.
Start the database
In the repository’s root directory, run:Keep this terminal window open or run it in the background.
Install Go
Download and install Go for your platform.
Development Workflow
Live Reloading
Changes to your code will automatically be reflected in the browser when you save files. The Vite development server provides instant hot module replacement.Inspector Tool
While in the browser, pressCtrl+I to open the inspector, allowing you to select any element and view it in your editor.
Building for Production Preview
To test a production build locally:Available Scripts
The following npm scripts are available in theSite/ directory:
| Script | Command | Description |
|---|---|---|
dev | bun dev | Start development server |
build | bun run build | Build for production |
preview | bun preview | Preview production build |
buildview | bun buildview | Build and preview in one command |
format | bun run format | Format code with Biome |
lint | bun run lint | Lint code with Biome |
check | bun run check | Run Svelte type checking |
check:watch | bun run check:watch | Run type checking in watch mode |
Docker Services Configuration
Thecompose.yml file defines three services:
Database Service
Economy Service
Site Service (Optional)
The site service is optional for development. You’ll typically run
bun dev directly instead of using the containerized version.Recommended Editor Setup
For the best development experience, we recommend:- Visual Studio Code or derivatives (Insiders, VSCodium)
- Mercury Core development extension pack - Includes all necessary extensions
- TypeScript
- Svelte
- Go
- Code navigation and intellisense
- Quality-of-life improvements
Next Steps
Now that your development environment is set up:- Explore the codebase structure
- Learn about customization options
- Understand the architecture and services
- Configure your platform in
mercury.core.ts