Learn / Tutorials / First Steps with ArchitectureKit / Go / Setting Up the Project
Step 1 of 6

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/v2/system/ping

The response looks like this, with the exception of the id and time fields, which differ on every ping:

{"type":"event","data":{"specversion":"1.0","id":"01a17415-8d8e-718a-9e32-4613373fea68","source":"https://www.eventsourcingdb.io","type":"io.eventsourcingdb.api.ping-received","subject":"/api/v2/system/ping","time":"2026-10-25T17:22:11.982099Z","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/v2/architecturekit github.com/thenativeweb/eventsourcingdb-client-golang/v2/eventsourcingdb

Planning the Files#

The library consists of a few files in the package main, all in the library directory:

  • events.go and book.go hold the events and the state of a book.
  • store.go connects to EventSourcingDB.
  • commands.go and deciders.go hold the commands and the decisions on them.
  • catalog.go and queries.go hold the view and the queries that read it.
  • requests.go maps HTTP requests to commands and queries.
  • responses.go maps the items of the catalog to HTTP responses.
  • deciders_test.go tests 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.