Intro to Bit

Welcome to the Bit documentation. Start your journey here to leverage composability for building your next project. Below you will learn to create and release your first Bit components.

Get started

Run the following to install Bit:

$npx @teambit/bvm install
Copiedcopy

Initialize Bit on a new folder or in an existing project by running the following command:

$bit
Copiedcopy

Make sure to create your scope on the Bit platform and use the right org and project name. After running the command, Bit is initialized on the chosen directory, and ready to be used via Bit commands, your editor or the Bit UI!

Build your first components in the cloud

Skip installing the Bit CLI and use Cloud Workspaces for a ready-to-go, web-based and integrated development environment.

Create application shell

Create the application shell to run, compose and deploy your platform:

$bit
Copiedcopy

Run the platform:

$bit
Copiedcopy

Head to http://localhost:3000 to view your application shell. You can provide API to ease the integration of features to the platform using Platform aspects. Learn more on building platform aspects or optionally learn maintaining an independent platform workspace.

Create features

Create a feature composing React, Angular, Vue or other components into your platform:

$bit
Copiedcopy

You can add API to the people aspect to leverage as introducing new features into the platform. Dive deeper into creating features or optionally learn to create and maintain independent feature workspaces.

Compose the feature into the application shell:

// acme-platform.bit-app.ts
import { HarmonyPlatform } from '@bitdev/harmony.harmony-platform';
import { SymphonyPlatformAspect } from '@bitdev/symphony.symphony-platform';
// import the feature component
import { PeopleAspect } from '@my-org/people.people';

export const AcmePlatform = HarmonyPlatform.from({
  name: 'acme-platform',
  // use the Bit default platform engineering aspect
  platform: [SymphonyPlatformAspect],
  
  aspects: [
    // compose the people feature into the platform
    PeopleAspect
  ],
});
CopiedCopy

Create components

Create the components to compose into the feature. Run the following command to create a new React UI component for the platform login route:

$bit
Copiedcopy

Adjust the React login to your needs and finally compose the component into the platform:

// people.browser.runtime.ts
import { SymphonyPlatformAspect, type SymphonyPlatformBrowser } from '@bitdev/symphony.symphony-platform';
// import the login component.
import { Login } from '@acme/support.routes.login';

export class PeopleBrowser {
  // optionally define people browser runtime API
  static dependencies = [SymphonyPlatformAspect];

  static async provider([symphonyPlatform]: [SymphonyPlatformBrowser]) {
    const support = new SupportBrowser();
    // integrate the login as a route to the platform.
    symphonyPlatform.registerRoute([
      {
        path: '/login',
        component: () => <Login />
      }
    ]);

    return support;
  }
}
CopiedCopy

Head to http://localhost:3000/login to view your new login page.

You can use bit templates to list official templates or find guides for creating React hooks, backend services, NodeJS modules, UI components and more on our create components page. Optionally, use bit start to run the Bit UI to preview components in isolation.

Release and deploy

Authenticate with the Bit platform:

$bit
Copiedcopy

Use semantic versioning to version your Bit components:

$bit
Copiedcopy

By default, Bit uses Ripple CI to build and deploy Bit components. You can use the --build flag to build the Bit components on the local machine. Learn more on setting Kubernetes and other deployment methods.

After versioning, you can proceed to release your components:

$bit
Copiedcopy

Congrats! 🎉 Your platform is now being deployed! You can now view your deployment process on Ripple CI in the Bit platform.

Independent workspaces

You can create independent workspaces to build, maintain and release Bit components independently. Below are examples to a feature and a platform workspace:

You can install components from different workspaces as external dependencies:

$bit
Copiedcopy

Learn more about independent workspaces on the getting started guide.

Gradual adoption

The best approach for adopting composability is starting to create new features in Bit while leveraging 100% of your existing codebase. You can either leverage your existing code using existing packages, backend APIs or by packaging your existing app codebase for reuse in Bit components.

Bit components can also be reused in existing projects to start gradually introducing composable software into your stack using standard package managers and without affecting your existing project build process:

$npm install @acme/people.routes.login
Copiedcopy

Learn more on gradual adoption on the Harmony documentation.

Get started

Use your tech of choice

What's next