How g3w-suite/g3w-client works
1. What this repo is
- g3w-client is the browser-side cartographic viewer for the G3W suite.
- It is not standalone: it expects a separate g3w-admin backend and is typically run in a Docker Compose dev stack with that backend plus shared config.
2. Runtime and build boundary
- The codebase is a Vue-based JavaScript application/library with separate dev and prod entrypoints (src/index.dev.js, src/index.prod.js) and a custom build script (build.js).
- config.template.js indicates runtime configuration is injected externally, not hardcoded into the app.
3. Top-level application shell
- Core UI composition lives in src/components/App.vue and the form/panel/header/footer components.
- This shell hosts the viewer chrome: catalog/tree navigation, modal dialogs, tabs, search, tables, messages, and tool panels.
4. Application infrastructure
- The src/g3w-*.js files form the shared platform layer: app bootstrap, component/control/panel/layer abstractions, plugin registration, global state, event emission, iframe integration, and i18n.
- This is the main internal boundary that all features plug into.
5. Map and interaction subsystem
- src/static/map-controls contains the viewer’s built-in map controls: zoom, zoom history, overview, scale, mouse position, geolocation, geocoding, measurement, screenshot, query/query-by, add-layer, basemap switching, street view, and toggles.
- src/interactions provides user interactions such as picking coordinates and features.
- These modules are the map-facing surface of the app and typically mediate between user actions and layer/query state.
6. Catalog, layer, and query workflows
- Components like CatalogTree, QueryBuilder, QueryResults, Relations, Table, SearchPanel, Search, and the layer modals manage project contents and data inspection.
- The data flow here is: backend/project metadata → catalog/layer tree → user selection/query/search → results/table/relations UI.
7. Form and field system
- The many Field* and Input* components implement a reusable form engine for layer attributes, editing, metadata, and specialized value types.
- Mixins in src/mixins normalize behavior across field types, media inputs, geospatial inputs, selection widgets, resizing, and form input handling.
- This is a distinct subsystem from the map shell: it focuses on structured data entry rather than viewer chrome.
8. Plugin architecture
- src/plugins is an explicit extension boundary; plugins can be independently developed and mounted into the client.
- The README shows plugins are selected via runtime config (window.initConfig.group.plugins) and can add custom UI, behavior, and hooks without changing the core app.
- This is the main customization mechanism for deployments.
9. Customization hooks and user extension points
- The app exposes event-driven hooks for things like header links and context menu entries.
- README examples show g3w.app events are used to inject custom menu items, modal triggers, and UI links.
- This means the app is designed as an extensible shell with late-bound features.
10. Shared utilities and browser services
- src/utils contains the non-UI domain helpers: XHR, geometry conversions, scale/resolution math, feature splitting/dissolving, downloads, URL builders, deep cloning, debouncing/throttling, DOM ID generation, and browser storage via idb.
- These utilities support the rest of the app but are not a subsystem on their own.
11. Static assets and locale layer
- src/static bundles CSS, icons/cursors/fonts, translation files, and geocoding provider definitions.
- Geocoding integrations are abstracted as provider modules, so the viewer can switch or extend search providers without changing the UI layer.
- Internationalization is file-based and loaded from src/static/locales.
12. Dev/test/release environment
- The repository is set up for local development alongside g3w-suite-docker and g3w-admin, with GitHub Actions for testing/backporting/release automation.
- test/map/* contains map-centric test/demo scenarios, indicating the app is validated through viewer behavior rather than isolated unit logic alone.
13. Diagram takeaway
- A good architecture diagram should show:
- Backend/config input from g3w-admin and Docker-managed runtime config
- Core Vue shell + g3w platform layer
- Map controls/interactions as a feature subsystem
- Catalog/query/forms/search as major functional slices
- Plugin/extensions as a separate injected boundary
- Shared utilities/static assets/locales as supporting layers
Main entry points: App.vue App shell · g3w-app.js G3W platform · QueryBuilder.vue Query flow · zoom.js Map controls
Components 19
Runtime
Build, bootstrap, and external runtime configuration.
- Runtime config · Injected viewer settings and deployment-specific options, including plugin selection.
config.template.js - Dev entry · Development startup entrypoint.
src/index.dev.js - Prod entry · Production startup entrypoint.
src/index.prod.js - Build script · Custom build orchestration for the client.
build.js
Shell UI
Top-level viewer chrome and application composition.
- App shell · Top-level application composition and viewer chrome.
src/components/App.vue - Panels · Header, footer, form body, global tabs, tool and message surfaces.
src/components/FormHeader.vue - Dialogs · Modal surfaces for login, metadata, layer changes, and add-layer actions.
src/components/ModalLogin.vue
Map Layer
Map controls and direct user interactions with the viewer.
- Map controls · Built-in viewer controls such as zoom, overview, geocoding, measure, query, baselayer, and screenshot.
src/static/map-controls/zoom.js - Interactions · Feature and coordinate picking interactions that feed map workflows.
src/interactions/pick-feature.js
Data Workflows
Catalog, query, search, relations, and form entry flows.
- Catalog tree · Project and layer tree navigation for browsing content.
src/components/CatalogTree.vue - Query flow · Query builder, results, relations, and table-oriented inspection.
src/components/QueryBuilder.vue - Search · Search panel and search widgets for finding projects, layers, and features.
src/components/SearchPanel.vue - Form engine · Reusable field, input, and form components for structured data entry.
src/components/Form.vue
Extensions
Plugin boundary, shared utilities, locales, and static assets.
- G3W platform · Shared app, component, control, panel, layer, state, emitter, iframe, and plugin abstractions.
src/g3w-app.js - Plugins · Mountable extension area for deployment-specific custom behavior and UI.
src/plugins/README.md - App hooks · Event-driven extension points for header links, context menus, and modal triggers.
src/g3w-emitter.js - Utilities · XHR, geometry, search, filtering, download, storage, and other non-UI helpers.
src/utils/base.js - Locales · Translation bundle loading and language resources.
src/static/locales/index.js - Static assets · Styles, icons, cursors, fonts, and geocoding providers.
src/static/app.css
Connections 28
- Build script → Dev entry: builds · The build tooling packages the development entry.
- Build script → Prod entry: builds · The build tooling packages the production entry.
- Runtime config → Dev entry: configures · Runtime config is injected when the app starts in development.
- Runtime config → Prod entry: configures · Runtime config is injected when the app starts in production.
- Dev entry → App shell: boots · The dev entry initializes the Vue application shell.
- Prod entry → App shell: boots · The prod entry initializes the Vue application shell.
- App shell → G3W platform: uses · The shell is assembled on top of the shared G3W runtime abstractions.
- G3W platform → App hooks: exposes · The runtime layer exposes event and extension hooks.
- G3W platform → Plugins: mounts · Plugins register through the core platform boundary.
- G3W platform → Locales: loads · Localization is provided through the shared runtime layer.
- G3W platform → Utilities: depends on · Core runtime behavior relies on common helpers.
- G3W platform → Static assets: serves · Shared runtime assets are consumed across the app.
- App shell → Panels: composes · The root shell organizes the viewer chrome and panel surfaces.
- App shell → Catalog tree: hosts · The shell hosts catalog and layer navigation.
- App shell → Query flow: hosts · The shell hosts query and results workflows.
- App shell → Search: hosts · The shell hosts search surfaces.
- App shell → Form engine: hosts · The shell embeds the form and field engine.
- App shell → Dialogs: opens · The shell coordinates modal dialogs.
- App shell → Map controls: surfaces · Viewer chrome exposes map controls to the user.
- Map controls → Interactions: drives · Controls trigger direct map interactions.
- Map controls → Query flow: feeds · Map query controls connect to inspection workflows.
- Catalog tree → Query flow: selects · Catalog selection flows into query and results inspection.
- Catalog tree → Search: navigates · Catalog content is discoverable through search.
- Query flow → Form engine: uses · Query and editing workflows depend on reusable fields and inputs.
- Search → Utilities: uses · Search workflows rely on shared data-shaping helpers.
- Form engine → Utilities: uses · Field and input components use shared normalization and geometry helpers.
- Plugins → App hooks: extends · Plugins attach via the app event system and extension hooks.
- Static assets → Locales: contains · Language resources live alongside other static assets.