Skip to content
David Cumps

Basisregisters

  • Digitaal Vlaanderen
  • 2017-2021

The Flemish base registries (Basisregisters Vlaanderen) are the government’s single official source for municipalities, postal codes, street names, addresses, buildings, building units, parcels and roads. Other applications refer to their records by a unique identifier and fetch the data from them. I came into Digitaal Vlaanderen, then still Informatie Vlaanderen, with Wegwijs, the organisation registry. Once Wegwijs had shown that its event-sourced approach worked, my role grew into designing and building the base registries and leading the team behind them, from 2017 until early 2021.

One architecture, many registries. Every registry is its own event-sourced .NET service, built with CQRS and domain-driven design on SQL Stream Store. Projections turn the events into what each consumer needs: a REST API, Atom feeds that other systems synchronise from, downloadable extracts as shapefiles, and Redis caches in front of the busiest calls. The data came from CRAB, the old address database, through an import per registry. I wrote the reference registry and the dotnet new template every new registry starts from, and the shared extract framework that produces the shapefile downloads for all of them. I also built smaller registries end to end, such as bank account numbers, and set up the public service registry on the European CPSV-AP vocabulary. The road registry came from the same team and runs on the same components; following it up and making it fit in with the rest was part of my job.

One public API. I built the public API gateway that puts all registries behind a single, documented API with Swagger and ReDoc, cached in Redis. Access runs through AWS API Gateway with API keys and rate limits, and I adapted AWS’s open-source developer portal so people can request their own key. Before releases, load tests (Gatling, later Taurus) checked the registries and the rate limits under load. The public site, basisregisters.vlaanderen.be, is a Vue front-end on the Flemish government’s own components. I built it so its release notes and changelogs come straight from GitHub.

From a private TFS server to open source. All code used to live on a private TFS server. Moving it, by way of Bitbucket, to GitHub, and moving the department to work in the open, was my doing. From December 2018 I published the registries under the EUPL and about 30 shared libraries under the MIT license, with packages on NuGet.org instead of a private feed and automatic, semantically versioned releases. The department’s GitHub organisation, github.com/informatievlaanderen, has since grown to more than 300 public repositories.

Shared building blocks. The registries run on a common set of NuGet packages: command, event and projection handling for event sourcing, a common API host with health checks, problem details and DataDog tracing, the Redis cache populator, Swagger and ReDoc setup, and some twenty ASP.NET Core middleware and serialisation packages. I open-sourced most of them and kept the whole set on each new .NET release, from .NET Core 2 to .NET 5. Every repository builds the same way, with one shared pipeline of F# build scripts (FAKE) and Paket, first on CircleCI and later on GitHub Actions.

Running it. The registries started out on Azure. I led their move to AWS, together with Wegwijs, and managed the entire AWS environment from then on. The infrastructure is code, in Terraform. After the move, every service ran as a Docker container on a HashiCorp Nomad cluster, to keep the compute side cloud-agnostic, with Consul for service discovery and configuration, Vault for secrets and Packer building the machine images. Over time we moved the services to AWS Fargate, which was simpler to run. Monitoring and tracing go through DataDog, with trace IDs in every log line. Distributed locks on DynamoDB make sure only one instance of each projector runs, and status pages show the state of the caches and imports. Architecture decisions are written down as ADRs, with C4 diagrams generated from code by Structurizr.

The team. I led a team of developers and testers: code reviews on GitHub, deployments and the technical planning.

Technologies: Event Sourcing, CQRS, DDD, .NET Core 2 to .NET 5, C#, F#, Python, ASP.NET Core, Web API, REST, Entity Framework, Dapper, SQL Server, SQL Stream Store, AggregateSource, Atom, Redis, Swagger, ReDoc, Autofac, FluentValidation, xUnit, Paket, FAKE, NuGet, MyGet, Git, GitHub, CircleCI, GitHub Actions, AWS (Fargate, RDS, S3, API Gateway, Cognito, CloudWatch, DynamoDB), Docker, Terraform, Nomad, Consul, Vault, Packer, Azure, DataDog, Gatling, Taurus, Structurizr, Vue, JSON-LD, OSLO, CPSV-AP, ACM/IDM, GeoSecure, Burgerprofiel, OpenID, Jira, Confluence, Slack, Kanban.

Arne Dumarey
David is a great architect on our project. He has thorough knowledge of all the components in play, is always open for feedback and a great team player. The kind of person you want on every project.
Arne Dumarey, Senior .NET Developer, Digitaal Vlaanderen

You May Also Like