Creating Apps

Apps are Bit Components including a file declaring their run, build and deploy. To create a basic Bit app, run the following command:

bit create bit-app my-app
CopiedCopy

You can use one of our official app types, or create your own and use from your apps.

Alternatively, expose an app from existing components by adding a file named *.bit-app.ts to your Bit Component:

import type { AppBuildContext, AppBuildResult, AppContext, AppDeployContext, Application, ApplicationInstance } from '@teambit/application';

export class MyApp implements Application {
  name = 'my-app';

  async run(context: AppContext): Promise<ApplicationInstance> {
    // use `process.exec`, `webpack` or other tools to run your app.
    // webpack()
  }

  async build(context: AppBuildContext): Promise<AppBuildResult> {
    // add a build task for your app. usually using build tools like webpack, vite, esbuild or others.
  }
  
  async deploy(context: AppDeployContext) {
    // return {}
  }
}

export default new MyApp();
CopiedCopy

You can implement your own app or even your own app type and use your app type to build apps to your prefreneces at ease. See example for the basic Node App Type to learn how to create your own app types.

Learn more