Skip to content

Commit ca5e370

Browse files
feat: add GraphQL API with Iceberg-backed CloudEvent retrieval
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 4d9f550 commit ca5e370

27 files changed

Lines changed: 4770 additions & 97 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ __debug_bin*
3232
.env
3333

3434

35+
fetch-api

Makefile

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: clean run build install dep test lint format docker
1+
.PHONY: clean run build install dep test lint format docker gqlgen
22

33
SHELL := /bin/bash
44
PATHINSTBIN = $(abspath ./bin)
@@ -20,7 +20,7 @@ VER_CUT := $(shell echo $(VERSION) | cut -c2-)
2020

2121
# Dependency versions
2222
GOLANGCI_VERSION = latest
23-
PROTOC_VERSION = 28.3
23+
PROTOC_VERSION = 33.4
2424
PROTOC_GEN_GO_VERSION = $(shell go list -m -f '{{.Version}}' google.golang.org/protobuf)
2525
PROTOC_GEN_GO_GRPC_VERSION = v1.5.1
2626

@@ -56,9 +56,26 @@ lint: ## run linter
5656
@PATH=$$PATH golangci-lint run --timeout 10m
5757

5858
docker: dep ## build docker image
59-
@docker build -f ./Dockerfile . -t dimozone/$(BIN_NAME):$(VER_CUT)
59+
@docker build --build-arg APP_NAME=$(BIN_NAME) -f ./Dockerfile . -t dimozone/$(BIN_NAME):$(VER_CUT)
6060
@docker tag dimozone/$(BIN_NAME):$(VER_CUT) dimozone/$(BIN_NAME):latest
6161

62+
# Build multi-arch (amd64 + arm64) and push with a random tag. Does not trigger GitHub workflows.
63+
# Requires: docker buildx, docker login. Run from repo root.
64+
docker-push-multiarch:
65+
$(eval TAG := dev-$(shell openssl rand -hex 6))
66+
@echo "Building and pushing dimozone/$(BIN_NAME):$(TAG) (linux/amd64, linux/arm64)"
67+
@docker buildx build --build-arg APP_NAME=$(BIN_NAME) --platform linux/amd64,linux/arm64 -f ./Dockerfile --push -t dimozone/$(BIN_NAME):$(TAG) .
68+
@echo "Pushed dimozone/$(BIN_NAME):$(TAG)"
69+
70+
# Same as docker-push-multiarch but using podman (manifest list + manifest push --all).
71+
podman-push-multiarch:
72+
$(eval TAG := dev-$(shell openssl rand -hex 6))
73+
$(eval IMAGE := dimozone/$(BIN_NAME):$(TAG))
74+
@echo "Building and pushing $(IMAGE) (linux/amd64, linux/arm64)"
75+
@podman build --build-arg APP_NAME=$(BIN_NAME) --platform linux/amd64,linux/arm64 --manifest $(IMAGE) -f ./Dockerfile .
76+
@podman manifest push --all $(IMAGE) docker://$(IMAGE)
77+
@echo "Pushed $(IMAGE)"
78+
6279
tools-golangci-lint: ## install golangci-lint
6380
@mkdir -p $(PATHINSTBIN)
6481
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | BINARY=golangci-lint bash -s -- ${GOLANGCI_VERSION}
@@ -80,7 +97,10 @@ endif
8097

8198
make tools: tools-golangci-lint tools-protoc ## install all tools
8299

83-
generate: generate-swagger generate-go generate-grpc ## run all file generation for the project
100+
gqlgen: ## Generate gqlgen code.
101+
@go tool gqlgen generate
102+
103+
generate: gqlgen generate-swagger generate-go generate-grpc ## run all file generation for the project
84104

85105
generate-swagger: ## generate swagger documentation
86106
@go tool swag -version

