Create apps

An app is a component that can be served, built and deployed. Naturally, apps have dependencies (components and packages) but no dependents. For example, the React bit-dev component is an app. It uses ui/community-docs, a standard Bit React component, as a dependency:

Run an app locally

Run the following command to list all available apps in your workspace:

$bit
Copiedcopy

The output lists the IDs of the available app components and their corresponding app names:

┌────────────────────────────────┬──────────┐
idname
├────────────────────────────────┼──────────┤
teambit.community/apps/bit-devbit-dev
└────────────────────────────────┴──────────┘

Run the following to run an app locally, independent of Bit's dev server:

$bit
Copiedcopy

After building the app bundle, the dev server will list the path and port of your app:

bit-dev app is running on http://localhost:3000

Initial Chunk Files | Names | Raw Size
vendor.js | vendor | 1.72 MB |
polyfills.js | polyfills | 323.16 kB |
styles.css, styles.js | styles | 215.76 kB |
main.js | main | 48.75 kB |
runtime.js | runtime | 6.52 kB |
| Initial Total | 2.30 MB

Build at: 2023-02-24T10:11:28.649Z - Hash: 8186441b3939ed80 - Time: 10028ms

Create a new app component

Run the following command to create an app using the ng-app template of your env:

$bit
Copiedcopy

The output displays the ID of the generated app (component):

1 component(s) were created

my-org.my-scope/apps/my-angular-app
location: my-scope/apps/my-angular-app
env: my-org.my-scope/envs/my-angular-env (set by template)
package: @my-org/my-scope.apps.my-angular-app

The generated app component includes an app plugin file, my-app.ng-app.ts, with a file pattern that is detected by its corresponding application-type, in this case the Angular app-type. Use a different plugin file pattern to switch from Bit's official Angular app-type, to a different app-type. This will affect how your app is being served, built and deployed.

my-scope/apps/my-angular-app
index.ts
index.ts
my-angular-app.docs.md
my-angular-app.docs.md
my-angular-app.ng-app.ts
my-angular-app.ng-app.ts
tsconfig.app.json
tsconfig.app.json

Install the app's dependencies with the following command:

$bit
Copiedcopy