# Filesystem (/docs/api-reference/fs)



The `@vlandoss/env/fs` entrypoint is the file-system adapter. It auto-discovers per-environment config files on disk so you don't have to wire imports by hand.

Works on any runtime that exposes a Node-compatible filesystem: **Node ≥22.12** (≥22.18 for `.ts`/`.mts`/`.cts` configs), **Bun**, and **Deno** (via its Node-compat layer). It does **not** work on Workers, Edge, or any environment without a filesystem — those should resolve config at build time (see [`@vlandoss/env/vite`](/docs/api-reference/vite)) or pass it explicitly to `defineEnv`.

## Exports [#exports]

| Export       | Kind     | Summary                                                                                                                                                                                                                                                                                                                           |
| ------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `loadConfig` | Function | **Synchronously** discover and load `[src/]config/<envName>.{ts,mts,cts,js,mjs,cjs,json}` for the current env. Returns `Config<S>` directly (loads via `require()`), so it works in app code and in config files that tooling loads synchronously. Accepts an optional `pattern` (template) and `cwd` (override `process.cwd()`). |

<Callout type="info">
  Full signatures and option tables are coming soon. Until then, see
  [Guides → Filesystem (`loadConfig`)](/docs/guides/fs-loadconfig) for the recipe.
</Callout>

<Callout type="warn">
  `loadConfig` loads files with `require()`. Runtime requirements by extension:

  * `.ts` / `.mts` / `.cts` — needs native TypeScript stripping (native in **Bun** and **Deno**, **Node ≥22.18**).
  * `.mjs` / `.js` / `.cjs` — needs `require(esm)` (native in Bun/Deno, **Node ≥22.12**).
  * `.json` — works on any supported Node.

  Module loads are cached by the host's module system: editing a `.ts`/`.mjs`/`.cjs` config in a long-running process won't be picked up until restart. `.json` files are re-read on every call.
</Callout>

## See also [#see-also]

* [Guides → Filesystem (`loadConfig`)](/docs/guides/fs-loadconfig) — recipe and tradeoffs.
* [Concepts → Resolution order](/docs/concepts/resolution) — where loaded config sits in the merge order.
