Open-source project
js-primer/js-primer avatar
js-primer/js-primer

JavaScript Primer: an open source book that ships with its own test suite

:book: JavaScript Primer - 迷わないための入門書

2,418 stars230 forksJavaScriptCC-BY-4.0

At a glance

What is it?
A Japanese-language JavaScript textbook whose chapters, inline code samples and printed edition all come out of the same repository, with prose linting and DocTest as part of CI.
Who is it for?
JavaScript Primer is the rare programming book that is also a working software project, and that is exactly why it is worth reading even if you never look at the repository. The prose is linted, the code samples are executed, the book and the website share one source, and the licensing is split so that the words are reusable under CC BY 4.0 while the tooling stays MIT.
Can I use it commercially?
Yes, with credit. CC-BY-4.0 allows commercial use as long as you credit the authors and indicate what you changed. It is written for creative content, so check how it applies to any code.
Is it still maintained?
Yes. The repository last received commits 20 days ago.
What is it written in?
Mainly JavaScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 28, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The stated goal is reading modern applications, not the language spec

The README is short and unusually precise about what the book is for. It is a beginner's guide to JavaScript based on ECMAScript 2015 and later, written for people who do not yet understand modern JavaScript and want to be able to read and write modern JavaScript applications. That is a narrower goal than most JavaScript books take, and it is the one that matters, because it rules out both the historical tour and the spec-walk approaches.

The web edition is at jsprimer.net. The print edition is sold separately as a second revised edition, in both physical and Kindle form and as PDF and epub through a Japanese publisher. The README states that the content of the web and print versions is basically the same and points to a page explaining the differences, which is the honest way to handle the fact that a book has to be frozen while a website does not.

The repository description is in Japanese and reads as an introductory book for people who get lost. So is the entire text. There is no English edition, and the README does not suggest one. The repository topics are `book`, `browser`, `ecmascript`, `javascript`, `nodejs` and `tutorial`, which is an accurate summary of the scope.

Dual licensing separates the words from the code

The licensing is the part of this repository that other book projects would benefit from copying. The README states it directly: the source code is distributed under the MIT licence, and the text under CC BY 4.0. Both licence files sit at the root as `LICENSE-MIT` and `LICENSE-CC-BY`.

The definitions are precise, which is unusual and useful. Source code means the sample code in the book and the programs that make up the project, mainly JavaScript files and code blocks inside Markdown files. Text means the book's prose and the site's prose, mainly Markdown files. So if you want to quote an explanation or reuse a passage in your own teaching material, CC BY 4.0 covers it with attribution. If you want to lift a sample script into your own project or fork the tooling, MIT covers it without a copyleft obligation.

Copyright is dated 2016-present, so the text is old enough to have been revised under changing licence terms. Release v5.0.0, published 2023-08-31, records the switch to CC BY alongside ECMAScript 2023 support and the move to Open Collective, which means the relicensing is a deliberate project decision rather than an accident of history.

Chapters are executed as tests, which is unusual for a book

The most interesting thing in this repository is not the book. It is that the book has a test suite, and that the suite covers the prose.

The README's Test section explains that this project runs tests against the text and the code. Three kinds are named: tests for inline code in the text, tests triggered by specific filenames, and DocTest using comments. Running everything is:

bash
npm install && npm test

That first category is the one that changes how a chapter gets written. If a code sample in the prose is executed as part of the test suite, then an example that stopped working after an ECMAScript update fails the build rather than misleading a reader who trusts it. For a book that promises to track the language, that is the mechanism that makes the promise mean something.

The tooling around the tests is visible in the tree. There is `textlint/` and a `.textlintrc.js` for prose rules, `prh.yml` for terminology consistency, `test/` for the suites themselves, a `.mocharc.json` for the test runner, `eslint.config.mjs` for the JavaScript, and `.prettierignore`. None of that is exotic, and all of it is the kind of setup that a book project normally skips. `meetings/` at the root is where the editorial decisions get recorded.

HonKit builds the site, Netlify hosts it

The book is built as a website with HonKit, GitBook's maintained successor. The setup instructions ask you to enable corepack and then install dependencies from the lockfile:

bash
corepack enable
npm ci

The versions the maintainers develop against are recorded in the README, which is the kind of detail that saves an afternoon. Node.js v26.3.0 and npm 11.16.0, with `.node-version` in the tree pinning the former and `package-lock.json` pinning the latter. There is a `.editorconfig` for whitespace and a `CLA.md` alongside `CONTRIBUTING.md`, so the contribution path includes a contributor licence agreement.

Three commands cover the daily loop. `npm run build` does a one-shot HonKit build, `npm run watch` builds and watches with a local preview server on port 4000, and `npm test` runs the suite. The README documents the preview step as visiting localhost:4000 after starting the watcher.

