Skip to content
Virtual Office

Virtual Office

Virtual Office (hereinafter the “Application”) is a pixel-art virtual office for members of the SpellWare Discord server, in the spirit of early Gather. Members sign in with Discord, design an avatar, walk around a shared office and chat, either with everyone or privately inside the rooms they have been let into.

This section is for those interacting with a live instance of the Application.

The Application is available at office.spellware.dev.

  1. Join the SpellWare Discord server at chat.spellware.dev. Only members of that server can sign in.
  2. Sign in with Discord. The login asks for the identify and guilds.members.read scopes and nothing else. Your server nickname is used as your display name.
  3. Design your avatar, then enter through the glass doors of the lobby.

If you leave the Discord server, the Application removes your access. It checks membership again every five minutes.

The office is open Monday to Friday, 9am to 9pm Pacific time. It keeps those hours through daylight saving changes.

Outside those hours, visitors see a closed page that shows the hours and when the office next opens, in Pacific time and in the visitor’s own time zone. The page lets you in by itself when the office opens. Everyone receives a warning 15 minutes and 5 minutes before closing.

Choose a skin tone, eye colour, face markings, hair style, hair colour, outfit, outfit colour, headwear and eyewear. You can also pick a name colour, add your pronouns and write a short status. Pronouns appear above your avatar, and your status appears in the People panel.

  • Use the arrow keys or WASD to walk, or click or tap anywhere to walk there.
  • Nobody can stand on the same tile as someone else.
  • The People panel lists who is online and where they are, and lets you walk straight to them.
  • The global channel is saved to the database.
  • Every private office, conference room and zone has its own chat, which only reaches the people inside. That chat is never stored.

The office has three kinds of space:

KindWho can enterVisitor limit
Private officeVisitors knock, and the owner chooses who comes inSet by the owner, from 1 to 25 including the owner
Conference roomAnyone, up to the limit. Naomi can lock a room, after which people knockSet per room
ZoneAnyone, always openNone

Owners can show visitors out of their office. Unlocking a conference room lets in anyone waiting at the door. The starter office has zones for the lobby, meeting area, courtyard, kitchen, lounge, garden, library and six hot desks, and a volunteer area of nine cubicles that Naomi holds until she assigns each one to a volunteer.

The top bar shows which zone you are in.

Walk up to a whiteboard and click it, or press E, to draw on it. There are pens in six colours, an eraser and text. Everyone looking at the same board sees changes as they happen. Drawings are saved until someone clears the board, and Ctrl+Z undoes your own last stroke. Boards inside an office or conference room are only for the people inside.

The Application plays a soft chime for chat in the room or zone you are in, for global messages that mention your name, for knocks on your rooms and for answers to your own knocks. While the tab is in the background you also receive a desktop notification and an unread count in the tab title. The Alerts button switches all of this off, and your browser remembers the choice.

Hikari stands behind the reception desk in the lobby. She gives everyone a short tour on their first visit and says hello when they return. Walk up and press E, or click her, to hear the tour again.

Naomi can delete chat messages, mute people for a while, and ban them for a while or permanently. The administrator can also open or close the office from the top bar at any time. That choice lasts until the next scheduled opening or closing.

If you have feedback or a bug report, please log a ticket on our forum.

This section is for those interested in running their own instance of the Application. The Application is closed source, so this section describes how it is built and configured rather than linking to its code.

The Application is a pnpm monorepo, version 0.1.0, that requires Node.js 24 or newer.

PackageWhat it holds
packages/sharedThe map model, permissions, pathfinding, the socket protocol and all of the pixel art, drawn as letter grids
apps/serverFastify, MongoDB, Discord OAuth, the world simulation and the settings API
apps/clientVite and plain TypeScript on a canvas, plus every panel and dialog
deployNGINX configuration

The server uses Fastify with the cookie, Helmet, rate limit, static and WebSocket plugins, the official MongoDB driver and @nhcarrigan/logger. Errors go to the alerts server through the logger.

Every variable is listed in prod.env, with secrets as 1Password references.

