Meet Bit’s Component Cloud

Share atomic code in the cloud to build modular software without limits.

Jonathan Saring
Bits and Pieces

--

Stocky and Shoopy apps share a component in the cloud

What if all the code you’ve ever written was always available one click away, to build your latest application?

Imagine a component-cloud that contains all your team’s atomic code. Each unit is an encapsulated component (i.e. module) that can be used off the cloud to build applications. Changes to the component’s code can be made right from any consuming project and updated across applications.

Everyone can collaborate, discover the shared code, and build better software together- faster and cheaper. Modularity is made a simple commodity.

Let us dive into this story, learn how today we are building more modular software than ever before in history, why VCSs and Package Managers are built for repositories and not for sharing atomic code, and how atomic components can be shared in the cloud to build modular applications.

Today we build more modular software

Modular software is better software. Software modularity has always been a key principle in software development. Building modular software brings many advantages. It makes for software which is “cheaper” to build, simpler to maintain, easier to reuse, better to test and more. It’s key to many basic principles in software development, including S.O.L.I.D, DRY, TDD, & FIRST.

Today, we build more modular software than ever before, from component-frameworks in the frontEnd (React, Angular, Vue and web components) to Microservices in the backEnd, and in the near future Serverless functions and beyond. Any encapsulated piece of code with a clear and focused API is, in fact, a potentially reusable module.

Repositories and Package managers struggle with atomic code

While Modularity shifts the focus from projects to atomic components, traditional tools such as VCSs and Package managers were built for projects.

Modern VCSs are built extremely well for distribution, but not for sharing. Git is great for managing source code versions at the resolution of a repository. It was not built to manage modular code shared in more than one repository.

Package managers were built to install one repository as a dependency of another project. They were not built to manage shared components inside repositories, and do not manage the granular code changes per component.

Components are not repositories. They are the atomic parts inside a repository. Repositories struggle with sharing code. This is why over the years attempts like Git Submodules and Subtrees were made. Sharing an atomic part of one repository in another repository still remains a painful problem.

Sharing atomic code is too hard

Let’s imagine you have a shared component you wish to share between two applications. Preferably, you don’t want to set up and maintain any more repositories and tools than you really have to. What are your options?

Option one is to copy-paste the code. Many developers copy-paste code, since sharing it is just too hard. Duplicate code is harmful and to be avoided.

Option two would be to move the module into a new repository, to be published as a package that can be installed in both repositories. This means in order to share a module, you now have 3 repositories instead of 2. When trying to share 30 modules, maintenance becomes a nightmare.

You can even move the module, along with other modules, into a library. Libraries are a lot like using CD albums to share a bunch of songs. While Libraries help bunch modules together to overlap some of the overhead, they are very limited in scale and often slow your development workflows. For example, when in need of a change to the code or of some debugging. Or, when sharing many components that need to be fitted into different apps.

Repositories are not built to share atomic code

Option three would be to give up your different repositories and turn your entire codebase into a monolith. But, unless you choose this option for your own reasons (and in the lack of proper tooling, don’t), the inability to share code between repositories should not force you to give up your architecture.

Monorepos are hard to scale and require complex tooling

Learn more: “Sharing components is caring”.

Bit: Share components in the cloud

Just like iTunes and Spotify freed us from CD-Rom Albums for sharing music, and like DropBox and Google docs freed us from endless copies, if the goal is to share code we need to unchain ourselves from the limitations repositories impose. We should use the cloud to share atomic code between projects.

Bit’s cloud platform helps your team share atomic components in the cloud, turning modularity into a commodity.

It removes the limitations and restrictions from sharing modular code at the atomic level, so we can easily build modular software without having to add more repositories or use external tooling to manage them.

Through the cloud, only the atomic components are shared between different repositories, while changes are updated and synced across projects. Developers can share code, discover components and collaborate together.

