Skip to content

9001-Solutions/study-plug-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

studyplug

TypeScript SDK for the StudyPlug API — generate educational content for K-8 math, reading, vocabulary, spelling, and science.

npm version license

Install

npm install studyplug

Quick Start

import { StudyPlug } from "studyplug";

const sp = new StudyPlug({ apiKey: "sp_live_..." });

// Generate 5 addition problems
const { data } = await sp.generate({ skill: "add-within-10", count: 5 });
console.log(data.items);

// Generate a single problem
const single = await sp.generate.single({ skill: "add-within-20" });
console.log(single.data.item);

Features

  • Zero dependencies — lightweight, works everywhere
  • Full TypeScript support — every response is fully typed
  • Structured errors — typed error classes with helper functions
  • Curriculum catalog — browse grades, subjects, topics, skills, and standards
  • Deterministic generation — pass a seed for reproducible content

Browse the Curriculum

// List all grades
const grades = await sp.grades.list();

// List skills for a grade/subject
const skills = await sp.skills.list({ grade: "grade-3", subject: "math" });

// Get skill details
const skill = await sp.skills.get("multiply-by-5");

// Find skills by standard
const standards = await sp.standards.list({ framework: "ccss-math" });

Error Handling

import { StudyPlug, isRateLimitError, isNotFoundError } from "studyplug";

try {
  const result = await sp.generate({ skill: "add-within-10", count: 5 });
} catch (err) {
  if (isRateLimitError(err)) {
    console.log(`Rate limited. Retry after ${err.retryAfter}s`);
  } else if (isNotFoundError(err)) {
    console.log("Skill not found");
  }
}

API Reference

Method Description
sp.generate(params) Generate a batch of content items
sp.generate.single(params) Generate a single content item
sp.grades.list() List all grades
sp.grades.get(slug) Get grade details
sp.subjects.list() List all subjects
sp.subjects.get(slug) Get subject details
sp.topics.list(params?) List topics (optionally filtered)
sp.skills.list(params?) List skills (optionally filtered)
sp.skills.get(slug) Get skill details
sp.standards.list(params?) List standards
sp.standards.get(code) Get standard details
sp.health() API health check

Configuration

const sp = new StudyPlug({
  apiKey: "sp_live_...",               // optional for anonymous tier
  baseUrl: "https://api.studyplug.org", // default
  timeout: 10000,                       // ms, default 30000
});

See It in Action

StudyPlug.org — free K-5 printable worksheets for math, reading, vocabulary, spelling, and science. Every worksheet is generated by the same API this SDK connects to.

Links

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors