Introduction to Harmony

Harmony is a minimalistic library for stitching composable architectures. It allows to compose API centric business features to unified platforms without compromising SPA and SSR performance or dev experience.

It enables developers to compose components and test changes in the context of the complete platform while working independently, by inverting the control over integration. This eliminates integration guesswork and eliminate the risk of breaking existing functionalities.

Harmony is framework agnostic and have official runtimes for NodeJS and the Browser and can be extended to support further runtimes and dev tooling.

Harmony is designed for gradual adoption and to quickly stitch existing code into composable business features.

An Harmony platforms composing existing services and new Bit components
An Harmony platforms composing existing services and new Bit components

Get started

Create a new Bit workspace:

$bit
Copiedcopy
Explore Harmony in the cloud

Get hands-on with Harmony using a web-based starter project. Sign up for a free Bit Cloud account to access Cloud Workspaces and dive right in!

Run the following command after your workspace.jsonc changes:

bit install
CopiedCopy

Create the shell application:

bit create harmony-platform my-platform
CopiedCopy

Run the platform:

bit run my-platform --watch
CopiedCopy

Explore the complete example on the Piped Piper component example or visit the Pied Piper organization organization on Bit Cloud.

Compose features

Aspects are the glue of composable architectures, combining components into cohesive platform features. They define how these pieces interact, leveraging UI, backend, and other runtimes to stitch together the necessary functionality.

Run the following command to create an Aspect:

bit create aspect people --scope myorg.people
CopiedCopy

Use the Aspect in your platform:

// my-platform.bit-app.ts
import { HarmonyPlatform } from '@bitdev/harmony.harmony-platform';
import { NodeJSRuntime } from '@bitdev/harmony.runtimes.nodejs-runtime';
import { BrowserRuntime } from '@bitdev/harmony.runtimes.browser-runtime';
import { SymphonyPlatformAspect } from '@bitdev/symphony.symphony-platform';
import { PeopleAspect } from '@bitdev/symphony.examples.people'; // Replace with your Aspect
import { HeaderAspect } from '@bitdev/symphony.aspects.header';

/**
  * compose the my-platform platform.
  */    
export const MyPlatform = HarmonyPlatform.from({
  name: 'my-platform',
  platform: [SymphonyPlatformAspect, {
    name: 'My platform',
    slogan: 'A new unified platform',
    logo: 'https://static.bit.dev/extensions-icons/wayne.svg',
  }],

  runtimes: [
    new BrowserRuntime(), 
    new NodeJSRuntime()
  ],

  aspects: [
    // you can use the symphony header aspect or fork to build your own.
    HeaderAspect,
    // example business capability, replace with your own.
    PeopleAspect
  ],
});

export default MyPlatform;
CopiedCopy

Head to the Aspect you created, edit it to use the components you need and plug them into your platform. Learn more on creating aspects.

Ensure to restart the application server after adding or subtracting aspects, run bit run my-platform.

Deployment

An Harmony build is producing a unified build artifact for each of your runtimes, which results in faster performance but also ease deployment and portability of your platform to different cloud providers or your own on-premise servers.

bit tag --message 'releasing my feature' --major
CopiedCopy

Using Ripple CI builds are always preserved fast, and teams can independently preview and release their changes to production. Learn more about Harmony deployment.

Platform engineering

Symphony is the Bit official platform aspect. It is an opinionated platform aspect featuring React and GraphQL for you to build your platform. You can also build your own platform aspect to fit specific needs or APIs.

References

What's next

► Create an Harmony platform

► Create the Platform Aspect

► Create an Aspect

► Set up your own Harmony Development Environment ('env')

► Create an Harmony runtime