Directory Structure

A Bit Workspace does not require a specific directory structure. You can nest components as much as you like, or even have mixture of flat structures and nested structures. Your workspace directory structure is entirely up to you.

Components can be tracked in any directory in the project's file system with the bit add command.

bit add path/to/dir/button
CopiedCopy

The default directory structure for a Bit Workspace is defined in workspace.json. The default directory structure is as a pattern used by commands placing Components in the Workspace like bit create or bit import.

{
  "teambit.workspace/workspace": {
    "defaultDirectory": "{scope}/{name}"
  }
}
CopiedCopy

Other available params for the pattern are: {namespaces} and {componentName}.

By default, we configure Scope to be the top level directory to preserve team boundaries and ownership on Components in the Workspace.

├── base-ui --> `Scope` used to define team boundaries and ownership
    ├── ui --> `Component Namespaces` to assist with organization and configuration of components used
        ├── button --> `Component Directory` includes a specific Component implementation
          ├── index.ts
          ├── button.ts
          ├── button.spec.ts
          ├── button.docs.md
          ├── ...
    ├── hooks
        ├── use-product
          ├── index.ts
          ├── use-product.ts
          ├── button.spec.ts
          ├── button.docs.md
          ├── ...
├── ecommerce
    ├── ui
        ├── button
          ├── index.ts
          ├── button.ts
          ├── button.spec.ts
          ├── button.docs.md
          ├── ...
├── ...
CopiedCopy
bit import
CopiedCopy
bit create
CopiedCopy