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

microgpt.ts

v0.5.0

Published

A conversion of Karpathy's MicroGPT to Typescript

Readme

microgpt.ts

A conversion of Karpathy's MicroGPT to Typescript

Andrej Karpathy gave us MicroGPT (blog, gist), a self contained, impressively minimalist implementation of a GPT.

Not everybody has Python as a preferred language, so, I decided to convert it to Typescript.

As I understand it, Karpathy's purpose was to help make this easier to learn. I'm just trying to bring his work to a wider reading audience.

 

How to read this

There are two ways to read this.

  1. You could do this Karpathy-style. There is a single-file TS GPT in this repository.
  2. You could do this community-style. There is a modular GPT in this repository too.

Or you could

 

What's the difference?

It's around 450 lines of code. Chewing that down in one piece really suits a lot of people. Other people don't want to think about, say, the random number generator while they're trying to learn Adam, or whatever.

The community style just takes the code and breaks it up into a couple of files - one for the tokenizer, one for the randomizer, one for autograd, et cetera - then adds docblock comments and tests. Community style also adds a single function called test to index, which shows a person how these library calls are made.

 

How to use this

Well, generally use a production GPT. This is correct, but it doesn't do any of the fancy stuff that gives you real speed. However, for learning purposes, we've included a web GUI that does this live. There's a copy of Karpathy's "tiny shakespeare" to train on in src/html.

Alternately, you can download it and run it locally. If you do, please use npm run local to start a local webserver, then hit the page at https://localhost:4400/usage.html, instead of loading locally from a file url; file:// has CORS consequences, and you won't be able to upload your text trainer.

 

How to contribute

Patches, features, and bugfixes are accepted graciously. It's easier to accept a PR that has a description, so I know what it does. Please fork the repo and send a PR back from your fork.