# Services

URL: /docs/platform/services

The services that funcd runs for its workloads, how each is reached, and where funcd keeps them on disk.

![How each service is reached, and what serves it. A KVStore through ctx.kv, on memory or Badger. A Bucket through ctx.blob or the S3 gateway, on files or S3. A SQLDatabase through ctx.sql, on rqlite. A Lake through its gateway, on DuckDB. An add-on object through ctx.addon, the add-on proxy or the edge, on its engine. A worker's volumes through its mounts, on the local disk](</assets/services.drawio-BWDjFZTP.svg>)

funcd serves the stores a Function binds: a KVStore, a Bucket, a SQLDatabase and a Lake, and the Function's own volumes.
A Function reaches KV, its Buckets and its SQL databases through its local API. When the operator turns on funcd's S3
gateway, S3 clients, including a Function, reach a Bucket through it, and a Lake's engine reads and writes its files
through it. A Lake answers queries through its Lake gateway. The worker mounts its volumes. funcd also keeps the Secrets
that a Function, a Workflow step or a Lake reads, in the metastore. Events are the last service: an EventSource emits
them on a timer, on a new object in a Bucket or on a row change in a SQL table, and a Sensor calls a Function or starts
a WorkflowRun for each one.

Each store runs on an engine. KV runs in memory by default, or on Badger when the operator chooses the durable engine. A
Bucket keeps its objects in files or in S3. A SQL database runs on rqlite, which keeps its data in SQLite. A Lake runs
on DuckDB with DuckLake, and keeps its files under a prefix of a Bucket. A volume is a directory of a fixed size on the
local disk.

An admin can also register add-ons, engines built outside funcd such as an OpenID Connect provider: funcd runs one
engine per object of an add-on's kind, and a Function reaches it through funcd only.

Each service has its own page: [KV](/docs/platform/services/kv.md), [Bucket](/docs/platform/services/bucket.md), [SQL](/docs/platform/services/sql.md), [Lake](/docs/platform/services/lake.md),
[Add-ons](/docs/platform/services/addons.md), [Secrets](/docs/platform/services/secrets.md) and [Events](/docs/platform/services/events.md).

## On disk [#on-disk]

funcd keeps its stores under one directory, `storage.dataDir`:

<Files>
  <Folder name="<dataDir>" defaultOpen>
    <Folder name="store — the metastore" disabled />
    <Folder name="eventstore — the event store" disabled />
    <Folder name="workflow — the Workflow run state" disabled />
    <Folder name="kv — KV's own Badger, with the durable engine" disabled />
    <Folder name="blob — Buckets as files, unless S3" disabled />
    <Folder name="providers — the SQL and Lake engines' data" disabled />
    <Folder name="nats — the internal bus" disabled />
    <Folder name="artifacts — Function bundles" disabled />
  </Folder>
</Files>
