Declarative, rule-based audience segmentation. Segments are defined in
code with the defaudience macro or persisted dynamically in the
database, then evaluated against your user base through a hybrid SQL
predicate pipeline.
| Namespace | Purpose |
|---|---|
| Pure: segment records, |
| Pure: built-in filter types and the |
| Pure: hybrid SQL + predicate evaluation pipeline |
| Protocols: |
| Service orchestrating resolution, caching, and persistence |
| REST + web endpoints (CRUD, preview, evaluate, members) |
| Filter | Matches on |
|---|---|
| Age, gender, and other profile attributes |
| Country, region, city |
| Assigned user roles |
| Time since account creation |
| Recency of last activity |
| Recorded user events / actions |
| Use of specific product features |
Each filter is resolved through the filter→sql and
filter→predicate multimethods. SQL-eligible filters are pushed to the
database; the rest run as Clojure predicates over the candidate set.
Define new methods on both multimethods to add custom filter types.
Segments compose with AND / OR / NOT. Circular references between composed segments are detected and rejected at definition time.
Segments can also be stored in the database as JSON and loaded at runtime. Incoming JSON is schema-validated, and fn-typed values are rejected so persisted definitions stay data-only.
Membership results are cached in an audience_memberships table with a
configurable per-segment TTL, served through the IAudienceCache
component.
A segment builder is served over HTMX, with Replicant widget mount points for the filter panel and the composition builder.
| Endpoint group | Purpose |
|---|---|
CRUD | Create, read, update, delete segments |
Preview | Count + sample of matching members |
Evaluate | Run evaluation and cache the result |
Members | List cached members of a segment |
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |