Skip to content

Internals ​

For working on CoSky itself. Architecture explains the system, the design document the reasoning, and CONTRIBUTING.md how to send a change.

Modules ​

ModuleHoldsDepends on
apiProtos, generated code, validation, errors, the OpenAPI documentNothing
storeThe Store interface, and an implementation in memoryapi
store-redisThe Redis Store: the only module with Luastore
servergRPC, REST, the Watch cache, the reaper, auth, viewsapi, store, store-redis
clientConnections, Watch, leases, snapshots, load balancing. No Spring and no Redis.api
spring-boot-starterConfigData loading, refresh, discovery, registryclient
conformance-testThe suites the Store and the protocol must passstore, client
migrationcosky-migrate. The only module that knows 6.x.api
examplesA provider and a consumer, and the test that runs themThe starter
dashboardThe React frontend, with a build of its ownThe REST API
wikiThis site

Two rules hold this together. Nothing but the server touches the Store, and clients never see Redis. And both protocols are one contract: REST is mapped from the same protos as gRPC.

Building ​

bash
./gradlew build

Building needs JDK 21, and the server's tests and :server:run need JDK 25, and Docker for the tests. Install both JDKs: Gradle does not download them. ./gradlew :server:run --args='--dev' starts a server in memory.

The server bundles the Dashboard when dashboard/dist exists:

bash
pnpm --dir dashboard install && pnpm --dir dashboard build

Testing ​

LevelWhereAgainst
Store conformanceconformance-test, run by store and store-redisMemory, Redis, Redis Cluster
Protocol conformanceconformance-test, run by serverThe real services over gRPC
Parity of the protocolsProtocolParityTestThe same request over gRPC and REST ends the same way
FaultsFaultInjectionTestA real server behind Toxiproxy: partitions, slow links, a hung store
FailoverRedisStoreFailoverTestA real Redis losing writes
End to endexamples/e2eThe server, a provider and a consumer as separate processes
TLSTlsEndToEndTestBoth ports, with a generated certificate
Dashboarddashboard/tests/uiA mock answering as the server does
Dashboard against the imagedashboard/tests/ui/real-backend.spec.tsThe page the image hosts, on that image
MigrationmigrationA real Redis and a real server

Line coverage has a floor of 90%, enforced by ./gradlew build. New behaviour should fail a test when you take it out, so try that.

Every pull request also runs Redis 7.0 and Valkey 8, CodeQL, and an image build that starts the image and drives it.

Lua ​

All of it is in store-redis. Each script keeps to one namespace's hash tag, and declares its keys. The layout is in the design's section on keys.

Conventions ​

  • Coroutines, carried by virtual threads. Reactor stays in the adapters, which Detekt enforces.
  • Errors carry a stable reason, mapped to a gRPC code and an HTTP status in one place.
  • A change to behaviour updates the design, and a decision gets a D-number in its table.
  • Tests assert behaviour through public interfaces, against real dependencies where it matters.

Released under the Apache License 2.0.