Sunflower Land

Custom Servers

Are you ready to take your island to the next level?
To support match making, new mechanics and data persistence it is recommended to explore running your own server. This will allow players to connect and experience custom gameplay.
You can use basic API interactions but we recommend using a framework such as Colyseus to handle multiplayer gameplay.

Custom Server

If you want to use the Sunflower Land Scene, but point to your own server you can use the following setup:
class ExternalScene extends window.BaseScene {
constructor() {
name: "test_island",
mmo: {
enabled: true,
url: "ws://localhost:2567", // Your Websocket server
roomId: "community_island",
player: {
spawn: {
x: 210,
y: 280,

Developing in the Cloud

While developing we recommend
  1. 1.
    Sign up for an account at
  2. 2.
    Install flyctl by following the instructions:
  3. 3.
    Sign in to the Command Line Interface
fly auth login
  1. 4.
    Create a Dockerfile in the root of the Example Server project
FROM node:14
WORKDIR /usr/src/app
COPY package.json ./
COPY yarn.lock ./
RUN yarn install
# run this for production
# npm ci --only=production
COPY . .
CMD [ "yarn", "start" ]
  1. 5.
    Build and test the Docker container
docker build -t community-island-server .
docker run community-island-server
  1. 6.
    Create a application
fly launch
  1. 7.
    Deploy the application
fly deploy
  1. 8.
    Check the application is running!
fly open

Adding Data Persistence

This section follows on from the previous section Developing in the Cloud
  1. 1.
    Add a 1GB volume to the project
fly volumes create myvolume --size 1
  1. 2.
    Add the volume to the fly config fly.toml
  1. 3.
    Deploy the application
fly deploy
  1. 4.
    Add a SQLLite3 Database to the application. For this step I will be creating a new express route under /timestamps. In reality you likely want to access this data from colysues code.
    1. 1.
      Install sqllite to the application
      yarn add sqlite3
    2. 2.
      Import sqllite3 in index.ts
      import sqlite3 from "sqlite3";
    3. 3.
      Create the timestamp route in index.ts. This code will insert a new timestamp each time a page is visited.
      app.get("/timestamps", (req, res) => {
      const database = new sqlite3.Database("./db");
      database.serialize(() => {"CREATE TABLE IF NOT EXISTS example (timestamp INTEGER)");"INSERT INTO example VALUES (?)",;
      database.all("SELECT * from example", (err, rows) => {
  2. 5.
    Deploy the application
fly deploy
  1. 6.
    Access the new route
fly open /timestamps
For a small cloud deployment we recommend the following specifications: CPU: 1vCPU Memory: 2GB
For more advanced configurations you may need additional resources or load balancing. Please visit the colyseus documentation for instructions on how to set up this type of deployment: