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

taleem-syllabusbuilder

v1.0.0

Published

This object is to provide a nested syllabus for taleem.help

Readme

taleem-syllabusbuilder

A tiny, stable per-tcode syllabus compiler for Taleem.Help–style apps. Author your course tree in code (Chapters → Exercises → Items) and compile to a clean JSON that frontends can render directly.

  • Object-only API (no positional args)
  • Single export: SyllabusBuilder (plus zodSyllabusV1 for validation)
  • No Taleem-specific sugar — keep your helpers in your app
  • Future-proof: type is just a string ("slide", "note", "deck", …)

Install

npm i taleem-syllabusbuilder

Requires Node 18+ (ESM). Package is "type": "module".


Quick start (60 seconds)

import { SyllabusBuilder, zodSyllabusV1 } from 'taleem-syllabusbuilder';

// 1) One builder per tcode
const sb = new SyllabusBuilder('fbise9mathold', {
  description: 'Math Class 9 Old Course',
  image: '/bookcovers/math_9thFBSIE.png'
});

// 2) Chapter → Exercise → Items
const ch10 = sb.addChapter({ name: 'Ch-10', filename: 'Ch-10 Congruent Triangles' });
const ex10 = ch10.addExercise({ name: 'Theorems', filename: 'theorems' });

// content types are just strings
ex10.addItem({
  name: 'Congruent Triangles',
  filename: 'congruent_triangles',
  type: 'slide',
  thumbnail: '/images/congruent_triangle.webp',
  tags: []
});

// 3) Build JSON and (optionally) validate
const syllabus = sb.build();
zodSyllabusV1.parse(syllabus); // throws if invalid

console.log(JSON.stringify(syllabus, null, 2));

Why this exists

  • Filename = Identity = Anchor. Every leaf is addressed by a filename.
  • Runtime simplicity. Frontends load prebuilt JSON; no DB required.
  • Decoupled growth. Add new content types without changing the compiler.

API

new SyllabusBuilder(code, { description, image? })

Creates a per-tcode builder.

  • code (string, required): e.g., "fbise9mathold".
  • description (string, required).
  • image (string, optional).

builder.addChapter({ name, filename, description?, image? }) → Chapter

Adds a chapter node. Returns a Chapter object.

chapter.addExercise({ name, filename, description?, image? }) → Exercise

Adds an exercise node. Returns an Exercise object.

exercise.addItem({ name, filename, type='slide', thumbnail=null, tags=[], description?, image? })

Adds a leaf “question”/item.

  • type is a string. Common values: "slide", "note", "deck", "exam", "link".
  • The library does not restrict type; enforce rules in your app (Zod, enums, etc).

builder.build() → TcodeJSON

Compiles the tree into JSON for a single tcode.


Output JSON (v1)

{
  "tcodeName": "fbise9mathold",
  "description": "Math Class 9 Old Course",
  "image": "/bookcovers/math_9thFBSIE.png",
  "chapters": [
    {
      "name": "Ch-10",
      "filename": "Ch-10 Congruent Triangles",
      "description": "...",         // optional
      "image": "/covers/ch10.png",  // optional
      "exercises": [
        {
          "name": "Theorems",
          "filename": "theorems",
          "description": "...",     // optional
          "image": "/covers/ex.png",// optional
          "questions": [
            {
              "name": "Congruent Triangles",
              "filename": "congruent_triangles",
              "type": "slide",
              "thumbnail": "/images/congruent_triangle.webp",
              "tags": [],
              "description": "...", // optional
              "image": "/img.png"   // optional
            }
          ]
        }
      ]
    }
  ]
}

Validation

The package exports a Zod schema you can run in CI or build scripts.

import { zodSyllabusV1 } from 'taleem-syllabusbuilder';

zodSyllabusV1.parse(syllabus); // throws on first error

Validation guarantees:

  • Required string fields are present (tcodeName, description, etc).
  • Arrays (chapters, exercises, questions) are well-formed.
  • type is a non-empty string (you can restrict allowed values in your app).

Typical project layout (suggestion)

/syllabus/                # your authoring files (per tcode)
  fbise9mathold.js
  syllabus.js             # imports each tcode, builds them
/scripts/
  genSyllabus.js          # writes: data/syllabus/<tcode>.json + subjects.json
/static/data/syllabus/
  fbise9mathold.json
  subjects.json

Your syllabusService (frontend) can then fetch:

  • /data/syllabus/<tcode>.json for a subject
  • /data/syllabus/subjects.json for the index

FAQ

Q: Where are helpers like addNote or addDeck? Keep them in your app as thin wrappers around addItem({ ... }). The core stays generic.

Q: Can I add new fields later? Yes. Add optional fields to your app and pass them through addItem. If you need required structure changes, that’s a v2.

Q: Multi-tcode builds? Run one SyllabusBuilder per tcode, then write each JSON to disk (plus a subjects.json index).


Versioning

  • v1 is frozen alongside your deck schema; additive, optional fields only.
  • Structural changes (e.g., new hierarchy depth) will ship as v2 with a new schema.

License

ISC © Bilal Tariq


Changelog

  • 1.0.0 — Initial release. Object-only API; exports SyllabusBuilder + zodSyllabusV1.