The web app of the TOSCA platform. To install TOSCA, start there (Run TOSCA); to work on the web app inside the whole platform, see Develop TOSCA.
This project is a Vue 3 web application built with TypeScript, using Pinia for state management, MapLibre for mapping, and GeoServer for spatial data integration. The backend is powered by Django, handling user participation and campaign data.
- Interactive Mapping: MapLibre-powered maps with vector and raster layer support.
- GeoServer Integration: Fetch layers, metadata, and feature attributes.
- Filtering & Analysis: Attribute-based and geometry-based filtering using Turf.js.
- State Management: Modular stores using Pinia for efficient state handling.
- Participation System: Django-backed user participation and campaign tracking.
- Vue Router: Dynamic routing and named views.
- TailwindCSS: Custom UI styling with dark mode support.
git clone https://github.com/digitalcityscience/TOSCA-Frontend.git
cd TOSCA-FrontendUse the Node.js and npm versions configured for the project:
nvm useThen install the locked dependencies:
npm ciCreate .env.development from .env.development.example and set the values.
The file is gitignored; npm run dev reads it.
cp .env.development.example .env.developmentEnvironment files follow one rule in every TOSCA repository: the committed
template is .env.<mode>.example, your copy is .env.<mode>, and the mode is
written out in full (development, production). There is no plain .env
and no .env.example. This repository has only the development pair: a
deployed container gets its values from the platform's .env.production
(see Docker).
npm run devThe application will be available at http://localhost:5173/ by default.
The image contains no environment-specific values. The container reads the same
VITE_* variables as .env.development.example from its environment when it starts,
checks them, and writes them to /config.js, which the app loads before it
starts. One image therefore serves every environment, and changing a value
needs a container restart, not a rebuild.
docker build -t tosca-frontend .
docker run --rm -p 8080:80 --env-file path/to/deployment.env tosca-frontend- A missing or malformed required variable stops the container with a message in its log.
- Every
VITE_*value is public: anyone who opens the app can read/config.js. Never put a secret in one. - An
--env-filetakes values literally, so writeNAME=valuewithout quotes. - The app is served from the web root;
VITE_BASE_URLmust be/or unset. npm run buildandnpm run previewon your own machine use production mode: they do not read.env.development, so the built app has no values. To check a production build locally, run the Docker image with an env file.- On a read-only root filesystem, set
TOSCA_CONFIG_FILEto a writable path and make nginx serve that file at/config.js. - Released images are
ghcr.io/digitalcityscience/tosca-frontend:X.Y.Z, for bothamd64andarm64(Apple silicon);docker pullpicks the right one. See Versions and releases. /version.jsonnames the version and commit of the running image.
In the code, read these values with getConfig() from src/core/config.ts,
not from import.meta.env.
📂 src
┣ 📂 components # Vue UI components
┣ 📂 store # Pinia state management
┣ 📂 views # Page-level components
┣ 📂 router # Vue Router configuration
┣ 📂 core # Helpers and utilities
┣ 📂 assets # Static assets
┣ 📜 main.ts # Entry point
For a detailed breakdown, refer to the Folder Structure in the GitHub Wiki.
Defined in tsconfig.json and tsconfig.node.json.
- Supports module aliasing (
@components,@store). - Uses strict typing and ESNext features.
Configured in vite.config.ts.
- Sets up Vue plugin.
- Defines module aliases.
- Runs on port 5173 by default.
- Tailwind Config: Custom theme settings, dark mode selector.
- PostCSS: CSS nesting and autoprefixing.
For more details, see the Environment & Configuration Files in the Wiki.
- GeoServer API: Fetches layers, styles, and features.
- Django API: Manages user participation and campaigns.
- State Management: Handled via Pinia.
For API details, refer to the API & Backend Configuration in the Wiki.
This project uses Vitest for unit and integration testing.
npm run lintnpm run testFor testing strategy, see the Testing & Debugging documentation.
We welcome contributions! See the Contributing Guide for details.
This project is licensed under the MIT License. See LICENSE for details.
The web app uses Semantic Versioning. A release is a Git
tag vX.Y.Z (or vX.Y.Z-rc.N for a pre-release) on a commit of main.
| Workflow | Runs on | Does |
|---|---|---|
ci.yml |
pull requests, pushes to main |
secret scan, lint, unit tests, production build, image build, smoke test of the image — pushes nothing |
release.yml |
a v* tag |
checks the tag, lint and tests, builds amd64 and arm64 once, smoke tests that build, pushes it as tosca-frontend:X.Y.Z, creates the GitHub Release |
To release:
- Through a pull request to
main, setversioninpackage.json(andpackage-lock.json, e.g.npm version X.Y.Z --no-git-tag-version) and add a## [X.Y.Z]section to CHANGELOG.md. - On the merged
main, runmake release VERSION=X.Y.Z. It checks that the checkout is clean and exactlyorigin/mainand thatpackage.jsonand the changelog name this version, then creates the tagvX.Y.Zand pushes it.
make image builds the image on your machine with the same Dockerfile and
build arguments as CI (IMAGE=name:tag to choose the tag).
A published version is never overwritten: the release workflow stops if the
image tag already exists. Pushes to main no longer publish an image.