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

explainit

v1.0.4

Published

🧠 AI-powered CLI that quizzes you on your code before you commit

Downloads

38

Readme

npm version npm downloads license node stars


🎯 the problem

# you copy this from ChatGPT
function generateToken(user, secret, expiresIn) {
  return jwt.sign({ id: user.id, email: user.email }, secret, { expiresIn })
}

# it works. you commit it.
git commit -m "add auth"

# 6 months later β€” production is down.
# nobody can explain what expiresIn does.
# including you.

explainit fixes this.


✨ how it works

git add .
git commit -m "add auth"
🧠 explainit β€” quick check before commit
──────────────────────────────────────────
  lib/auth.js β€” 18 lines changed

  What does the expiresIn parameter control in generateToken?

  Your answer: it sets how long the JWT token stays valid

  βœ“ Exactly right β€” expiresIn defines the token lifetime in seconds.
    A high value means stolen tokens stay valid longer.

[main 3f2a1] add auth

One question. Fifteen seconds. You just learned something about the code you're shipping.


πŸš€ install

npm install -g explainit

requires Node.js 18+


⚑ quick start β€” 4 steps, under 2 minutes

step 1 β€” install

npm install -g explainit

step 2 β€” get a free Gemini API key

aistudio.google.com/apikey β†’ sign in with Google β†’ Create API key in new project β†’ copy it

completely free Β· no credit card required Β· 1,500 requests/day per user

step 3 β€” connect your key

explainit setup
β–Έ setup β€” gemini api key
  ────────────────────────────────────────────
  get your free key at:
  β†’ https://aistudio.google.com/apikey

  steps:
    1. sign in with google
    2. click 'create api key in new project'
    3. copy and paste below

  β—† paste your gemini key: β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ

  βœ“ api key saved!
  you're all set β€” run explainit install to hook into git

step 4 β€” hook into git

explainit install
β–Έ installing git hook
  ────────────────────────────────────────────
  βœ“ git hook installed
  βœ“ run-quiz.js created

  β—† every git commit will now trigger a quiz automatically

you're done. every git commit from now on will trigger a quiz automatically.


πŸ”„ full workflow

npm i -g explainit
        ↓
explainit setup      ← paste your free Gemini API key
        ↓
explainit install    ← hooks into your git repo
        ↓
git add .
        ↓
git commit -m "your message"
        ↓
explainit detects changed files
        ↓
skips small changes ──→ commit goes through silently βœ“
        ↓
Gemini reads your code
        ↓
1 question appears in terminal
        ↓
you type your answer
        ↓
instant AI feedback
        ↓
commit goes through regardless βœ“

explainit never blocks your commit. it only teaches. adoption comes from being useful, not forceful.


πŸ“¦ commands

| command | description | |---|---| | explainit setup | connect your free Gemini API key | | explainit install | hook into git (run once per project) | | explainit scan <file> | preview a file and its contents | | explainit quiz <file> | manually quiz yourself on any file | | explainit score | view your progress, history and streak |


πŸ“Š track your progress

explainit score
  total quizzes  12     correct  9      wrong  3

  score  75%   streak  4 days

  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘  75%

β–Έ recent activity
  ─────────────────────────────────────────────────────────
  βœ“  auth.js         27 Mar, 14:32    What does bcrypt.compare do?
  βœ“  quiz.js         27 Mar, 12:10    Why is snippet sliced to 300...
  βœ—  scores.js       26 Mar, 09:44    What does getStreak return?
  βœ“  ai.js           25 Mar, 18:21    Why is code sliced to 300 chars?

β–Έ most quizzed files
  ─────────────────────────────────────────────────────────
  β—†  auth.js                   5 quizzes      80% correct
  β—†  quiz.js                   4 quizzes      75% correct
  β—†  ai.js                     3 quizzes      66% correct

πŸ”‘ api key β€” per user, always free

explainit uses a bring your own key model.

each user provides their own free Gemini API key. this means:

  • βœ“ no shared quota β€” your usage never affects anyone else
  • βœ“ completely free β€” 1,500 requests/day is more than enough
  • βœ“ scales to any number of users
  • βœ“ your key is stored locally at ~/.explainit/config.json
  • βœ“ nothing leaves your machine except API calls to Gemini

get your free key at aistudio.google.com/apikey


πŸ—οΈ architecture

explainit/
β”œβ”€β”€ bin/
β”‚   └── explainit.js      ← CLI entry point β€” all commands
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ ai.js             ← Gemini API β€” generate & evaluate
β”‚   β”œβ”€β”€ quiz.js           ← quiz loop β€” questions & answers
β”‚   └── scores.js         ← local score storage & streak logic
β”œβ”€β”€ run-quiz.js           ← git hook bridge (auto-created on install)
└── package.json

πŸ› οΈ tech stack

| tool | purpose | |---|---| | Node.js | runtime | | Commander.js | CLI framework | | Gemini API | AI question generation & evaluation | | Chalk | terminal colours & styling | | Ora | terminal spinner |


🀝 contributing

contributions, issues and feature requests are welcome!

# clone the repo
git clone https://github.com/shekharrs/explainit.git
cd explainit

# install dependencies
npm install

# link locally for development
npm link

# test your changes
explainit setup
explainit install
explainit scan bin/explainit.js
explainit score

to contribute:

  1. fork the project
  2. create your branch Β Β git checkout -b feature/amazing-feature
  3. commit your changes Β git commit -m "add amazing feature"
  4. push to the branch Β Β Β git push origin feature/amazing-feature
  5. open a pull request

πŸ“‹ roadmap

  • [x] auto-quiz on git commit via pre-commit hook
  • [x] AI question generation with Gemini
  • [x] answer evaluation with instant feedback
  • [x] local score tracking and streak system
  • [x] per-user API key β€” bring your own key model
  • [x] first-time setup wizard
  • [ ] VS Code extension
  • [ ] support for more languages (Go, Rust, Java)
  • [ ] team leaderboard mode
  • [ ] weekly email digest of your weakest files
  • [ ] --strict mode that requires 70%+ to commit

πŸ› issues & support

found a bug? have a feature idea?

β†’ open an issue


πŸ“„ license

MIT Β© Shekhar


built for developers who actually want to understand their code

if explainit helped you β€” drop a ⭐ on the repo. it means a lot.

github npm