Every component is automatically encapsulated as a standalone reusable unit, with all required dependencies and configurations. Bit manages the component’s lifecycle, from development and integration to production.

Teams can build applications with unlimited access to all the atomic components written in their projects, and instantly use them in new projects.

Built for atomic components

Unlike traditional VCSs and package managers, Bit was built for modular components. As such, it brings together the best of all worlds, to unlock a quick and simple, yet limitless workflow through the cloud.

Bit introduces 5 novel abilities built for shared components, that remove the limitation around sharing, reusing, updating and building with atomic code.

  1. Bit automatically encapsulates and isolates components from repositories, with their dependencies and all required configurations.
  2. Bit lets you clone any isolated component into a different project, where you can run, test and develop the component right out of the box.
  3. Bit lets you sync components’ changes between all your projects, through the cloud.
  4. Bit extends Git’s workflow beyond a single repository so that you can easily merge changes made in one project into another.
  5. Bit’s component hub provides discoverability and visibility for components shared components in the cloud.

A simple yet limitless workflow

Bit 5 min demo with React components

Any code component with a well-defined API can be shared right from any application to the cloud, bundled with all its files and encapsulated with its dependencies and environments for compiling, testing and running the code.

From the cloud, any component can be introduced into any new application. It can be installed as a package or replicated right into the new repository. The latter option lets you develop and modify the code from the new application.

When multiple repositories hold multiple versions of the same component with code changes between them, the component cloud works as a remote source of truth to update and consolidate these changes across your codebase.

The component cloud also provides discoverability for shared components, and features for team collaboration and hosting for public and private code.

Example: Story of two applications

Here’s a simplified version of what a workflow with Bit looks like. It does not force you to set up any more repositories or to refactor your code. Instead, within minutes you can encapsulate and share a component between two repositories, modify its code from both of them, and sync the changes.

  • Your team has a component written in one repository and wishes to use it in another. It might have use for it in future projects too.
  • Instead of moving it into a new repository, you just mark it with Bit. A designated tool analyzes its dependencies and encapsulates your component, including all files, dependencies, compiler configurations, etc.
  • The component is then shared to the cloud and becomes available to you and your team to find and use. All components are organized in a rich, visual, and interactive experience to choose from.
  • The component can be consumed in a new project. It can be installed as a package, or its code can be “cloned” into the new project- still tracked by Bit. This allows you to make changes to the code from the new project.
  • You now have two projects sharing the same component, only one project has a slightly changed instance of the code. These changes can be marked as a new version of the component and shared back to the cloud.
  • You can then choose to update the component’s version to match for both repositories. Git’s workflow is extended by Bit so that you can merge the changes between the two versions, from any of the repositories.
  • Your team enjoys writing code with universal access to your component hub, where every reusable component you wrote is immediately available to find, use and fit right into any new project. You are happier and better.

Modularity made a commodity

Imagine how much time and effort you can save if you code with full access to all your components in the cloud. And with instant access to millions of components shared by the open source community.

Think of how much time and effort you can save in maintaining and updating common code in different applications and projects. And how you can gradually refactor changes without breaking anything in production.

Think of how software development becomes that much closer to modular composition, with components free of the limitations of larger projects. How this can fit into today’s work with React or Web Components, and how tomorrow you can share and consume ES modules and serverless functions off the cloud. That’s why we built Bit’s component platform.

Learn more

To learn more feel free to check out Bit’s component cloud at bit.dev and create a component collection to host your first components. Explore components shared in the open-source community, to get an idea of what your own component hun will look like. Check-out Bit’s docs to learn how to isolate, share and work with components, and visit Bit’s project on GitHub.

Bit platform provides a fully-suited solution for teams sharing code and free hosting for open source components, now and forever. For any questions, don’t hesitate to visit Bit’s Gitter channel, open an issue or ping the team.

Happy coding!

--

--

I write code and words · Component-driven Software · Micro Frontends · Design Systems · Pizza 🍕 Building open source @ bit.dev