Application types enable components to be built, served and deployed. Each application type offers its own build strategy for development and for production, and may offer its own deployment solution.
Choose an application type for your component by considering the component type (Node, React, Angular, etc.) as well as the required app artifacts and their host destination.
For a component to use an app type (and by that become an 'app' of certain type) it must include the app-type's plugin file. Learn more about how to use an app type in 'Creating an app'.
An application type implements the functionality needed to run an app in development (independently of Bit's dev server), and possibly, to build and deploy it.
import type { Application, AppBuildContext, AppBuildResult } from '@teambit/application'; export class MyApp implements Application { /* the app's name (set by the app using this app type) */ constructor(readonly name: string) {} /* runs the app locally (in development) */ async run(): Promise<void> {} /* builds the app's deployable artifacts */ async build(context: AppBuildContext): Promise<AppBuildResult> {} /* deploys the app's artifacts */ async deploy(context: AppDeployContext): Promise<void> {} }
Run the following to import a demo application type:
bit import learnbit.apps/my-app-type
- See the .application.ts file to learn how to implement the app-type's core functionality (
bit run APP_NAME
andbit build APP_COMPONENT_ID
). - See the .app-type.ts file to learn how to define the properties configurable by this app-type's plugin file.
- See the .main.runtime.ts file to learn how to register an app-type and define its plugin file extension.
This app type does not implement its own deploy function. To learn how to implement your own deployer or to use an existing one, see 'App deployment'.
Run the following to configure this app type on your workspace:
bit use learnbit.apps/my-app-type
Run the following to import a demo app that uses your app type:
bit import learnbit.app/try-my-app-type
Run the following to configure the app on your workspace:
bit use learnbit.app/try-my-app-type
Run the following to run the demo app using 'my-app-type' app type:
bit run try-my-app-type
Head over to http://localhost:3112/ to see this app running.
Inspecting the app's build
'my-app-type' implements the build
method that generates the app's deployable artifacts.
Learn how inspect the generated artifacts in 'App build'.