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

@kafitra/lynx-storage

v0.1.0

Published

Lynx Native Module for persistent key-value storage (Android SharedPreferences + iOS NSUserDefaults)

Downloads

95

Readme

@kafitra/lynx-storage

Persistent key-value storage native module for Lynx.

Backed by Android SharedPreferences and iOS NSUserDefaults — data survives app restarts.

npm Platform License: MIT


Overview

@kafitra/lynx-storage exposes a synchronous native key-value store to the Lynx JS runtime via NativeModules.LynxStorage. It is the persistence layer used by @kafitra/lynx-async-storage when running inside a Lynx app.

| Platform | Implementation | Storage file / suite | | -------- | ------------------- | ------------------------- | | Android | SharedPreferences | kafitra_lynx_storage | | iOS | NSUserDefaults | com.kafitra.lynxstorage |


Installation

npm install @kafitra/lynx-storage
# or
pnpm add @kafitra/lynx-storage

Android Setup

1. Auto-link (recommended)

Run the Kafitra CLI linker from your app directory:

npx @kafitra/lynx-cli link

This auto-generates LynxAutolinkRegistry.java and injects Gradle wiring.

2. Register in your Application class

// LynxApplication.java (or wherever you init LynxEnv)
import com.kafitra.demo.LynxAutolinkRegistry;

LynxEnv.inst().init(this, null, null, null);
LynxAutolinkRegistry.registerAll(); // ← registers LynxStorageModule

3. Manual setup (without CLI)

If you prefer not to use the CLI, add these entries manually:

android/settings.gradle

include ':lynx-storage'
project(':lynx-storage').projectDir = new File(rootDir, '../node_modules/@kafitra/lynx-storage/android')

android/app/build.gradle

dependencies {
    implementation project(':lynx-storage')
}

LynxAutolinkRegistry.java (or your Application init)

import com.kafitra.lynxstorage.LynxStorageModule;

LynxEnv.inst().registerModule("LynxStorage", LynxStorageModule.class);

iOS Setup

Register in your host app

// In your LynxInitProcessor or AppDelegate, before creating any Lynx view:
#import "LynxStorageModule.h"

[globalConfig registerModule:LynxStorageModule.class];

JavaScript API

The module is exposed on the Lynx NativeModules global as NativeModules.LynxStorage:

declare const NativeModules: {
  LynxStorage: {
    getString(key: string): string | null;
    setString(key: string, value: string): void;
    remove(key: string): void;
    clear(): void;
    getAllKeys(): string; // JSON array string, e.g. '["a","b"]'
  };
};

Direct usage (TypeScript)

import { LynxStorage } from "@kafitra/lynx-storage";

// Read
const value = LynxStorage.getString("token"); // string | null

// Write
LynxStorage.setString("token", "abc123");

// Delete
LynxStorage.remove("token");

// Clear everything
LynxStorage.clear();

// Get all keys
const keys = JSON.parse(LynxStorage.getAllKeys()); // string[]

Tip: All methods are synchronous. If you prefer a Promise-based API, use @kafitra/lynx-async-storage — it auto-detects and wraps this module.


With @kafitra/lynx-async-storage

Install both packages in your app:

pnpm add @kafitra/lynx-storage @kafitra/lynx-async-storage

Then use @kafitra/lynx-async-storage in your code — it will automatically use LynxStorage as its backend:

import AsyncStorage from "@kafitra/lynx-async-storage";

await AsyncStorage.setItem("session", JSON.stringify({ user: "demo" }));
const session = await AsyncStorage.getItem("session");

No extra configuration needed. @kafitra/lynx-async-storage detects NativeModules.LynxStorage at runtime and uses it automatically.


lynx.module.json

This file is used by @kafitra/lynx-autolink for auto-linking:

{
  "name": "LynxStorage",
  "android": {
    "moduleClass": "com.kafitra.lynxstorage.LynxStorageModule",
    "sourceDir": "android"
  }
}

Monorepo / Workspace

If you're using this in a monorepo with pnpm workspaces:

{
  "dependencies": {
    "@kafitra/lynx-storage": "workspace:*"
  }
}

License

MIT © Kafitra Marna