VariableRequiredPurpose
PORTNoThe port the app listens on, bound to 127.0.0.1. Defaults to 3000
PUBLIC_URLYesThe public address, used for the OAuth redirect, origin checks and the Content Security Policy
DISCORD_CLIENT_IDYesThe Discord application’s client ID
DISCORD_CLIENT_SECRETYesThe Discord application’s client secret
DISCORD_BOT_TOKENYesThe office bot’s token. The bot must be in the server, and it re-checks membership every five minutes
DISCORD_GUILD_IDNoThe Discord server people must belong to. Defaults to the SpellWare community server
MONGO_URIYesThe MongoDB connection string
MONGO_DATABASENoThe database name. Defaults to virtual-office
LOG_TOKENNoThe alerts server token. When it is empty, errors go to the console
CLIENT_DISTNoThe built browser app. Defaults to ../client/dist

The server refuses to start if a required variable is missing.

The Discord ID that grants the administrator role is set in packages/shared/src/config/offices.ts. On the first run, the database is seeded with offices for Naomi, Hisho and Tim and with the starter map. Offices are managed from the settings page afterwards.

  1. Create the Discord application and add the redirect https://office.spellware.dev/auth/callback.
  2. Create the item in 1Password with the fields prod.env refers to.
  3. Copy deploy/nginx/office.conf into the NGINX sites, then reload NGINX. The configuration proxies the app, its API and its WebSocket to the local port, with one hour read and send timeouts so that connections stay open.
  4. Build and start the app with pnpm install && pnpm build && pnpm start. The start script runs the server through op run, which resolves the secret references.
  • The server sends a Content Security Policy and other Helmet headers. The policy lists each source the shared headers script needs, in apps/server/src/http/contentSecurityPolicy.ts. It also allows the Cloudflare Web Analytics beacon. Its only inline script is allowed by hash, so if the headers script changes its Google Analytics snippet, that hash needs updating. Frames stay blocked.
  • The login routes are rate limited, and origins are checked on every change.
  • Only hashes of session tokens are stored.

The Application loads the shared SpellWare headers script from cdn.spellware.dev/headers/index.js, which brings the consent banner, Google Analytics and HubSpot tracking. The page opts out of the shared layout, header, footer, community popup and ads, and HubSpot’s chat bubble is switched off so it cannot cover the office chat.

Besides page views, the Application sends these events:

EventWhenWhat it carries
loginThe first arrival in a visitNothing
room_enteredEntering a roomOnly the kind of room: office, conference or zone
whiteboard_openedOpening a whiteboardNothing
whiteboard_usedUsing a tool, once per tool each time a board is openedNothing

No names, IDs, room names, chat or drawings are sent.

The Application inherits SpellWare’s global legal documents:

  1. Privacy Policy: https://docs.spellware.dev/#/privacy
  2. Terms of Service: https://docs.spellware.dev/#/terms
  3. License: https://docs.spellware.dev/#/license
DataKept
Discord ID, username, server nickname and avatarKept so that you can sign in and be shown to others
Avatar design, name colour, pronouns and statusKept until you change them
Session tokensOnly a hash of each token is kept
The global chatSaved to the database
Chat in offices, conference rooms and zonesNever stored
Whiteboard drawingsSaved until someone clears the board
Whiteboard activityEvery pen stroke, piece of text, eraser stroke, undo and wipe is recorded permanently, with who did it, when and on which board, so that clearing a board cannot hide it. Only the administrator can view the record
Moderation recordsMutes and bans, which the administrator can review and lift

The Application is closed source and does not accept code contributions. Feedback and bug reports are welcome on the support forum.

For maintainers, the project uses:

  • TypeScript with ESLint and a zero warnings policy.
  • Vitest for tests, with coverage. The server tests start their own in-memory MongoDB, so no database is needed.
  • pnpm for package management.
Terminal window
pnpm install
pnpm --filter @virtual-office/shared build
pnpm lint
pnpm test
pnpm build

To preview the pixel art as PNG files in packages/shared/preview/, run pnpm preview:art.

To run locally, set PUBLIC_URL=http://localhost:5173 in a copy of prod.env, and add http://localhost:5173/auth/callback as a redirect in the Discord application. Then build and start the server, and run the Vite dev server, which proxies /api, /auth and /ws to it:

Terminal window
pnpm --filter @virtual-office/server build
op run --env-file=dev.env -- node apps/server/prod/index.js
pnpm --filter @virtual-office/client dev