
# Ecoconception

Sovrium treats environmental footprint as a **first-class platform property** — not a feature, not a paid tier, not a checkbox. The platform is frugal by default, the posture is operator-controlled through environment variables, and the footprint is measurable rather than aspirational. Owning your data and minimising its environmental cost are the same fight against absentee infrastructure.

The eco posture lives in `ECO_*` environment variables — the twin of `DATABASE_URL`, `STORAGE_PROVIDER`, and `AI_PROVIDER`. It is **never** part of the app schema: a schema author must not be able to silently disable frugality for the end users of their app (ADR 013).

## Core Principles

| Principle                                      | Meaning                                                                                                                          |
| ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| **Frugal by default**                          | Every operator-facing toggle defaults to the eco-aligned setting. Operators opt _out_, never in.                                 |
| **Operator-controlled, not schema-controlled** | Eco posture is in env vars, not `app.eco.*`. Schema fields for eco are explicitly rejected.                                      |
| **Measurable, not aspirational**               | The platform commits to an `X-Eco-Index` response header and a page-weight budget; eco badges without measurement are forbidden. |

## The `ECO_*` Env-Var Contract

Frugal by default — operators opt out by overriding. These are the operator knobs for the platform's environmental posture.

| Env var                      | Default          | Options                                                           | Purpose                                                                                    |
| ---------------------------- | ---------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| `ECO_MODE`                   | `balanced`       | `balanced` \| `lenient` (legacy `on`→`balanced`, `off`→`lenient`) | Master eco-posture toggle; gates the downstream sub-knobs.                                 |
| `ECO_IMAGE_FORMAT`           | `avif`           | `avif` \| `webp` \| `jpeg` \| `png`                               | Server-side image transcoding default. AVIF is ~50% smaller than JPEG.                     |
| `ECO_PAGE_CACHE`             | `on`             | `on` \| `off`                                                     | In-memory cache of static, request-invariant page HTML — skips `renderToString` on hits.   |
| `ECO_INDEX_HEADER`           | `on`             | `on` \| `off`                                                     | Emit the `X-Eco-Index` response header graded from transfer size.                          |
| `ECO_LOW_DATA_DEFAULT`       | `off`            | `on` \| `off` \| `respect-client`                                 | End-user low-data-mode posture (down-shift assets when on / on client hint).               |
| `ECO_AI_PROVIDER_PRECEDENCE` | `local-first`    | `local-first` \| `cloud-first` \| `local-only`                    | Routing precedence for AI calls; pairs with `AI_PROVIDER`.                                 |
| `ECO_AI_MAX_CARBON_CLASS`    | `G` (permissive) | `A`–`G`                                                           | Upper bound on the carbon class of a selected AI provider/region.                          |
| `ECO_PAGE_WEIGHT_BUDGET_KB`  | `500`            | integer                                                           | Per-page transfer budget for the page-weight gate.                                         |
| `ECO_RETENTION_PURGE_DAYS`   | `365`            | integer (`0` disables)                                            | Default soft-deleted-row purge horizon for tables that opt in.                             |
| `ECO_DESIGN_LAYER`           | `on`             | `on` \| `off`                                                     | Emit the always-on default design layer (an override surface, not a load-bearing default). |

:::callout
**Operators opt out, never in.** Each `ECO_*` toggle defaults to the eco-aligned value. To relax frugality you must explicitly set the variable — mirroring how `DATABASE_URL` defaults to SQLite and `STORAGE_PROVIDER` auto-selects local storage. Eco posture is never declared in the app schema.
:::

## Already-Aligned Foundations

Several Sovrium decisions serve frugality before any `ECO_*` variable is touched:

| Decision                                    | Footprint benefit                                                                                                                |
| ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| Standalone binary distribution              | One static binary, no Node runtime, fewer dependencies at boot. See [Database Infrastructure](/en/docs/database-infrastructure). |
| SQLite + local-storage zero-config defaults | Single process, no managed cloud DB required.                                                                                    |
| SSR + islands architecture                  | Only the active island ships; heavy editors lazy-load.                                                                           |
| Programmatic CSS compiler                   | Compiled per-theme on demand, in-memory cache — no megabyte static stylesheet. See [Theme](/en/docs/theme).                      |
| Soft-delete with retention horizon          | Explicit purge-or-keep posture instead of infinite accumulation. See [Soft Delete](/en/docs/records-soft-delete).                |
| Local-first AI option                       | Local inference avoids cross-Atlantic round-trips.                                                                               |

## Low-Data Mode

`ECO_LOW_DATA_DEFAULT` controls how aggressively Sovrium down-shifts asset weight for end users. When `on`, low-data variants (lower-resolution images, simpler renders) are served by default; with `respect-client`, the posture follows the visitor's `Save-Data` / `prefers-reduced-data` client hints; `off` always serves the full variant.

Low-data mode **down-shifts gracefully** — it never refuses to render a chart or rich-text editor. Paternalistic feature-blocking is an explicit anti-pattern; eco posture lowers fidelity, it does not break a user's workflow.

## Measurement: `X-Eco-Index`

When `ECO_INDEX_HEADER=on`, page responses carry an `X-Eco-Index` header graded (A–G) from the response transfer size against tiered thresholds (the largest sitting at `ECO_PAGE_WEIGHT_BUDGET_KB`). This makes the footprint observable per response rather than a marketing claim — eco badges without a measured number are forbidden (ADR 013).

## Eco Dashboard

The admin eco dashboard surfaces the running posture: an RGESN self-evaluation tile, the AI provider mix by carbon class, the top storage consumers, and the current `ECO_*` settings in force. It reads the same measured signals (the `X-Eco-Index` grades, the page-weight budget) the platform emits — never a synthetic "Eco Mode On" badge.

## Anti-Patterns

- **Greenwashing badges** — rendering an "Eco Mode On" badge without a measured footprint number.
- **Paternalistic feature blocking** — refusing to render content because of an eco posture; always down-shift gracefully.
- **Paid eco tier** — gating eco features behind a license key. All eco posture is free in self-hosted mode.
- **Schema-level eco config** — adding `app.eco.lowDataMode = true`. Eco is operator-controlled; use env vars.
- **Hardcoded cloud AI calls** — bypassing `ECO_AI_PROVIDER_PRECEDENCE` and calling a cloud provider directly. Always route through the precedence resolver.

## Related Pages

- [Database Infrastructure](/en/docs/database-infrastructure) — `ECO_PAGE_CACHE` and the static render cache.
- [Theme](/en/docs/theme) — the programmatic CSS compiler and `ECO_DESIGN_LAYER`.
- [Soft Delete](/en/docs/records-soft-delete) — the retention horizon `ECO_RETENTION_PURGE_DAYS` governs.
- [GDPR & Privacy](/en/docs/gdpr-privacy) — data minimisation as a privacy-and-frugality twin.
- [Analytics](/en/docs/analytics) — bounded retention and cookie-free tracking.
- [Environment Variables](/en/docs/env-vars) — full env-var reference.
