The standard, open-source typing content library for building typing tests, educational apps, and games. Provides curated quotes and words in multiple languages.
We support a growing list of languages including English, Kyrgyz, Russian, Kazakh, and Uzbek. We welcome contributions for any language!
# npm
npm install typing-genius-sdk
# yarn
yarn add typing-genius-sdk
# pnpm
pnpm add typing-genius-sdkEverything is written in TypeScript and fully typed.
// Import the SDK core and a language pack
import {
getRandomQuote,
getWords,
getWordsByLength
} from 'typing-genius-sdk';
import { English } from 'typing-genius-sdk/en';Get a random quote:
const quote = getRandomQuote(English);
console.log(quote.text); // "To be or not to be..."
console.log(quote.author); // "William Shakespeare"Get multiple random quotes (with filters):
const quotes = getRandomQuotes(English, {
count: 5,
minLength: 50,
maxLength: 100
});Filter quotes by author:
import { getFilteredQuotes } from 'typing-genius-sdk';
const shakespeareQuotes = getFilteredQuotes(English, {
author: 'Shakespeare'
});By Difficulty:
available difficulties: 'easy' | 'medium' | 'hard'
const easyWords = getWords(English, 'easy');
const hardWords = getWords(English, 'hard');By Length:
// Get all 5-letter words
const fiveLetterWords = getWordsByLength(English, 5);Random Words (Smart Shuffle):
import { getRandomWords } from 'typing-genius-sdk';
const words = getRandomWords(English, 'medium', {
count: 20,
exclude: ['badword'] // Optional exclusions
});Get insights into the available content for a language.
import { getContentStats } from 'typing-genius-sdk';
const stats = getContentStats(English);
console.log(stats);
/*
{
quotes: 5021,
words: {
easy: 2672,
medium: 8691,
hard: 147026,
total: 158389
},
byLength: [
{ length: 3, count: 576 },
{ length: 4, count: 2096 },
...
]
}
*/To keep bundle sizes low, import languages dynamically:
// Load language content on demand
async function loadContent(langCode: string) {
// e.g. typing-genius-sdk/en, typing-genius-sdk/fr
const module = await import(`typing-genius-sdk/${langCode}`);
return module.default || module[Object.keys(module)[0]];
}The SDK exports all necessary TS interfaces.
import type { Quote } from 'typing-genius-sdk';
interface Quote {
text: string;
author: string;
source?: string;
length: number;
}We welcome contributions! See CONTRIBUTING.md for guidelines on adding new languages or fixing content.
MIT License - see LICENSE for details.