npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

xdg-effect

v1.0.1

Published

Opinionated Effect library for XDG Base Directory support — composable layers from path resolution through config management to SQLite-backed caching and state.

Downloads

365

Readme

xdg-effect

npm version License: MIT TypeScript 6.0 Effect

Opinionated Effect library for XDG Base Directory support — from environment variable resolution through config file management to SQLite-backed caching and persistent state.

Three-Package Ecosystem

xdg-effect is the composition layer in a three-package ecosystem:

| Package | Purpose | | ------- | ------- | | xdg-effect | XDG path resolution, app directories, SQLite cache/state, XDG-aware config bridges | | config-file-effect | Config file loading with pluggable codecs, resolvers, strategies, encryption, migrations, watching | | json-schema-effect | JSON Schema generation, validation, scaffolding, and TOML tooling annotations |

xdg-effect re-exports common items from both sibling packages, so you can import everything from a single entry point or from each package individually.

Quick Example

import { NodeFileSystem } from "@effect/platform-node";
import { Effect, Schema } from "effect";
import { ConfigFile, XdgConfigLive } from "xdg-effect";

const MyConfig = Schema.Struct({
  name: Schema.String,
  port: Schema.Number,
  debug: Schema.optional(Schema.Boolean, { default: () => false }),
});
type MyConfig = typeof MyConfig.Type;

const MyConfigFile = ConfigFile.Tag<MyConfig>("my-tool/Config");

// Preset: TOML codec, UpwardWalk + XdgConfigResolver, FirstMatch strategy
const layer = XdgConfigLive.toml({
  namespace: "my-tool",
  filename: "config.toml",
  tag: MyConfigFile,
  schema: MyConfig,
});

const program = Effect.gen(function* () {
  const config = yield* MyConfigFile;
  const value = yield* config.load;
  console.log(value);
});

Effect.runPromise(
  program.pipe(Effect.provide(layer), Effect.provide(NodeFileSystem.layer)),
);

Install

npm install xdg-effect config-file-effect effect @effect/platform @effect/platform-node

For JSON Schema generation (editor autocompletion, SchemaStore publishing):

npm install json-schema-effect

For SQLite-backed cache and state:

npm install @effect/sql @effect/sql-sqlite-node

Progressive Adoption

| Layer | Provides | Requires | Use when | | ----- | -------- | -------- | -------- | | XdgResolver.Live | XdgResolver | (none) | You only need raw XDG env vars | | XdgLive(config) | XdgResolver, AppDirs | FileSystem | You need app-namespaced directories | | XdgConfigLive(options) | XdgResolver, AppDirs, ConfigFileService | FileSystem | You need config file loading | | XdgConfigLive.toml(preset) | Same as above | FileSystem | Common case with less boilerplate | | XdgFullLive(options) | All above + SqliteCache, SqliteState | FileSystem, SqlClient | You need the full stack | | SqliteCache.XdgLive() | SqliteCache | AppDirs | Cache with XDG-managed database path | | SqliteState.XdgLive(options) | SqliteState | AppDirs | State with XDG-managed database path |

Features

XDG Services (this package)

  • XdgResolver — Read XDG environment variables through Effect's Config module
  • AppDirs — Resolve app-namespaced directories with 4-level precedence
  • XdgConfigResolver — Resolver that finds config files in XDG directories
  • XdgSavePath — Helper for saving config files to XDG paths
  • SqliteCache — Key/value cache with TTL, tag-based invalidation, PubSub events
  • SqliteState — Managed SQLite with migration tracking

Config File Loading (via config-file-effect)

  • ConfigFile — Pluggable config loading with codecs, resolvers, and strategies
  • Codecs — JSON, TOML, and AES-GCM encrypted
  • Resolvers — ExplicitPath, StaticDir, UpwardWalk, WorkspaceRoot, GitRoot
  • Strategies — FirstMatch, LayeredMerge
  • Events — PubSub observability for config operations
  • Migrations — Versioned schema transforms for config files
  • Watcher — File change detection with polling

JSON Schema Tooling (via json-schema-effect)

  • JsonSchemaExporter — Generate JSON Schema from Effect Schema
  • JsonSchemaValidator — Validate with Ajv (strict and Tombi convention modes)
  • JsonSchemaScaffolder — Generate starter config files from schemas
  • Helperstombi() and taplo() annotation builders for TOML tooling

Documentation

  1. Getting Started
  2. Resolving XDG Paths
  3. XDG Config Files
  4. SQLite Cache
  5. SQLite State
  6. Building a CLI
  7. Testing
  8. Error Handling
  9. API Reference

License

MIT