# Home
## Content
# Welcome to Trifle Documentation
Opinionated [Swiss Army knife](https://en.wikipedia.org/wiki/Swiss_Army_knife) of little big tools.
These gems came from necessity of building better solutions to common problems. Tired of using _shitty_ analytics and reading through _shitty_ log output. These are small and simple. And that is OK. It is not one solution fits all type of things.
All gems from this collection are released under MIT license.
Made by galons of 鈽曪笍 and 馃嵑 by [JozefVaclavik](https://twitter.com/JozefVaclavik).
---
# Applications
Apps you can run to make your use of below plugins easier.
:::card "Trifle App" "Dashboards + API" "Docs" "/trifle-app/"
Visual and automation layer for Trifle Stats. Dashboards, monitors, API, and tokens.
```sh
trifle metrics push \
--key event::signup \
--values '{"count":1}'
```
:::
:::card "Trifle CLI" "API + SQLite" "Docs" "/trifle-cli/"
Command-line tooling for Trifle metrics with API or local SQLite drivers, plus MCP server mode.
```sh
trifle metrics setup --driver sqlite --db ./stats.db
trifle metrics get --driver sqlite --db ./stats.db --key event::signup --granularity 1h
```
:::
---
# Plugins
These are gems and plugins you can plug into your app to start building.
:::card "Trifle::Stats" "Ruby 路 Time-series metrics" "Docs" "/trifle-stats-rb/"
Track counters and numeric payloads, then read back series by granularity.
```ruby
Trifle::Stats.configure do |c|
c.driver = Trifle::Stats::Driver::Redis.new(Redis.new)
c.granularities = ["1h"]
end
Trifle::Stats.track(
key: "event::signup",
at: Time.now.utc,
values: { count: 1 }
)
```
:::
:::card "Trifle.Stats" "Elixir 路 Time-series metrics" "Docs" "/trifle-stats-ex/"
Minimal Elixir API for tracking counters and reading series.
```elixir
{:ok, pid} = Trifle.Stats.Driver.Process.start_link()
driver = Trifle.Stats.Driver.Process.new(pid)
Trifle.Stats.configure(driver: driver, track_granularities: ["1h"])
Trifle.Stats.track("event::signup", DateTime.utc_now(), %{count: 1})
```
:::
:::card "TrifleStats" "Go 路 Time-series metrics" "Docs" "/trifle-stats-go/"
Go library for tracking counters and reading series with SQLite.
```go
import TrifleStats "github.com/trifle-io/trifle_stats_go"
db, _ := sql.Open("sqlite", "file:stats.db?cache=shared&mode=rwc")
driver := TrifleStats.NewSQLiteDriver(db, "trifle_stats", TrifleStats.JoinedFull)
_ = driver.Setup()
cfg := TrifleStats.DefaultConfig()
cfg.Driver = driver
TrifleStats.Track(cfg, "event::signup", time.Now().UTC(), map[string]any{"count": 1})
```
:::
:::card "Trifle::Traces" "Ruby 路 Execution tracing" "Docs" "/trifle-traces/"
Capture messages, return values, and metadata from code blocks.
```ruby
Trifle::Traces.tracer = Trifle::Traces::Tracer::Hash.new(
key: "jobs/invoice_charge"
)
Trifle::Traces.trace("Charge invoice") { charge_invoice(42) }
Trifle::Traces.tracer.wrapup
```
:::
:::card "Trifle::Docs" "Ruby 路 Static docs router" "Docs" "/trifle-docs/"
Map a folder of Markdown/textile/static files to URLs and render them in-app.
```ruby
Trifle::Docs.configure do |c|
c.path = Rails.root.join("docs")
c.register_harvester(Trifle::Docs::Harvester::Markdown)
end
Trifle::Docs.content(url: "getting_started")
```
:::
:::card "Trifle::Logs" "Ruby 路 File-backed logs" "Docs" "/trifle-logs/"
Dump logs to disk and search them locally with fast paging.
```ruby
Trifle::Logs.configure do |c|
c.driver = Trifle::Logs::Driver::File.new(path: "/var/logs/trifle")
end
Trifle::Logs.dump("billing", { event: "invoice_charged" })
```
:::