Skip to content

[Feature]: Connection manager for databases and web services #699

Closed

Description

@deniial00

Before you start

What problem does this solve?

Some sources hold many datasets behind one endpoint: a PostGIS, MySQL/MariaDB or SQL Server database, a WMS/WMTS/WFS/WCS server, an OGC API endpoint, an ArcGIS REST service, a STAC API, a CSW catalogue or an S3 bucket.

RustGIS can already reuse such an endpoint if you save it first (see the comment on #641). Under View › Windows › Data Sources › Services or Databases you type the address into a save box. Clicking the saved entry later reopens the service browser or the Add From Database dialog with the address filled in, and you pick another layer or table there. The gaps are elsewhere: these saved entries are address shortcuts, not first-class connections.

  • Reuse requires saving it explicitly. Adding a layer from Add From Service puts that one layer in Recent, which holds 20 entries. The server itself is only kept if you save it by hand. That is the request in [Feature]: CONNECTION MANAGER #641.
  • Saved entries can't really be edited. They are identified by their address. You can remove one but not rename it, change its address or login, keep two logins to the same server, or group many of them. You can't test one either.
  • Each kind is stored its own way. Services, databases and STAC APIs are data_sources entries. S3 connections have their own store and fields (s3ui.rs). Database connections are free text.
  • Browsing goes through a dialog. A saved entry reopens the browser or dialog. The pane itself doesn't show what's inside the endpoint, so you can't add several datasets straight from it.
  • Logging in to web services is unsupported. Basic auth, API-key headers and ArcGIS tokens have nowhere to go. A token pasted into a URL is stripped from saved sources. Nothing visibly strips it from layer URLs in saved projects; this needs an audit.

Proposed solution

A connection is a reusable, named endpoint plus how to log in to it. You browse its datasets and add the ones you want. It is different from a Data Sources entry, which is a shortcut to one file, URL or layer. Connections live in the existing Data Sources pane, not in a new tab, and every add-data dialog for these sources can use them.

Requirements

Scope

  1. These kinds are connections. Adding a dataset reuses today's add path for each kind; this feature doesn't change how a dataset loads.

    Kind What you browse Adding a dataset gives Platforms
    PostgreSQL/PostGIS, MySQL/MariaDB, SQL Server schemas › tables/views a live vector layer (layer.addDatabase) desktop only (no DB drivers on wasm)
    WMS, WMTS layers a rendered image/tile layer (service.add) desktop and web
    WFS, OGC API Features feature types / collections a feature layer (service.add) desktop and web
    OGC API Tiles/Maps collections a tile layer (service.add) desktop and web
    WCS coverages a raster from GetCoverage (service.coverage) desktop and web
    ArcGIS REST folders › services › layers whatever service.add makes of that service type desktop and web
    STAC API collections › items/assets footprints, an asset or a cube (stac.*) desktop and web
    CSW records › service links the linked service, through its own kind desktop and web
    S3 prefixes › objects a file layer (layer.addUrl s3://…) desktop and web (no profiles or environment keys on web)

    Only what these commands already support is in scope. For example, the time and WCS options stay in the existing dialogs.

  2. These are not connections and stay in Favourites, Recent and Folders: single files and archives (Shapefile, GeoPackage, DuckDB files, PMTiles/MBTiles, Zarr), single XYZ/TMS tile templates and plain download URLs.

Managing connections

  1. You can create, edit, rename, duplicate, test and remove a connection, and give it an optional group.
  2. A connection's identity doesn't depend on its address. Two connections to the same server, with different names or users, can coexist.
  3. Connections persist across sessions, independently of the project, on desktop and in the browser. Database connections saved on desktop show as unavailable in the browser instead of disappearing.
  4. Existing saved services, databases, STAC APIs and S3 connections show up as connections, with no manual re-entry.
  5. After a successful connect from an add dialog, the user can keep the connection in one click. Whether that is automatic is an open question (below).

Browsing and adding

  1. Expanding a connection lists its datasets lazily, one level at a time, with a refresh action and an inline error when it can't connect.
  2. You can add one or more datasets from the tree without reopening a dialog. Add with options… opens today's dialog prefilled. Each added layer is one undo step.
  3. The add dialogs (Add From Database, Add From Service, STAC, S3) can pick a saved connection instead of typing an address.

Secrets (a boundary, not a feature)

  1. No password, token, header value or secret key is written to preferences, projects, workspace recordings, Recent, or assistant transcripts. This is the existing rule (sources::redact, remember_password, the S3 docs), and connections don't relax it. A connection stores how to log in (method, user name, header name), never the secret.
  2. Secrets are asked for once per session per connection and reused for every dataset from it. The existing fallbacks keep working (PGPASSWORD, .pgpass, MYSQL_PWD, SQLCMDPASSWORD, AWS environment and profiles, Windows integrated auth).
  3. Audit: check whether ArcGIS token= values, or other credentials in service URLs, reach saved projects through layer URLs. If they do, fix it as part of this work.

Projects

  1. Projects stay self-contained. A layer's origin is still enough to reopen it on a machine without the connection.
  2. When a project opens, layers whose origin matches a saved connection reuse its session secret, so ten layers from one database ask for the password once.

Platform rules

  1. Every action is a command, so the CLI, command search and the AI assistant can list connections and add datasets from them. All UI text is translatable. The feature builds for wasm. Junk parameters never panic (hostile_params_never_panic).

UI sketch

A Connections section in the Data Sources pane takes over the role of Services, Databases, STAC APIs and S3. Favourites, Recent, Folders and Library stay.

Connections                         [+ New ▾]  [⟳]
 ▸ Work/
    ▾ 🐘 Production GIS
        ▾ public
            ▸ parcels          (polygon)
            ▸ roads            (line)
    ▸ 🌐 State WMS
 ▸ 🛰 Earth Search

Context menus: on a connection, Edit, Copy Address (without secrets) and Remove, plus Test and Refresh where the kind supports them; on a dataset, Add, plus Add With Options where the kind has options.

Shared management, kind-specific setup. Listing, grouping, renaming, removing and selecting connections work the same for every kind. Setting one up does not: the fields, how it is validated and tested, how it logs in, and how its datasets are browsed all depend on the kind. There is no single generic connection form. Some typical differences:

Family What differs
Databases host, port, database and schema, user, driver options; login uses what each driver already supports (e.g. libpq's PGPASSWORD/.pgpass fallback, Windows authentication for SQL Server)
Web services URL, service type and version, protocol defaults
S3 endpoint, region, bucket, credential source

The exact fields and what Test or Refresh means for each kind are decided when that kind's connector is built. Each kind supports only the actions that make sense for it. A connection should accept the same addresses the matching add dialog accepts today.

Delivery

The full feature is too large for one PR. Suggested PR boundaries, to be refined when each one is picked up:

  1. Connection model and storage. The model, persistence, bringing existing saved entries over, the session secret handling and the commands. No new UI. (Requirements 3–6, 11, 12, 16.)
  2. Connections in the Data Sources pane. The section and the new/edit connection dialog with Test. (3, 5.)
  3. Browsing and adding datasets from the tree. (8, 9.)
  4. Add dialog integration: pick or keep a connection. This lands the [Feature]: CONNECTION MANAGER #641 workflow. (7, 10.)
  5. Projects: match layers to connections on open, and the token audit. (13–15.)

Later and unresolved, each better as its own issue: logging in to web services (basic auth, API-key header, ArcGIS token), importing and exporting connections, and an OS keychain.

Estimated scope

Wishlist: a larger or longer-term idea. It is large overall and split into the PRs above. #641's core workflow lands with PR 4.

Alternatives considered

  • Extend the existing Data Sources entries with more fields: this is cheap, but identity stays tied to the address, so there's no room for logins, renames or duplicate addresses with different users.
  • A separate Connections tab (as [Feature]: CONNECTION MANAGER #641 suggests): this duplicates the Data Sources pane, so the connections go in a section of that pane instead.
  • Store secrets in preferences: rejected, because it breaks the documented promise. Remembering secrets belongs to a future keychain issue.

Open questions

  1. Should a connection used to add a layer be kept automatically, or only when the user ticks Save?
  2. Should connections fully replace the Services/Databases/STAC/S3 entries, or should those stay as plain shortcuts next to them?
  3. Should DuckDB files count as connections? They hold many tables, but they are files.
  4. Should a project be able to carry connection definitions (without secrets) to share with others?
  5. Which kinds of web-service login matter first, and would a keychain ever be acceptable given the pure-Rust and wasm constraints?

Activity

  1. changed the title [-][Feature]: Connection manager for databases and web services (follow-up to #641)[/-] [+][Feature]: Connection manager for databases and web services[/+] on Oct 22, 2026
  2. deniial00 commented on Oct 22, 2026

    @deniial00
    MemberAuthor

    Two follow-up ideas from reviewing the tree in #708 (not part of that PR):

    1. Menu access. The Data Sources pane is only reachable from the View tab (View › Windows › Data Sources) and its tab in the left pane. Home › Add Data lists From Service…, Database… and S3…, but has no entry for saved connections. Suggest a Connections… item there (plus New Connection ▸ by kind, databases hidden in the web app). ui.pane.sources toggles the pane off when it is already open, so this needs an open-only command (or the entry has to read as a toggle). Saved connections themselves stay in the tree, not in the menu.
    2. Recent naming. A layer added from the tree is recorded under a name derived from the address (service for …/osm/service), and all layers of one service collapse into one entry (identity is kind + address). Re-noting the source after a tree add under the connection's name (same kind, address and extra, so clicking it still reopens the right layer) would make Recent recognisable. Caveats: the name is a snapshot (a rename leaves the old one until re-added), and two connections with one address share an entry.
  3. deniial00 commented on Oct 22, 2026

    @deniial00
    MemberAuthor

    A question on the add dialogs (requirement 10): should Add From Service, Add From Database, STAC and S3 also be able to add layers from a saved connection?

    What I have in mind: a Connection dropdown at the top of each dialog, listing the saved connections of that kind. Picking one fills in the address and login, and the dialog's existing browser (layer list, table list) opens on it. Typing a new address stays possible, with a way to keep it as a connection afterwards.

    The alternative is to browse and add only from the Connections section of the Data Sources pane, and leave the dialogs as they are.

    I lean towards doing both: the pane for browsing, and the dialogs for people who start from Add Data, and for options like time, CRS or a WCS bounding box that the pane's tree doesn't cover.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions