Intro to Bit
Welcome to the Bit documentation. Start your journey here to leverage components 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
Copied
Initialize Bit on a new folder or in an existing project by running the following command:
$bit init --default-scope my-org.my-project
Copied
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, AI agent, your editor or the Bit UI!
Start your next project with Hope AI
Use natural language and file attachments for generating using Hope AI for a ready-to-go, web-based and integrated development workspace with professional architecture and code tailored to your specific needs.
Create components
Create new React UI components by running the following command:
$bit create react pages/login
Copied
Run the Bit UI to develop and preview components in isolation:
$bit start
Copied
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.
Compose apps
Start composing components to existing and new apps. To create an app shell to run, test and compose the components:
$bit create react-app corporate-website
Copied
Adjust the React login to your needs and finally compose the component into the app:
import { Login } from '@my-org/users.pages.login'; import { Routes, Route } from 'react-router-dom'; export function CorporateWebsite() { return ( <AcmeTheme> <NavigationProvider> <Routes> <Route path="/" element={<div>Hello world</div>} /> <Route path="/login" element={<Login />} /> </Routes> </NavigationProvider> </AcmeTheme> ); }Copied
Run the app:
$bit run corporate-website
Copied
Head to http://localhost:3000 to view your app shell. You can start composing the app layout and specific pages. Learn more on building applications or optionally learn maintaining an independent workspace.
Release and deploy
Authenticate with the Bit platform:
$bit login
Copied
Use semantic versioning to tag your Bit components:
$bit tag --message "my first release" --major
Copied
By default, Bit uses Ripple CI to build and deploy Bit components. Use the --build flag to build the Bit components on the local machine or use your CI of choice. Learn more on setting Bit pipelines on your Git repository and see Github repo example.
After versioning, you can proceed to release your components:
$bit export
Copied
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 install @acme/people.routes.login
Copied
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
Copied
Learn more on gradual adoption on the Harmony documentation.