Matter.js is an open-source 2D rigid body physics engine written in JavaScript for the web. A physics engine is a library that simulates how objects move and collide: at each time step it applies forces such as gravity, detects collisions and updates the position and speed of every body. Rigid bodies are objects that do not bend. Liam Brummitt (@liabru) wrote it as an original engine, not a port of another one.
A program creates bodies (circles, rectangles, polygons, concave shapes from SVG paths, and compound bodies made of several parts), gives them physical properties such as mass, density, friction and restitution (how much a body bounces), links them with constraints, and runs the engine in a loop. Matter.js handles collision detection in broad, mid and narrow phases, stable stacking, sleeping and static bodies, and collision events. A built-in canvas renderer draws the scene, or the program uses its own renderer. Plugins add features, and the engine runs in browsers and in Node.js.
Matter.js is free and open source under the MIT License and installs from npm.