Setting Up the Project
In this step, you start EventSourcingDB, create a Go module for the library, and add ArchitectureKit to it.
Starting EventSourcingDB#
ArchitectureKit stores its events in EventSourcingDB. Start it with the following command. On the first start, Docker downloads the image:
docker run -it -p 3000:3000 \
thenativeweb/eventsourcingdb run \
--api-token=secret \
--data-directory-temporary \
--http-enabled \
--https-enabled=false
This starts EventSourcingDB on port 3000, with the API token secret, a temporary data directory that is cleaned up on shutdown, and unencrypted HTTP.
Keep EventSourcingDB running for the whole tutorial. Every step builds on the events that the previous steps have written, and since the data directory is temporary, stopping EventSourcingDB removes all of them.
For Development and Testing Only
These settings simplify the setup but are not secure for production. For production-ready configurations, see Running EventSourcingDB.
To check that EventSourcingDB is ready, open a second terminal and send a ping:
curl http://localhost:3000/api/v1/ping
The response looks like this, with the exception of the time field:
{"specversion":"1.0","type":"io.eventsourcingdb.api.ping-received","source":"https://www.eventsourcingdb.io","id":"0","time":"2026-09-29T21:57:18.723703254Z","subject":"/api/v1/ping","datacontenttype":"application/json","data":{"message":"My God, it's full of stars."}}
Creating a Module#
In the second terminal, create a directory for the library and a Go module in it. Then add ArchitectureKit and the client SDK for Go, which ArchitectureKit uses to connect to EventSourcingDB:
mkdir library
cd library
go mod init library
go get github.com/thenativeweb/architecturekit-golang/architecturekit github.com/thenativeweb/eventsourcingdb-client-golang/eventsourcingdb
Planning the Files#
The library consists of a few files in the package main, all in the library directory:
events.goandbook.gohold the events and the state of a book.store.goconnects to EventSourcingDB.commands.goanddeciders.gohold the commands and the decisions on them.catalog.goandqueries.gohold the view and the query that reads it.requests.gomaps HTTP requests to commands and queries.deciders_test.gotests the decisions.
The following steps add these files one by one. The file main.go runs what the current step is about, so every step replaces it.