πΊοΈ This is a starter kit to help you build your own map for WorkAdventure.
π To understand how to use this starter kit, follow our tutorial.
π¨π»βπ§ If you have any questions, feel free to ask in the WorkAdventure office.
In the .env file, you can set your upload strategy to GH_PAGES (default) or MAP_STORAGE. Simply comment out the option you don't want to use.
Uploading a map using GitHub Pages will host your project on GitHub servers, and it's the most straightforward way to add new maps to your world.
Uploading a map using the WA map storage will host your project on WA servers. It's a bit more difficult to set up, but it comes with great advantages, like being able to have private repositories.
map-starter-kit/
βββ π app/ # Server entry point (loads @workadventure/map-starter-kit-core)
β βββ app.ts # Re-exports the Express app from the core package
β
βββ π src/ # Map scripts (Browser/WorkAdventure) β οΈ REQUIRED
β βββ main.ts # Your map scripts go here
β
β
βββ π tilesets/ # Map tileset images (PNG)
β
βββ π *.tmj # Map files (office.tmj, conference.tmj, etc.)
βββ π vite.config.ts # Vite configuration
βββ π package.json # Dependencies and scripts
The server (Express app, controllers, HTML publishing pages, static assets) is provided by the npm package @workadventure/map-starter-kit-core. Updating this dependency gives you new publishing UI and server features without changing your maps or config.
src/: Map scripts (MUST be here for compilation)β οΈ tilesets/: All PNG tilesetsapp/: Server entry point β loads the core package; do not add server logic here
Tip
- If you want to use more than one map file, just add the new map file in the root folder (we recommend creating a copy of office.tmj and editing it to avoid any mistakes).
- We recommend using 512x512 images for the map thumbnails.
- If you are going to create custom websites to embed in the map, please reference the HTML files in the
inputoption in buildmap.vite.config.js.
The app/ directory contains only the entry point that loads the server from @workadventure/map-starter-kit-core.
app.ts: Imports and re-exports the Express app from the core package (for Viteβs server plugin).
The actual server (Express, routes, HTML pages, upload, map storage) lives in the dependency. To get updates to the publishing UI and server behaviour, run npm update @workadventure/map-starter-kit-core.
Important
Do not add server logic or new controllers in app/. The server is fully provided by the core package.
The src/ directory is where you MUST place all map-related scripts that will be executed in the browser. See src/README.md for detailed documentation and examples.
main.ts: Main map script (referenced in.tmjfiles)
Important
All map scripts MUST be placed in the src/ directory to be properly compiled and bundled by Vite. Scripts in this directory are:
- Automatically transformed from TypeScript to JavaScript
- Bundled with their npm dependencies (like
@workadventure/scripting-api-extra) - Served with the correct MIME types
- Referenced in your
.tmjmap files using paths likesrc/main.ts
Warning
Do not place map scripts outside the src/ directory. They will not be compiled correctly and will cause errors in the browser.
- Node.js version >= 18
- Node.js version >= 18 (Download Node.js)
- npm (comes with Node.js)
- Clone or download this repository
- Navigate to the project root directory
- Install dependencies:
npm installThis will install all required dependencies, including Vite, TypeScript, WorkAdventure packages, and @workadventure/map-starter-kit-core (server and publishing UI).
Start the Vite development server with hot module replacement:
npm run devThis will:
- Start the Vite dev server (usually on
http://localhost:5173) - Enable hot module replacement for instant updates
- Automatically transform TypeScript files in
src/ - Serve your maps and assets
Tip
The development server will automatically open your browser. If not, navigate to the URL shown in the terminal.
To test how your map will behave in production:
# Build the optimized production version for your map
npm run buildmap
This will:
- Compile TypeScript to JavaScript
- Optimize and bundle all assets
- Create a production-ready
dist/folder - Start a preview server to test the optimized build
To upload your map to the WorkAdventure Map Storage:
npm run uploadThis command will:
- Build your map (
npm run buildmap) - Upload it to the configured WA Map Storage
Important
Before uploading, you need to configure your upload settings. The upload feature requires three environment variables:
-
MAP_STORAGE_URL- Your WorkAdventure Map Storage URL- Local development: Created in
.envby the upload command - CI/CD: Add as a GitHub secret (optional)
- Local development: Created in
-
MAP_STORAGE_API_KEY- Your API key for authentication- Local development: Created in
.env.secretby the upload command - CI/CD: Add as a GitHub secret (required)
- Local development: Created in
-
UPLOAD_DIRECTORY- Directory path on the storage server- Local development: Created in
.envby the upload command - CI/CD: Add as a GitHub secret (optional)
- Local development: Created in
You can configure these settings through the web interface:
- Start the development server (
npm run dev) - Navigate to the upload configuration page
- Fill in your Map Storage credentials
- Save and upload your map
For more details, read the WorkAdventure upload documentation.
| Command | Description |
|---|---|
npm run dev |
Start Vite development server with hot reload |
npm run buildmap |
Build only the map files (without frontend) |
npm run upload |
Build and upload map to WA Map Storage |
npm run upload-only |
Upload map without rebuilding (requires existing build) |
This project contains multiple licenses as follows:
- Code license (all files except those for other licenses)
- Map license (
office.tmjand the map visual as well) - Assets license (the files inside the
tilesets/folder)
Important
If you add third party assets in your map, do not forget to:
- Credit the author and license of a tileset with the "tilesetCopyright" property by etiding the tileset in Tiled.
- Add the tileset license text in LICENSE.assets.
- Credit the author and license of a map with the "mapCopyright" property in the custom properties of the map.
- Add the map license text in LICENSE.map.
If you have any questions or need further assistance, don't hesitate to ask either by email or Discord!
