dytext
v0.5.2
Published
Simple, powerful dynamic text management for modern web applications
Downloads
46
Maintainers
Readme
DyText
A lightweight TypeScript library for content management with dotted path access and caching. Perfect for static websites, blogs, and dynamic content applications.
Features
- 🔑 Client Token Authentication - Secure API access with client tokens
- 🎯 Dotted Path Access - Access nested data using simple dot notation (
user.profile.name) - ⚡ Built-in Caching - Configurable caching layer for improved performance
- 📦 TypeScript Support - Full TypeScript support with type definitions
- 🚀 Zero Configuration - Works out of the box with sensible defaults
- 🔧 Framework Agnostic - Use with any JavaScript framework or vanilla JS
Installation
npm install dytextQuick Start
1. Get Your Token
- Go to https://dytext.scalix.in/
- Sign up for an account
- Get your client token from the dashboard
- Create your content models
2. Install and Use
npm install dytextimport { initDytext, getDytext } from "dytext";
// Initialize with your client token
await initDytext("your_client_token_here");
// Fetch all data
const allData = await getDytext("*");
// Fetch specific model
const productCatalog = await getDytext("product_catalog");
// Fetch nested data with dotted paths
const productName = await getDytext(
"product_catalog.fields.0.field_json.value",
);3. Framework-Specific Setup
For Next.js, React, or other frameworks, the library automatically detects your environment and uses the appropriate configuration. See the documentation for framework-specific examples.
Development
Running Tests
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverageLinks
License
MIT License - see LICENSE file for details.
