brain.js
Do not start with it. 7th of 7 machine learning in JavaScript.
brain.js is a simple neural-network library for small feedforward, recurrent and LSTM nets in JavaScript. It has had no commits or npm releases for more than two years, its npm "latest" tag is still a 2.0 beta, and its GPU dependency often breaks installs. For new work, pick TensorFlow.js for training or Transformers.js for running modern models.
Best for: Learners and hobbyists who want to train a tiny neural net from plain JSON data and can accept an unmaintained library.
Scores
Overall2.7
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 2.0, likely 1.0 to 3.0
The library is dormant. It has no stable modern release, it often fails to install on current Node, and it covers only small classic networks. TensorFlow.js trains networks better, and Transformers.js, MediaPipe and WebLLM cover today's demand to run models on the device. Keep it only where it already runs; do not start with it.
- github pushedAt: Last push was 2024-09-26.
- github.com/BrainJS/brain.js/issues/957: Users call the project dead.
- peers: Peers are active and growing much faster.
GPT-6.2 Sol: 3.3, likely 2.2 to 4.5
brain.js remains practical for existing small models and teaching demos. The long maintenance gap and limited model support make TensorFlow.js the better choice for new custom training and Transformers.js the better choice for supported pretrained models. Its simple browser workflow could still be worth using in a short-lived prototype, especially with a pinned version.
- github.commitsLastYear, npm.versionsLastYear, peers: No commits or npm releases in the past year, with active peers available.
- blog.rasc.ch/2019/01/machine-learning-with-brain-and-tensorflow-js.html: Shows where stable brain.js still works and how TensorFlow.js supports a broader model.
- tensorflow.org/js: Supports JavaScript training, transfer learning, and model conversion.
- huggingface.co/docs/transformers.js/index: Provides pretrained pipelines with browser WASM and WebGPU support.
Needed by many3.3
How many developers need a tool for this job?
Claude Opus 5.5: 3.5, likely 2.5 to 5.0
Running ML on the device is a clear niche among JS developers. brain.js covers only a narrow part of it: training small classic networks from scratch. Most current demand is for running pretrained models, which it does not do.
- tutorialspoint.com/tensorflow-v-s-tensorflow-js-v-s-brain-js: Says brain.js suits smaller projects and simpler networks.
- peers downloadsLast4Weeks: Most of the category's demand goes to tools that run pretrained models, such as Transformers.js and MediaPipe.
GPT-6.2 Sol: 3.1, likely 1.9 to 4.3
Local machine learning is a niche within JavaScript. In State of JavaScript 2025, 242 of 10,926 respondents to the use-case question selected machine learning. brain.js serves the smaller group building simple classifiers or sequence models, and the survey only measures the broader use case.
- 2025.stateofjs.com/en-US/usage: Machine learning was selected by about 2.2% of use-case respondents.
- blog.rasc.ch/2019/01/machine-learning-with-brain-and-tensorflow-js.html: Shows the stable library’s feedforward and recurrent models in Node.js and browsers.
Helps a lot3.8
How well does it do the job for those who need it?
Claude Opus 5.5: 3.0, likely 2.0 to 4.5
The API is easy, and it is fine for toy feedforward and LSTM nets. Users report that GPU training is slower than CPU training or freezes, that the Recurrent class needs a GPU, that type errors and broken example links go unfixed, and that it does not ship as an ES module. TensorFlow.js does the same job better in every respect except simplicity.
- github.com/BrainJS/brain.js/issues: Open bugs: GPU training slower than CPU, training freezes, TypeScript type errors, broken examples, no ES module build.
- kiwix.lema.org/stackoverflow.com_en_all_2023-11/questions/51797280/machine-learning-tensorflow-v-s-tensorflow-js-v-s-brain-js: Users like the JSON API but most still prefer TensorFlow.js.
- npm latestVersion: The current build is still 2.0.0-beta.24.
GPT-6.2 Sol: 4.5, likely 3.3 to 5.8
Stable 1.6.1 makes small feedforward and recurrent models easy to train and reload from JSON. The 1.x TypeScript declarations cover common calls, but current examples can lead developers and coding agents to beta-specific APIs. TensorFlow.js offers more model architectures and a model conversion path. The range reflects limited recent benchmarks and unverified performance on current runtimes.
- blog.rasc.ch/2019/01/machine-learning-with-brain-and-tensorflow-js.html: Tests 1.6.1 on digit recognition and shows browser inference from exported JSON.
- raw.githubusercontent.com/BrainJS/brain.js/1.4.10/index.d.ts: Stable-line declarations cover training, inference, serialization, and recurrent models.
- npmjs.com/package/brain.js?activeTab=readme: The default package documentation describes 2.0.0-beta.24.
- github.com/BrainJS/brain.js/issues/925: A user documents broken example links after the examples moved.
- tensorflow.org/js: Documents custom training, model conversion, and ready-to-use models.
Holds up over time1.7
Will it still be a good choice in two years?
Claude Opus 5.5: 1.5, likely 0.5 to 2.5
The repository has had no commits in the last year and no push since September 2024. The last npm publish was in July 2024. An open issue from 2026 titled 'Project is dead' has no maintainer reply, and Open Collective funding is negligible. The repository is not archived, but in practice it is dormant.
- github commitsLastYear: 0 commits and 0 releases in the last year.
- github.com/BrainJS/brain.js/issues/957: The 2026 'Project is dead' issue has no maintainer reply.
- opencollective.ecosyste.ms/projects/4355: Annual budget of about $35.
- scorecard Maintained: The Maintained check scores 0.
GPT-6.2 Sol: 1.8, likely 0.8 to 3.1
The last repository push and npm publish were in 2024, with zero commits or releases in the past year. The 2.0 roadmap was last edited in 2021, and proposed installation and LSTM fixes have lingered. The repository remains open, but the pace of work gives little reason to expect timely compatibility fixes.
- github.pushedAt, github.commitsLastYear, github.releasesLastYear, npm.latestPublishedAt: The last push and npm publish were in 2024, with no activity on these measures in the past year.
- github.com/BrainJS/brain.js/releases: The last formal GitHub release is 1.4.10, from 2018.
- github.com/BrainJS/brain.js/wiki/Roadmap: The v2 roadmap was last edited in January 2021.
- github.com/BrainJS/brain.js/pulls: The pull request list shows pending installation documentation and LSTM fixes from 2025.
Used widely2.8
How many use it, and is that growing?
Claude Opus 5.5: 3.0, likely 2.0 to 4.0
About 17k downloads per 4 weeks, up 1.39x on a year ago. That is far below the 4.1x median, so it is losing ground fast. 631 dependent repositories and 14.9k stars mostly reflect past popularity. Peers have 50 to 1000 times more downloads.
- npm downloadsLast4Weeks: 17,358 downloads now, against 12,465 a year ago (1.39x).
- medianDownloadsRatio: The median ratio is 4.1x, so brain.js is falling behind.
- dependents: 631 repositories and 85 packages, against 8,947 repositories for TensorFlow.js.
- bluesky posts: 1 post in 24 months.
GPT-6.2 Sol: 2.5, likely 1.4 to 3.6
Four-week npm downloads rose from 12,465 to 17,358, or 1.39× year over year. That trails the 4.1× catalog median and every listed peer, pointing to a loss of relative share. The 631 dependent repos show real use, well below TensorFlow.js at 8,947, while 14,856 stars and one recent Bluesky post say little about new adoption. CDN installs and partial repo coverage leave the number of direct users uncertain.
- npm.downloadsLast4Weeks, npm.downloadsSame4WeeksYearAgo, medianDownloadsRatio: 17,358 versus 12,465 downloads, below the catalog’s growth benchmark.
- dependents, peers: 631 tracked repositories and 85 packages depend on it.
- github.stars, bluesky.posts, peers: About 14,900 stars and one Bluesky post, versus 14 for Transformers.js and 15 for WebLLM.
- jsdelivr.com/package/npm/brain.js: The CDN provides another distribution channel.
Vouched for2.2
Who stands behind it being good?
Claude Opus 5.5: 2.0, likely 1.0 to 3.0
I found no current production users, benchmarks or framework integrations. Most write-ups are beginner tutorials or older listicles, and Hacker News and Bluesky attention is almost zero. Its main past endorsements, such as a 2019 Wikipedia entry and features in tutorial sites, are dated.
- hackerNews: 1 story with 2 points.
- thenewstack.io/brain-js-brings-deep-learning-to-the-browser-and-node-js: Older coverage of the project.
- en.wikipedia.org/wiki/Brain.js: Maintained by the community, with no corporate backer.
GPT-6.2 Sol: 2.4, likely 1.2 to 3.6
Independent browser research and a working digit-recognition demo show that brain.js can handle small models. A published OCR package still uses stable 1.6.1 as a dependency. The strongest evaluations are old, and evidence of current production use at scale or developer satisfaction is sparse.
- arxiv.org/abs/1901.09388: Independent 2019 browser study measured small-network training and inference.
- blog.rasc.ch/2019/01/machine-learning-with-brain-and-tensorflow-js.html: An independent developer trained a model and deployed it in a browser demo.
- app.unpkg.com/%40angloqq03/gpv%401.1.4/files/package.json: A published OCR package declares a dependency on stable 1.6.1.
Safe4.8
How safe is it to depend on?
Claude Opus 5.5: 4.5, likely 3.5 to 6.0
It has no advisories and an MIT licence. But the OpenSSF Scorecard is 3.5, and the Security-Policy, Token-Permissions, Pinned-Dependencies and SAST checks all score 0. Its one dependency, gpu.js, pulls in a native GL build that is also stale. Nobody maintains it, so any future flaw would likely go unfixed.
- advisories total: 0 advisories.
- scorecard score: 3.5 overall, with several checks at 0.
- socket.dev/npm/package/brain.js: Package and dependency report.
- github.com/BrainJS/brain.js/issues: Native build failures (node-gyp) from the GPU dependency.
GPT-6.2 Sol: 5.0, likely 3.7 to 6.3
The MIT license is permissive, and OSV lists zero advisories for brain.js itself. The npm default declares one direct dependency plus a gpu.js peer dependency, which has historically brought in native build tooling. OpenSSF scores the repository 3.5 out of 10, with zeros for token permissions, dependency pinning, and security policy. The release gap leaves confidence in a timely security fix low.
- npm.license, advisories.total, npm.latestPublishedAt: MIT license, zero recorded package advisories, and no npm publish since July 2024.
- scorecard.score, scorecard.checks: Score of 3.5 with weak code review and several missing safeguards.
- app.unpkg.com/brain.js@2.0.0-beta.24/files/package.json: The beta manifest lists thaw.js and a separate gpu.js peer dependency.
- github.com/BrainJS/brain.js/issues/930: Users traced Node.js installation failures to transitive native tooling.
Good
- Very simple API: you train on plain arrays or objects, with no tensors or memory to manage.
- It covers classic architectures (feedforward, RNN, LSTM, GRU) in the browser and in Node.js.
- It is MIT licensed, ships its own types, and has no known security advisories.
- It has a large back catalogue of tutorials, which makes it easy to learn from.
Bad
- There have been no commits since September 2024 and no npm release since July 2024, and an open issue titled 'Project is dead' has no maintainer reply.
- The npm latest tag points to 2.0.0-beta.24, and the last stable GitHub release is 1.4.10 from 2018.
- The gpu.js and headless-gl dependency often fails at install with node-gyp errors on new Node versions and on macOS.
- It cannot load pretrained or modern models such as transformers, ONNX or LLMs, which peers handle well.
The numbers
- npm downloads, 4 weeks
- 17k +39% in a year
- GitHub stars
- 15k
- Commits, 12 months
- 0
- npm version
- 2.0.0-beta.24 Jul 2024
- Versions, 12 months
- 0
- Advisories, 24 months
- 0 of 0 ever
- OpenSSF Scorecard
- 3.5 out of 10, Nov 2026
- Licence
- MIT
Read on 21 November 2026 from GitHub (BrainJS/brain.js), npm (brain.js), OSV and the OpenSSF Scorecard.
Machine learning in JavaScript
- 8.4Transformers.js
- 7.8MediaPipe Tasks
- 7.1node-llama-cpp
- 6.8WebLLM
- 6.6Tesseract.js
- 4.5TensorFlow.js
- 2.7brain.js