Install and run
Start here: install it and get a flow running. Then read How it works — the replay model is the one thing you genuinely have to understand. Everything after that is reference you can come back to.
On this page
gotick is a library, not a service. Nothing to deploy, no schema to migrate, no daemon that has to stay alive. It needs a Redis, and the one you already run will do.
Install
Go 1.25 or newer. Several projects can share one Redis — give each of them its own queue namespace and they won't see each other.
go get github.com/zbysir/gotickRegister a flow, start the scheduler
NewServerFromConfig gives you a server, Flow registers a definition under an id, and StartServer blocks while driving the scheduler — usually the last line of main, or a goroutine next to your HTTP server. Registering a flow doesn't run it; Trigger does.
tick, err := gotick.NewServerFromConfig(gotick.Config{ RedisURL: "redis://localhost:6379/0",})if err != nil { log.Fatal(err)} tick.Flow("order/close", func(ctx *gotick.Context) { gotick.Task(ctx, "create-order", createOrder) gotick.Sleep(ctx, "wait-payment", 30*time.Minute) gotick.Task(ctx, "close-order", closeOrder)}) callId, err := tick.Trigger(ctx, "order/close", gotick.MetaData{ "order_id": "ORD-1",}) log.Fatal(tick.StartServer(ctx))A process that only starts flows
An HTTP handler that kicks off a flow doesn't need to execute one. NewClient gives you Trigger and nothing else. It reaches the workers through Redis — the two processes never connect directly, and they deploy independently.
client, err := gotick.NewClient(gotick.NewClientConfig{ RedisURL: "redis://localhost:6379/0",})if err != nil { log.Fatal(err)} // 0 = start nowcallId, err := client.Trigger(ctx, "order/close", meta, 0)In tests, without Redis
There are in-memory implementations of both the queue and the store, so a unit test runs a real flow — real scheduling, real replay, real retries — inside the test process. Every test in the repo works this way.
tick := gotick.NewServer(gotick.NewServerParams{ DelayedQueue: store.NewMockRedisDelayedQueue(), KVStore: store.NewMockKvStore(),})