Bit stores components information in collections (sometimes also referenced as scopes). Just like a version control system is a collection of related files, a collection is s a collection of related components.
Bit collections are distributed. Similar to distributed version control systems (DVCS) such as git or mercurial, bit collections are all made equal. That is to say that components can be exported and imported between any two collections.
However, just like a typical DVCS workflow, it is common to have a master collection that centralizes the components from different working environments. A cloud or on-premise server hosts the master collection.
A Bit workspace is a collection that resides inside a project. A workspace contains all the component information and provide the functionality to author, export, import, and install components. Usually, a project has a single workspace.
The Bit workspace has 3 parts:
- workspace config contains information about the Bit project configuration, such as the package manager for installing components, the default compilers and testers, and the components code location.
package.jsonfile has a
bitsection with all the workspace configuration. Alternatively, a
bit.jsonfile at the project’s root directory can store the information on a separate file. This configuration is editable by the user to fit the exact configuration of the project.
- components map defines the files that comprise each component. The
.bitmapfile at the project’s root stores this information. This file is auto-generated by Bit, but should be committed to the Version Control tool.
- collection the workspace’s collection contains the content of components. By default, the components store is an extension to the git repository under
.git/bitdirectory, but can be stored elsewhere, such as under a
A user can set up a Bit server that holds remote collections. The remote collection shares components between multiple local workspaces. Bit can be set up as a server for sharing components between local workspaces. A Bit server may host multiple collections, called remote collections.
A remote collection is a bare collection that only stores the components information. Authoring and tracking components are not possible inside a bare collection.
A project’s workspace exports components to a remote collection hosted on a Bit server.
There are no limitations on components exporting - a local workspace may import from and export to multiple collections stored on different servers.
Managing remote collection as well as local workspaces is by using the
bit-cli. Also, the server needs to have the bit-cli and npm configurations..
Working with a bit workspace on local dev machine or setting up a bit server requires the bit-cli tool. bit-cli manages the components and collections and their content.
The bit-cli tool is an open-source tool. The tool is installed both on a project’s workspace and on a Bit server for managing remote collections.
All components and collections management is done using the bit-cli tool, installed on a specific machine.
The bit-cli configuration is shared between all workspaces on a single machine. bit-cli configuration is accessible using the
bit config command. The configuration file is created when running
bit login, and is stored according to the OS.
When using NPM or Yarn to install components, the tools should be capable of finding bit components.
NPM and Yarn use the npm configuration ( the
NPM configuration points to the bit registry for all installs that start with
@bit. The bit registry itself is located in
When a user logs into Bit, the CLI updates the NPM configuration with the Bit registry information, including the user token. The user token ensures that the user can only access authorized collections.
Bit.dev server is a cloud service provided by Bit. Accessing bit.dev server requires registering a user account on the bit.dev server. To export and import components from a local workspace to the account, the developer must login from the local workspace.
Unlike bit-cli tool that is open-sourced, bit.dev server is proprietary and owned by Bit.
Bit.dev server provides these functions:
Remote Collections Hosting
A Remote Collection is a curated list of shared components on a remote server. The remote collection is used for collaborating on components between bit workspaces. Bit.dev provides hosting for remote collections for all the users. Each remote collection contains the bit scope of its components as well as additional information on the collection:
- Collection name - The name by which the bit scope in the collection is available to developers for sharing or consuming components.
- Visibility - Determines who can view the Collection: A public collection is a free collection that is visible for all registered users. A private collection is limited to the organizations registered users.
- License - The default code license that is applicable for all the components shared in the collection (such as MIT, GPL or other licenses)
- Users & Roles - the users that have access to the collection and their roles on the collection (admin, developer, or viewer).
The component playground is a web-based editor and a rendering environment for each component hosted on Bit.dev server. The component playground enables developing example wrappers for the component to show its usage.
When a component is exported to bit.dev, the components CI (Continuous Integration) runs a container for building and testing the component. The container uses the compiler and tester defined for the component in the original project. The component is built in an isolated environment. The isolated environment contains the packages and dependencies defined for the component but does not have all the remaining project definitions. This isolation makes sure the component is truly stand-alone and is consumable by other projects.
The Component’s CI displays the results for the component build and test run on the component page on bit.dev. When finishing the build and test tasks, the remote container is purged. The component is then available in the component playground.
Bit.dev components explorer allows searching across all the remote collections that the user has access to, such as the public collections and the user’s or organization’s components. The component explorer is using metadata on the component: tags, language, framework, and size for advanced searching capabilities.