# Adding a service

> Two data edits and no code — a service file in your stack manifest, and the forms that should carry it.

Adding a service to a stack of your own requires no lemonfiber change and no
lemonfiber release. It is two data edits in its stack directory.

1. A `services/<id>.toml` file holding its `[[service]]` entry, named in the
   `include` list of `stack.toml`.
2. Its profile added to whichever forms should carry it.

Then point lemonfiber at the directory with
[`--stack-dir`](/commands/global-flags/). The stack lemonfiber ships has no such
directory: it is assembled from the bundle in `lemonfiber-plugins`, and a service
enters it as a first-party plugin that bundle pins.

This page is about changing the stack itself. To run one more service beside the
bundled stack without keeping a stack of your own, install it as a
[plugin](/plugins/) instead: lemonfiber writes its container and wiring from a
manifest, and takes it out again as one operation.

## Where its Compose entry comes from

Nobody writes one. lemonfiber generates the stack's whole Compose project from the
declarations of every service, the stack's and every installed plugin's: there is
no fragment, no shared template and no overlay to edit. The image, the profile, the
published port and its bind, the health check and the mounts all come from the
service file below.

## The one rule

**Every service that touches the library has exactly one data mount, at `/data`.**
Downloads and media live as subdirectories beneath it, on one filesystem, so an
import hardlinks instead of copying. A service says it takes data with
`takes_data = true`, and lemonfiber writes that one mount from the operator's
`DATA_ROOT` setting, the same for every service; there is no second mount to
declare. What that looks like from the operator's side is
[hardlinks and one mount point](/fixing/hardlinks-and-one-mount-point/).

## The manifest entry

The `[[service]]` entry is where lemonfiber learns what the service is. Each one
lives in a file of its own under `services/`, and the root's `include` list
decides which of them the stack holds, in that order. Every required field is
listed in [the stack manifest contract](https://lemonfiber.app/spec/20-architecture/contracts/stack-manifest/#service);
the ones people forget are `describes` and `without_it`, which are what let a
failure be judged rather than merely reported, and `last_release`, which is the
latest release upstream has published rather than the one you pinned.

`id` is the name the generated Compose entry takes, and `profile` must be exactly
one declared profile. `image` carries neither a tag nor a digest: `tag` holds an
explicit tag, because a floating one fails validation and nothing in this stack
should change because time passed, and `digest` holds the multi-architecture
index the tag named, which is what Compose runs.

This is a Sonarr file from the stack directory lemonfiber's own tests read:

## What is checked

lemonfiber checks the whole manifest of a stack directory when it loads it, and
[the stack manifest](/advanced/the-stack-manifest/#when-lemonfiber-refuses-a-stack)
is what to do when it refuses one. A service in the bundled stack is checked
before it ships, by the `lemonfiber-plugins` repository's CI against every plugin
the bundle pins;
[its development guide](https://github.com/lemonfiber/lemonfiber-plugins/blob/main/docs/development.md#what-the-bundle-job-refuses)
lists what that refuses.

## Whether it belongs in the bundled stack

Your own stack is yours. For the bundled one, a service enters only if it is open
source under an OSI-approved licence, publishes native `linux/arm64` and
`linux/amd64` images, is actively maintained, does something no included service
already does, and works without a paid tier. An image lemonfiber builds from its
own code carries lemonfiber's own licence, `Hippocratic-3.0`, instead.

Maintenance status is established from a project's commit and release history,
never from its own description of itself. A fork advertising itself as
an actively maintained successor, with no releases and no published image, is a
dead fork — and a dead fork is worse than a slow-moving project that works.

Stating the criteria is what makes "why is X not included?" answerable, and makes
an addition a judgement against a standard rather than a matter of taste.

## What lemonfiber does with a service it does not know

It keeps working, generically. Lifecycle and status operations run on a service
lemonfiber has never heard of, and it is shown with an unknown description rather
than hidden. Features that need specific knowledge — wiring it to the other
services, reading its queue health — report as unsupported **for that service**
rather than failing the whole command.

The same applies in reverse. Remove a service lemonfiber depends on and it
reports which features become unavailable; it does not refuse to run.

## Where to go next

[The stack manifest contract](https://lemonfiber.app/spec/20-architecture/contracts/stack-manifest/) is the field-by-field
reference, and [the stack manifest](/advanced/the-stack-manifest/) is what to do
when lemonfiber refuses one. [Running without lemonfiber](/advanced/without-lemonfiber/) is the
compose project on its own, and
[the `lemonfiber-plugins` repository](https://lemonfiber.app/spec/30-repos/lemonfiber-plugins/) is where the
bundled stack is pinned. The specification for this is
[F3 stack manifests](https://lemonfiber.app/spec/10-functional/features/f-extensibility/f3-stack-manifests/).
