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

@elek-io/core

v0.17.0

Published

Handles core functionality of elek.io Projects like file IO and version control.

Readme

@elek-io/core

codecov

Handles core functionality of elek.io Projects like file IO and version control as well as providing schemas, types and a local REST API.

Installation

npm install @elek-io/core

Exports

The package provides multiple entry points for different environments:

  • Node (@elek-io/core) — The ElekIoCore main class with full access to services, API, schemas and utilities.
  • Browser (@elek-io/core) — All schemas and types but without the ElekIoCore class, since it is not usable in a browser environment.
  • Astro (@elek-io/core/astro) — Astro content loaders elekAssets() and elekEntries() for loading Project data into Astro.
  • CLI (elek) — A command-line interface with commands for generating API clients, starting a local API and exporting Projects.

Source structure

|-- src
|   |-- api
|   |   Local REST API built on Hono with OpenAPI documentation.
|   |   Provides routes for Projects, Collections, Entries and Assets.
|   |-- astro
|   |   Astro integration with content loaders and dynamic schema building
|   |   based on Collection Field definitions.
|   |-- cli
|   |   Command-line interface with commands:
|   |   generate:client, api:start and export.
|   |-- error
|   |   Different classes extending Error.
|   |-- schema
|   |   Zod schemas for validation and types.
|   |-- service
|   |   Contains CRUD logic that does file-io as well as utility functions.
|   |   The methods are mostly used as endpoints
|   |   so their input is validated against our zod schemas.
|   |   |-- migrations
|   |   |   Version-aware schema migrations for Projects, Assets,
|   |   |   Collections and Entries.
|   |-- test
|   |   Additional files and utility functions only used for testing.
|   |-- util
|   |   Utility functions like path generation.
|   |-- index.browser.ts
|   |   Exports all schemas and types as well as the ElekIoCore type
|   |   but does not export the ElekIoCore main class,
|   |   since it is not actually usable in a browser environment.
|   |-- index.node.ts
|   |   Exports the ElekIoCore main class which makes the services and API
|   |   endpoints accessible as well as schemas and utility functions.
|   |-- index.astro.ts
|   |   Exports the Astro content loaders for Assets and Entries.
|   |-- index.cli.ts
|   |   Entry point for the CLI binary.

The concept behind Projects, Collections, Entries, Values, Assets and Releases

|-- Project - e.g. "Website"
|   |-- Collection - e.g. "Blog"
|   |   Contains Field definitions all Entries and Values of the Collection must follow.
|   |   |-- Entry - e.g "Post"
|   |   |   |-- Value - e.g for a post's title: "Quarterly results 7% higher than expected"
|   |   |   |-- Asset - a reference to a previously added Asset like image, PDF or ZIP
|   |   |   |-- Entry - a reference to another Entry e.g. to show the user related posts
|   |-- Release - e.g. "v1.0.0" - a tagged snapshot of the Project at a specific point in time

Projects

Are a container for Collections, Entries, Values and Assets. Think of a folder containing all the relevant files. Projects are version controlled with git, so you can roll back to previous versions of files at any time.

Collections

Contains Field definitions (a schema) for possible Values each Entry can or has to have. e.g. for a Blog, it could have the following Field definition for each post / Entry:

  • an image that is displayed on top of the post (Asset reference)
  • a title to catch users attention (Value)
  • content that contains multiple headlines and paragraphs (Value)
  • an author that wrote the post (Entry reference)

Each definition like the title, contains additional information for the input Field, that is used to modify it's Value. e.g. the title would be a simple one line input Field, that has a maximum length of 150 characters and is required for each post. But the content is a markdown editor to easily add formatting. The image let's the user select a jpeg or png from disk. And the author is a reference to another Collection's Entry, so the user is able to choose one of them.

Entries

Contains Values and references that follow the Collection's Field definitions. Why references and not the Assets or Entries themself? To make Values reusable for different Entries and even Collections - so when you update an Asset or Entry, it updates everywhere you've referenced it.

Values

Represent either a single piece of data like the string "How to be successful in 3 easy steps", a number or a boolean - or a reference to Assets or other Entries.

Assets

Are files / blobs like images (png, jpeg etc.), documents (excel sheets etc.), music or a compressed folder. Assets have two files inside the Project's repository - the actual file and additionally a file containing meta information like the size.

Releases

Are tagged snapshots of a Project at a specific point in time, managed through git tags. They allow you to mark stable versions of your content that can be deployed or exported.

CLI

The package includes a CLI accessible via the elek command:

  • elek generate:client — Generate a JavaScript/TypeScript API client (ESM or CJS)
  • elek api:start — Start a local REST API server (default port 31310)
  • elek export — Export Projects to JSON (nested or as separate files)

Documentation

The docs/ folder contains additional in-depth documentation on specific topics like the migration and history reading flow.

Development

pnpm install       # Install dependencies
pnpm dev           # Run tests in watch mode
pnpm test          # Run tests once
pnpm coverage      # Run tests with coverage
pnpm build         # Build all entry points
pnpm lint          # Lint
pnpm check-types   # Type check
pnpm check-format  # Check formatting
pnpm format        # Format code