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

@texti/sdk

v1.0.4

Published

In-context translation editor SDK for Texti

Readme

Texti SDK

In-context translation editor for your applications.

Edit translations directly in your application - no need to switch between your app and a translation dashboard. Click on any text, edit it, and see changes immediately.

Features

  • In-context editing - Click on text to edit translations
  • Multi-language support - Edit all languages in one place
  • Real-time sync - Changes appear immediately
  • Framework agnostic - Works with any JavaScript framework
  • TypeScript support - Full type definitions included

Installation

Using npm

npm install @texti/sdk

Using yarn

yarn add @texti/sdk

Quick Start

1. Initialize the SDK

import TextiSDK from "@texti/sdk";

const texti = new TextiSDK({
  apiUrl: "https://texti.ee/api",
  projectId: "your-project-id",
  apiKey: "your-api-key",
  enableVisualEditor: true,
  debug: false,
});

2. Add translation keys to your HTML

<h1 data-texti-key="home.welcome">Welcome to our app!</h1>
<p data-texti-key="home.description">This is a description</p>

3. Click and edit!

When logged in with proper permissions, click on any text to edit translations for all languages.

API Reference

Configuration

interface TextiConfig {
  apiUrl: string; // Texti API URL
  projectId: string; // Your project ID
  apiKey: string; // Your API key
  enableVisualEditor?: boolean; // Enable click-to-edit (default: true)
  autoInit?: boolean; // Auto-initialize SDK (default: true)
  debug?: boolean; // Enable debug logging (default: false)
}

Methods

t(key: string, params?: Record<string, string>): string

Get translation for a key:

const text = texti.t("home.welcome");
const greeting = texti.t("greet.user", { name: "John" }); // "Hello, {{name}}"

setLanguage(languageCode: string): void

Change the current language:

texti.setLanguage("es"); // Switch to Spanish

setEnvironment(environment: 'dev' | 'prod'): Promise<void>

Switch between development and production translations:

await texti.setEnvironment("prod");

getLanguages(): Language[]

Get all available languages:

const languages = texti.getLanguages();

getPermissions(): UserPermissions | null

Get current user's permissions:

const permissions = texti.getPermissions();
if (permissions?.canEdit) {
  console.log("User can edit translations");
}

Usage Examples

Vanilla JavaScript

<!DOCTYPE html>
<html>
  <head>
    <title>My App</title>
  </head>
  <body>
    <h1 data-texti-key="app.title">Loading...</h1>
    <p data-texti-key="app.description">Loading...</p>

    <script src="https://cdn.jsdelivr.net/npm/@texti/sdk/dist/index.umd.js"></script>
    <script>
      const texti = new TextiSDK({
        apiUrl: "https://texti.ee/api",
        projectId: "your-project-id",
        apiKey: "your-api-key",
      });

      // Wait for SDK to initialize
      texti.init().then(() => {
        console.log("Texti SDK initialized!");
      });
    </script>
  </body>
</html>

React

import { useEffect, useState } from "react";
import TextiSDK from "@texti/sdk";

const texti = new TextiSDK({
  apiUrl: "https://texti.ee/api",
  projectId: "your-project-id",
  apiKey: "your-api-key",
});

function App() {
  const [initialized, setInitialized] = useState(false);

  useEffect(() => {
    texti.init().then(() => setInitialized(true));
  }, []);

  if (!initialized) return <div>Loading translations...</div>;

  return (
    <div>
      <h1 data-texti-key="app.title">{texti.t("app.title")}</h1>
      <p data-texti-key="app.description">{texti.t("app.description")}</p>
    </div>
  );
}

Vue

<template>
  <div>
    <h1 data-texti-key="app.title">{{ t("app.title") }}</h1>
    <p data-texti-key="app.description">{{ t("app.description") }}</p>
  </div>
</template>

<script setup>
import { onMounted, ref } from "vue";
import TextiSDK from "@texti/sdk";

const texti = new TextiSDK({
  apiUrl: "https://texti.ee/api",
  projectId: "your-project-id",
  apiKey: "your-api-key",
});

const t = (key) => texti.t(key);

onMounted(async () => {
  await texti.init();
});
</script>

Angular

import { Component, OnInit } from "@angular/core";
import TextiSDK from "@texti/sdk";

@Component({
  selector: "app-root",
  template: `
    <div>
      <h1 data-texti-key="app.title">{{ t("app.title") }}</h1>
      <p data-texti-key="app.description">{{ t("app.description") }}</p>
    </div>
  `,
})
export class AppComponent implements OnInit {
  private texti: TextiSDK;

  constructor() {
    this.texti = new TextiSDK({
      apiUrl: "https://texti.ee/api",
      projectId: "your-project-id",
      apiKey: "your-api-key",
    });
  }

  async ngOnInit() {
    await this.texti.init();
  }

  t(key: string): string {
    return this.texti.t(key);
  }
}

Getting API Keys

To use the SDK, you need an API key from your Texti dashboard:

  1. Login to your Texti dashboard
  2. Navigate to SettingsAPI Keys
  3. Click "Generate API Key"
  4. Enter a descriptive name (e.g., "Production Server")
  5. Click "Generate"
  6. Copy the API key (shown only once!)
  7. Store it securely (e.g., environment variables)

Important: API keys are displayed only once for security. Make sure to copy and store them securely before closing the dialog.

Security

  • Always use HTTPS in production
  • Keep your API keys secure (use environment variables)
  • Never commit API keys to version control
  • Use environment-specific API keys (dev vs prod)
  • Set proper user permissions in Texti dashboard
  • Rotate API keys periodically
  • Delete unused API keys from the dashboard

License

MIT