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.
1. User Documentation
Section titled “1. User Documentation”This section is for those interacting with a live instance of the Application.
Getting Started
Section titled “Getting Started”The Application is available at office.spellware.dev.
- Join the SpellWare Discord server at chat.spellware.dev. Only members of that server can sign in.
- Sign in with Discord. The login asks for the
identifyandguilds.members.readscopes and nothing else. Your server nickname is used as your display name. - 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.
Opening Hours
Section titled “Opening Hours”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.
Your Avatar
Section titled “Your Avatar”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.
Moving Around
Section titled “Moving Around”- 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:
| Kind | Who can enter | Visitor limit |
|---|---|---|
| Private office | Visitors knock, and the owner chooses who comes in | Set by the owner, from 1 to 25 including the owner |
| Conference room | Anyone, up to the limit. Naomi can lock a room, after which people knock | Set per room |
| Zone | Anyone, always open | None |
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.
Whiteboards
Section titled “Whiteboards”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.
Notifications
Section titled “Notifications”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.
The Receptionist
Section titled “The Receptionist”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.
Moderation
Section titled “Moderation”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.
Feedback and Bugs
Section titled “Feedback and Bugs”If you have feedback or a bug report, please log a ticket on our forum.
2. Technical Documentation
Section titled “2. Technical Documentation”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.
Architecture
Section titled “Architecture”The Application is a pnpm monorepo, version 0.1.0, that requires Node.js 24 or newer.
| Package | What it holds |
|---|---|
packages/shared | The map model, permissions, pathfinding, the socket protocol and all of the pixel art, drawn as letter grids |
apps/server | Fastify, MongoDB, Discord OAuth, the world simulation and the settings API |
apps/client | Vite and plain TypeScript on a canvas, plus every panel and dialog |
deploy | NGINX 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.
Environment Variables
Section titled “Environment Variables”Every variable is listed in prod.env, with secrets as 1Password references.
| Variable | Required | Purpose |
|---|---|---|
PORT | No | The port the app listens on, bound to 127.0.0.1. Defaults to 3000 |
PUBLIC_URL | Yes | The public address, used for the OAuth redirect, origin checks and the Content Security Policy |
DISCORD_CLIENT_ID | Yes | The Discord application’s client ID |
DISCORD_CLIENT_SECRET | Yes | The Discord application’s client secret |
DISCORD_BOT_TOKEN | Yes | The office bot’s token. The bot must be in the server, and it re-checks membership every five minutes |
DISCORD_GUILD_ID | No | The Discord server people must belong to. Defaults to the SpellWare community server |
MONGO_URI | Yes | The MongoDB connection string |
MONGO_DATABASE | No | The database name. Defaults to virtual-office |
LOG_TOKEN | No | The alerts server token. When it is empty, errors go to the console |
CLIENT_DIST | No | The 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.
Deployment
Section titled “Deployment”- Create the Discord application and add the redirect
https://office.spellware.dev/auth/callback. - Create the item in 1Password with the fields
prod.envrefers to. - Copy
deploy/nginx/office.confinto 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. - Build and start the app with
pnpm install && pnpm build && pnpm start. The start script runs the server throughop run, which resolves the secret references.
Security
Section titled “Security”- 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.
Analytics
Section titled “Analytics”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:
| Event | When | What it carries |
|---|---|---|
login | The first arrival in a visit | Nothing |
room_entered | Entering a room | Only the kind of room: office, conference or zone |
whiteboard_opened | Opening a whiteboard | Nothing |
whiteboard_used | Using a tool, once per tool each time a board is opened | Nothing |
No names, IDs, room names, chat or drawings are sent.
3. Legal Documentation
Section titled “3. Legal Documentation”The Application inherits SpellWare’s global legal documents:
- Privacy Policy: https://docs.spellware.dev/#/privacy
- Terms of Service: https://docs.spellware.dev/#/terms
- License: https://docs.spellware.dev/#/license
Data the Application Keeps
Section titled “Data the Application Keeps”| Data | Kept |
|---|---|
| Discord ID, username, server nickname and avatar | Kept so that you can sign in and be shown to others |
| Avatar design, name colour, pronouns and status | Kept until you change them |
| Session tokens | Only a hash of each token is kept |
| The global chat | Saved to the database |
| Chat in offices, conference rooms and zones | Never stored |
| Whiteboard drawings | Saved until someone clears the board |
| Whiteboard activity | Every 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 records | Mutes and bans, which the administrator can review and lift |
4. Contributing Documentation
Section titled “4. Contributing Documentation”The Application is closed source and does not accept code contributions. Feedback and bug reports are welcome on the support forum.
Development Setup
Section titled “Development Setup”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.
pnpm installpnpm --filter @virtual-office/shared buildpnpm lintpnpm testpnpm buildTo 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:
pnpm --filter @virtual-office/server buildop run --env-file=dev.env -- node apps/server/prod/index.jspnpm --filter @virtual-office/client dev