Discover three.js is now open source!
Word Count:641, reading time: ~4minutes

three.js on GitHub - Where the Magic Happens

The entire three.js project is free open source software ( FOSS), and all development takes place in one huge repository over on Github. It’s maintained by the original creator, @mrdoob (AKA Ricardo Cabello), along with an army of open-source aficionados. It’s a huge and active repo, up there with superstars like React, jQuery, and Node.js.

Everything officially related to the three.js project is in the repo: the source code, hundreds of examples demonstrating how to use every part of the library, the docs, an interactive scene editor, and a huge number of plugins and free assets such as 3D models, textures, sounds, and 3D fonts. Open up the repo now, and we’ll take a look. There’s a lot to take in, but for now, only a couple of folders are relevant to us.

The build/ Folder

The build/ folder is the most important folder on the repo since it contains the main three.js file (the core of the library):

  • build/three.module.js

This is the only file you need to run a basic three.js app.

.module in the filename tells us that this is a JavaScript module. In this folder, there are also two legacy versions of the three.js core that you can use if you want to support outdated browsers that can’t use modules:

  • build/three.js
  • build/three.min.js

In this book, we’ll always use three.module.js since the legacy files are slated to be removed in an upcoming release.

The examples/ Folder

Of nearly equal importance, the examples/ folder contains lots of goodies, including:

  • Source code for all the official examples, which you should study as one of your primary learning resources.
  • Plugins in the examples/jsm folder, such as camera controls and model loaders, which we use throughout the book. You should study the code here too, although it tends to be more advanced so you may want to wait until you’ve covered more ground first.
  • Legacy plugins in the examples/js folder. These are the same set of plugins you’ll find in the examples/jsm, however, they will work with outdated browsers. Just like the legacy versions of the core, the legacy plugins will be removed soon and we’ll ignore them in this book.
  • 3D fonts
  • 3D models in many different formats.
  • Sounds.
  • Textures.
  • … and lots more.

Everything that you need to learn three.js is there - except for this book! What’s more, nearly everything in this folder is covered by the MIT license, which means you’re free to use anything in your projects, in any way that you like.

The src/ Folder

You’ll find the three.js source code in the src/ folder. As you become more proficient with three.js you’ll want to know how the actual three.js code is implemented. Every docs page has a direct link to the relevant file in the src/ folder at the bottom of the page, so you can quickly navigate to the relevant file while reading the documentation.

The three.js source code is simple, clean, and concise, making it highly accessible and far easier to understand than you would expect of a 3D graphics library.

Other Folders and Files

There are many other folders and files besides the ones we mentioned here, including the source code for the official docs and the three.js scene editor. Most of these are related to developing three.js, and we won’t cover them further here, but feel free to explore.

The Wiki

Also maintained as part of the repo is the three.js wiki. The main purpose of the wiki is to provide a guide for people who want to contribute to the development of three.js. However, there is one other important page: the migration guide, which provides a quick list of any changes between three.js releases. Whenever you need to upgrade an old three.js app to a new version, this is the place to go.

Import Style
Selected Texture