`netlify.toml` and a `.netlify/` directory are why the site is up, and the README closes with a Netlify supporter badge. The hosting choice is unremarkable, which is the point: once the content is Markdown and the build is three npm scripts, the site could move anywhere with a build hook.

Major releases track ECMAScript editions, not chapter counts

Three major releases are visible and they line up with language editions rather than with the number of chapters changed.

v5.0.0 on 2023-08-31 covers ECMAScript 2023 and marks the licence change to CC BY plus the move to Open Collective. v6.0.0 on 2024-09-01 covers ES2024 and, in the project's own description, a substantial Node.js update. v7.0.0 on 2025-08-18 covers ECMAScript 2025 with iterators and generators named as the headline addition. The last push to master was 2026-09-16, so the ES2026 work is presumably in progress on the branch rather than in a tagged release.

That cadence is the honest signal about how to treat the book. A release means the language coverage has been swept, not that the text is finished, and the README says so in a section marked with warning emoji: the book is content under development, and anyone who wants to know why it moves should read the meeting notes in `meetings/`.

Funding follows the same cadence. The README asks for support through GitHub Sponsors for the author, and through Open Collective for the project, with corporate sponsorship perks such as a logo on the site. It also lists cheaper ways to help: writing a review of the print edition, answering someone's question in the Discussions board, or filing a pull request that fixes a typo. The typo route is the one most contributors actually take.

Two maintainers, and a question-shaped feedback loop

The project member section names two people: azu, who wrote the original book, and Suguru Inatomi, who handles much of the current maintenance. Two maintainers is a small number, and it shows in the structure: the meetings directory, the sponsor setup and the two licence files are all things that a single author would not have bothered with.

The feedback channels are unusually well signposted for a book. There is a dedicated page on the site for reporting text errors, a Google Form for general reactions to jsprimer.net, a Discussions board with a welcome thread that collects the guidelines, and an email address for everything else. The README also carries a mailing list signup for people who want repository updates without watching the project.

The topics include `book` rather than `documentation`, and that distinction is preserved in the tooling. This is not framework docs that happen to live in a repository; it is a book with a continuous revision process, a print edition, a web edition, and a test suite that checks the examples in the text actually run. If you are deciding between JavaScript books and you read Japanese, the deciding factor is likely to be that this one keeps itself current without a new edition every year.

Editorial conclusion

JavaScript Primer is the rare programming book that is also a working software project, and that is exactly why it is worth reading even if you never look at the repository. The prose is linted, the code samples are executed, the book and the website share one source, and the licensing is split so that the words are reusable under CC BY 4.0 while the tooling stays MIT. Two practical notes before you start. It is written in Japanese, so an English reader gets more out of the structure, the tooling and the topic ordering than out of the prose itself. And the project states plainly that the book is under development, with the reasoning in the meeting notes, so expect the text to move between editions rather than treating any single chapter as frozen. Clone it, run `npm ci` and `npm run watch`, and read the intro page on the difference between the web and print versions before deciding which to work through.

Frequently asked questions

Is JavaScript Primer free to read?

The web edition at jsprimer.net is free and open. The print edition is sold separately as a second revised edition, in physical, Kindle, PDF and epub forms. The README states that the content of the web and print versions is basically the same, with a page explaining the differences between them.

What license is JavaScript Primer under?

It is dual licensed. The prose, meaning the book and site text in Markdown, is CC BY 4.0. The source code, meaning sample scripts in the book and the programs that build the project, is MIT. Both licence files are in the repository root as LICENSE-CC-BY and LICENSE-MIT, and the README defines each category explicitly.

Is JavaScript Primer written in English?

No. The book, the README and the documentation are written in Japanese. There is no English edition listed in the repository. The repository topics and the tooling are language-neutral, and the chapter ordering follows ECMAScript 2015 onward rather than any particular prose style, so much of the structure is legible even if the text is not.

How do I build the JavaScript Primer site locally?

Enable corepack, install from the lockfile with `npm ci`, then use `npm run build` for a one-shot HonKit build or `npm run watch` for a build with a local preview server on port 4000. `npm test` runs the suite that checks the text and the inline code samples. The README records Node.js v26.3.0 and npm 11.16.0 as the development versions.

How current is JavaScript Primer?

Major releases track ECMAScript editions. v7.0.0 in August 2025 covers ECMAScript 2025 with iterators and generators, v6.0.0 in September 2024 covers ES2024 and a Node.js update, and v5.0.0 in August 2023 covers ES2023. The README states the book is content under development, with editorial reasoning recorded in the meetings directory.

Official sources

  1. js-primer/js-primer on GitHub
  2. License: CC-BY-4.0
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/js-primer-js-primer.svg)](https://hysenlabs.com/projects/js-primer-js-primer)