Skip to content

Latest commit

 

History

History
188 lines (128 loc) · 7.89 KB

README.md

File metadata and controls

188 lines (128 loc) · 7.89 KB

Website | Docs | Community | Bit Cloud

apache prs Circle Status Styled with Prettier Join Slack

Bit is a complete solution for composing highly performant and consistent platforms from independent business features. It empowers developers to seamlessly integrate API-centric features into shell applications while maintaining optimal user experience, performance, safety, and developer experience

Bit supports all tooling in the JS ecosystem and comes out of the box with official dev environments for NodeJS, React, Angular, Vue, React Native, NextJS and far more. All are native to TypeScript and ESM and equipped with the best dev tooling.

Bit is a fit to every codebase structure. You can use Bit components in a monorepo, polyrepo, or even without repositories at all.

Getting started

Install Bit

Use the Bit installer to install Bit to be available on your PATH.

npx @teambit/bvm install

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

bit init --default-scope my-org.my-project

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!

Create shell application

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

bit create harmony-platform acme-platform

Run the platform:

bit run acme-platform

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 feature

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

bit create aspect people

You can find simple guides for creating NodeJS modules, UI components and apps, backend services and more on the Create Component docs.

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
  ],
});

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 create react login

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

// people.browser.runtime.tsx
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;
  }
}

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

You can either use hosted scopes on Bit Cloud or by hosting scopes on your own. Use the following command to create your Bit Cloud account and your first scope.

bit login

Use semantic versioning to version your components:

bit tag --message "my first release" --major

By default, Bit uses Ripple CI to build components. You can use the --build flag to build the components on the local machine. To tag and export from your CI of choice to automate the release process or use our official CI scripts.

After versioning, you can proceed to release your components:

bit export

Modernize existing projects

Head over to your bit.cloud account to see your components build progress. Once the build process is completed, the components will be available for use using standard package managers:

npm install @my-org/my-project.hello-world

Next steps

Contributors

Bit is entirely built with Bit and you can find all its components on Bit Cloud.

Your contribution, no matter how big or small, is much appreciated. Before contributing, please read the code of conduct.

See Contributing.

License

Apache License, Version 2.0