charts/fetch-api/values-prod.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ env:
1111
TOKEN_EXCHANGE_ISSUER_URL: https://auth-roles-rights.dimo.zone
1212
CLOUDEVENT_BUCKET: dimo-ingest-cloudevent-prod
1313
EPHEMERAL_BUCKET: dimo-ingest-ephemeral-prod
14-
VC_BUCKET: dimo-network-vc-prod
1514
VEHICLE_NFT_ADDRESS: '0xbA5738a18d83D41847dfFbDC6101d37C69c9B0cF'
1615
CHAIN_ID: 137
1716
ingress:

charts/fetch-api/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ env:
3333
TOKEN_EXCHANGE_ISSUER_URL: https://auth-roles-rights.dev.dimo.zone
3434
CLOUDEVENT_BUCKET: dimo-ingest-cloudevent-dev
3535
EPHEMERAL_BUCKET: dimo-ingest-ephemeral-dev
36-
VC_BUCKET: dimo-network-vc-dev
3736
S3_AWS_REGION: us-east-2
3837
VEHICLE_NFT_ADDRESS: '0x45fbCD3ef7361d156e8b16F5538AE36DEdf61Da8'
3938
CHAIN_ID: 80002

docs/docs.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,9 @@ const docTemplate = `{
397397
"type": "integer"
398398
}
399399
},
400+
"data_base64": {
401+
"type": "string"
402+
},
400403
"datacontenttype": {
401404
"description": "DataContentType is an optional MIME type for the data field. We almost\nalways serialize to JSON and in that case this field is implicitly\n\"application/json\".",
402405
"type": "string"
@@ -469,6 +472,9 @@ const docTemplate = `{
469472
}
470473
]
471474
},
475+
"data_base64": {
476+
"type": "string"
477+
},
472478
"datacontenttype": {
473479
"description": "DataContentType is an optional MIME type for the data field. We almost\nalways serialize to JSON and in that case this field is implicitly\n\"application/json\".",
474480
"type": "string"

docs/swagger.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,9 @@
388388
"type": "integer"
389389
}
390390
},
391+
"data_base64": {
392+
"type": "string"
393+
},
391394
"datacontenttype": {
392395
"description": "DataContentType is an optional MIME type for the data field. We almost\nalways serialize to JSON and in that case this field is implicitly\n\"application/json\".",
393396
"type": "string"
@@ -460,6 +463,9 @@
460463
}
461464
]
462465
},
466+
"data_base64": {
467+
"type": "string"
468+
},
463469
"datacontenttype": {
464470
"description": "DataContentType is an optional MIME type for the data field. We almost\nalways serialize to JSON and in that case this field is implicitly\n\"application/json\".",
465471
"type": "string"

docs/swagger.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ definitions:
66
items:
77
type: integer
88
type: array
9+
data_base64:
10+
type: string
911
datacontenttype:
1012
description: |-
1113
DataContentType is an optional MIME type for the data field. We almost
@@ -72,6 +74,8 @@ definitions:
7274
allOf:
7375
- $ref: '#/definitions/github_com_DIMO-Network_fetch-api_pkg_eventrepo.ObjectInfo'
7476
description: Data contains domain-specific information about the event.
77+
data_base64:
78+
type: string
7579
datacontenttype:
7680
description: |-
7781
DataContentType is an optional MIME type for the data field. We almost

go.mod

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,34 @@ module github.com/DIMO-Network/fetch-api
33
go 1.25
44

55
require (
6+
github.com/99designs/gqlgen v0.17.86
67
github.com/ClickHouse/clickhouse-go/v2 v2.40.1
78
github.com/DIMO-Network/clickhouse-infra v0.0.5
8-
github.com/DIMO-Network/cloudevent v0.1.4
9+
github.com/DIMO-Network/cloudevent v0.1.5
910
github.com/DIMO-Network/server-garage v0.0.7
1011
github.com/DIMO-Network/shared v1.0.7
1112
github.com/DIMO-Network/token-exchange-api v0.3.7
13+
github.com/apache/arrow-go/v18 v18.5.1
1214
github.com/aws/aws-sdk-go-v2 v1.38.3
1315
github.com/aws/aws-sdk-go-v2/credentials v1.18.10
1416
github.com/aws/aws-sdk-go-v2/service/s3 v1.87.3
1517
github.com/ethereum/go-ethereum v1.16.4
1618
github.com/gofiber/fiber/v2 v2.52.9
1719
github.com/gofiber/swagger v1.1.1
20+
github.com/golang-jwt/jwt/v5 v5.3.0
1821
github.com/google/go-cmp v0.7.0
1922
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
2023
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2
2124
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
2225
github.com/rs/zerolog v1.34.0
2326
github.com/stretchr/testify v1.11.1
2427
github.com/swaggo/swag v1.16.6
28+
github.com/vektah/gqlparser/v2 v2.5.31
2529
github.com/volatiletech/sqlboiler/v4 v4.19.1
2630
go.uber.org/mock v0.6.0
27-
golang.org/x/sync v0.17.0
28-
google.golang.org/grpc v1.75.0
29-
google.golang.org/protobuf v1.36.10
31+
golang.org/x/sync v0.19.0
32+
google.golang.org/grpc v1.78.0
33+
google.golang.org/protobuf v1.36.11
3034
)
3135

3236
require (
@@ -36,7 +40,9 @@ require (
3640
github.com/KyleBanks/depth v1.2.1 // indirect
3741
github.com/MicahParks/keyfunc/v2 v2.1.0 // indirect
3842
github.com/Microsoft/go-winio v0.6.2 // indirect
43+
github.com/agnivade/levenshtein v1.2.1 // indirect
3944
github.com/andybalholm/brotli v1.2.0 // indirect
45+
github.com/apache/thrift v0.22.0 // indirect
4046
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.1 // indirect
4147
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.6 // indirect
4248
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.6 // indirect
@@ -74,14 +80,22 @@ require (
7480
github.com/go-openapi/jsonreference v0.20.4 // indirect
7581
github.com/go-openapi/spec v0.20.14 // indirect
7682
github.com/go-openapi/swag v0.22.9 // indirect
83+
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
84+
github.com/goccy/go-json v0.10.5 // indirect
85+
github.com/goccy/go-yaml v1.19.2 // indirect
7786
github.com/gofiber/contrib/jwt v1.1.2 // indirect
7887
github.com/gogo/protobuf v1.3.2 // indirect
79-
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
88+
github.com/golang/snappy v1.0.0 // indirect
89+
github.com/google/flatbuffers v25.12.19+incompatible // indirect
8090
github.com/google/uuid v1.6.0 // indirect
91+
github.com/gorilla/websocket v1.5.1 // indirect
92+
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
8193
github.com/holiman/uint256 v1.3.2 // indirect
8294
github.com/joho/godotenv v1.5.1 // indirect
8395
github.com/josharian/intern v1.0.0 // indirect
84-
github.com/klauspost/compress v1.18.0 // indirect
96+
github.com/klauspost/asmfmt v1.3.2 // indirect
97+
github.com/klauspost/compress v1.18.2 // indirect
98+
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
8599
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 // indirect
86100
github.com/magiconair/properties v1.8.10 // indirect
87101
github.com/mailru/easyjson v0.7.7 // indirect
@@ -90,6 +104,8 @@ require (
90104
github.com/mattn/go-runewidth v0.0.16 // indirect
91105
github.com/mdelapenya/tlscert v0.2.0 // indirect
92106
github.com/mfridman/interpolate v0.0.2 // indirect
107+
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 // indirect
108+
github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 // indirect
93109
github.com/moby/docker-image-spec v1.3.1 // indirect
94110
github.com/moby/go-archive v0.1.0 // indirect
95111
github.com/moby/patternmatcher v0.6.0 // indirect
@@ -102,9 +118,9 @@ require (
102118
github.com/opencontainers/go-digest v1.0.0 // indirect
103119
github.com/opencontainers/image-spec v1.1.1 // indirect
104120
github.com/paulmach/orb v0.11.1 // indirect
105-
github.com/pierrec/lz4/v4 v4.1.22 // indirect
121+
github.com/pierrec/lz4/v4 v4.1.23 // indirect
106122
github.com/pkg/errors v0.9.1 // indirect
107-
github.com/pmezard/go-difflib v1.0.0 // indirect
123+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
108124
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
109125
github.com/pressly/goose/v3 v3.24.3 // indirect
110126
github.com/prometheus/client_golang v1.23.0 // indirect
@@ -118,6 +134,7 @@ require (
118134
github.com/shirou/gopsutil/v4 v4.25.5 // indirect
119135
github.com/shopspring/decimal v1.4.0 // indirect
120136
github.com/sirupsen/logrus v1.9.3 // indirect
137+
github.com/sosodev/duration v1.3.1 // indirect
121138
github.com/spf13/cast v1.7.0 // indirect
122139
github.com/swaggo/files/v2 v2.0.2 // indirect
123140
github.com/testcontainers/testcontainers-go v0.38.0 // indirect
@@ -129,34 +146,39 @@ require (
129146
github.com/tklauser/go-sysconf v0.3.15 // indirect
130147
github.com/tklauser/numcpus v0.10.0 // indirect
131148
github.com/urfave/cli/v2 v2.27.5 // indirect
149+
github.com/urfave/cli/v3 v3.6.1 // indirect
132150
github.com/valyala/bytebufferpool v1.0.0 // indirect
133151
github.com/valyala/fasthttp v1.65.0 // indirect
134152
github.com/volatiletech/inflect v0.0.1 // indirect
135153
github.com/volatiletech/strmangle v0.0.7-0.20240503230658-86517898275a // indirect
136154
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
137155
github.com/yusufpapurcu/wmi v1.2.4 // indirect
138-
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
156+
github.com/zeebo/xxh3 v1.0.2 // indirect
157+
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
139158
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
140-
go.opentelemetry.io/otel v1.37.0 // indirect
141-
go.opentelemetry.io/otel/metric v1.37.0 // indirect
142-
go.opentelemetry.io/otel/trace v1.37.0 // indirect
159+
go.opentelemetry.io/otel v1.38.0 // indirect
160+
go.opentelemetry.io/otel/metric v1.38.0 // indirect
161+
go.opentelemetry.io/otel/trace v1.38.0 // indirect
143162
go.uber.org/multierr v1.11.0 // indirect
144-
golang.org/x/crypto v0.43.0 // indirect
145-
golang.org/x/mod v0.28.0 // indirect
146-
golang.org/x/net v0.45.0 // indirect
147-
golang.org/x/sys v0.37.0 // indirect
148-
golang.org/x/text v0.30.0 // indirect
149-
golang.org/x/tools v0.37.0 // indirect
150-
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect
151-
google.golang.org/genproto/googleapis/api v0.0.0-20250818200422-3122310a409c // indirect
152-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c // indirect
163+
golang.org/x/crypto v0.47.0 // indirect
164+
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect
165+
golang.org/x/mod v0.32.0 // indirect
166+
golang.org/x/net v0.49.0 // indirect
167+
golang.org/x/sys v0.40.0 // indirect
168+
golang.org/x/telemetry v0.0.0-20260109210033-bd525da824e2 // indirect
169+
golang.org/x/text v0.33.0 // indirect
170+
golang.org/x/tools v0.41.0 // indirect
171+
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
172+
google.golang.org/genproto/googleapis/api v0.0.0-20251029180050-ab9386a59fda // indirect
173+
google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda // indirect
153174
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 // indirect
154175
gopkg.in/yaml.v2 v2.4.0 // indirect
155176
gopkg.in/yaml.v3 v3.0.1 // indirect
156177
sigs.k8s.io/yaml v1.3.0 // indirect
157178
)
158179

159180
tool (
181+
github.com/99designs/gqlgen
160182
github.com/swaggo/swag/cmd/swag
161183
go.uber.org/mock/mockgen
162184
google.golang.org/grpc/cmd/protoc-gen-go-grpc

0 commit comments

Comments
 (0)