# Guides

> Run a TypeScript snippet in your browser, see what it returns, and adapt it to your project.

## Integrations

* [Build hybrid search for your docs](/guides/hybrid-docs-search/): Search Knotkit’s module docs by API name or by describing what you need.
* [Rate-limit an Effect endpoint](/guides/effect-rate-limit/): Give each API client a request budget and return HTTP 429 with a retry time.

## Queues and ordering

* [Keep the k largest values of a stream](/guides/top-k/): Hold a min heap of size `k` and replace its root whenever a larger value arrives.
* [Change the priority of queued work](/guides/reprioritize/): An indexed priority queue finds a queued item by its value and moves it in place.
* [Pick the k items that cover the most](/guides/budgeted-coverage/): Lazy greedy keeps every candidate in a max heap keyed by its last known gain and re-evaluates only the top.
* [Read the first n items of several sorted lists](/guides/merge-sorted/): Merge sorted inputs lazily, and stop as soon as you have enough.
* [Compute a rolling average over the last n values](/guides/rolling-average/): A bounded deque returns the value a push evicts, so the running sum subtracts exactly what left the window.

## Sets and caches

* [Deduplicate records by numeric id](/guides/dedupe-ids/): A Roaring bitset records which ids you have seen in about two bytes per id, or one bit per possible id once ids are dense.
* [Cap a cache by entry count](/guides/bounded-cache/): A SIEVE cache keeps at most `capacity` entries and returns what it evicted from every `set`.
* [Limit each client to a request rate](/guides/per-client-rate-limit/): A keyed table builds one rate-limit meter per client, spends and refuses weight on that client alone, and forgets a client only once its meter would decide like a fresh one.
* [Find which items are connected](/guides/connected-groups/): A disjoint set merges groups as links arrive and answers whether two items are in the same group.

## Randomness and statistics

* [Shuffle reproducibly from a seed](/guides/seeded-shuffle/): Pass a seeded random source to `shuffled`, and the same seed gives the same order on every machine.
* [Sample a stream of unknown length](/guides/stream-sample/): A reservoir sampler keeps a uniform sample of fixed size, however many items pass through.
* [Test whether two samples differ](/guides/compare-samples/): The Mann–Whitney U test compares two independent samples without assuming they are normal.

## Saving and loading

* [Save a structure and load it back](/guides/save-and-load/): Serialization lives in a `/wire` subpath. It writes versioned bytes and restores the same layout.

## Larger examples

See how the same modules work together on larger workloads, from [road routing](/problems/road-network/) to [near-duplicate detection](/problems/near-duplicate-detection/). [Browse all examples](/problems/).
