ng-xtend logo ng-xtend Framework

Enable plugins in your Angular application !

ng-xtend, what for?

The most successful web applications enjoy an eco-system of plugins with them. Check Nextcloud, Drupal, Joomla! or Wordpress, it’s so easy to extend them with a plugin that meets your needs.

The technology they are using, PHP, makes it easy to develop and install new plugins. With limited efforts, these plugins are automatically installed, recognized and available.

While I love the way Angular & Typescript work, there is no easy way to provide extension capabilities through plugins developed by external teams.

That’s why I have developed ng-xtend !

What is ng-xtend concretely?

It’s an Angular library allowing you to:

Some examples ?

Here are screenshots of an application automatically handling list, view and edition of complex data (evaluations of coffee beans) using ng-xtend, a dont-code application, and the default plugin and web plugin
You can see how the different plugins work together without knowing each other. Even the host application does not know them.

List view screenshot Edit object screenshot

Curious ? You can run and test the application here: Coffee Bean Evaluation

What kind of plugins are supported ?

3 types of plugins are supported as a first step

Then in the future, we’ll support

How does it work ?

As you can infer from the preceding descriptions, the ng-xtend framework heavily relies on types. Any data manipulated in a ng-xtendable application manipulates data with a type.

As mentioned, a plugin can be used to display or edit a certain type in the UI, or to act on the type. The actions will be displayed as buttons the user can click.

The host application dynamically loads the plugins from remote locations. A simple config file is enough to define what plugins to load from where.

Upon loading, the plugin registers itself to ng-xtend and provides the list of types and actions it supports.

Whenever encountering a certain type, ng-xtend will look for the right plugin, select the right component, and call it with the proper context. This happens without the host knowing the plugin.

The host only needs to provide xt-render points in their application, like “here you can display action buttons for this ‘type’”, or “here I need the user to enter this ‘type’, please find the right plugin”.

As well, plugins will be able to alter the application menus and other customizations.

What is the roadmap ?

How to use it ?

This is still work in progress, but now it can support real-life applications !

Developing a new plugin

  1. Checkout the repository ng-xtend
  2. It’s a monorepo using rush build system, so run
    npm install -g @microsoft/rush
    rush update
    rush build
  1. Use a copy of libs/xt-plugin-sample to develop your own plugins and components.
  2. Unit test your components using vitest
  3. Test your components using plugin-tester

Use plugins in my application

To use ng-xtend plugins in your own Angular Application, xt-host project is a great example. It does:

    npm install xt-components xt-type xt-store
    npm install xt-plugin-default
    protected resolverService = inject (XtResolverService);
    this.resolverService.loadPlugin(url);
The plugins will register themselves automatically.
    this.resolverService.registerTypes ({
      money:{
        amount:'number',
      currency:'currency'  /** Type provided by the finance plugin **/ 
    },
      book: {
        name:'string',
        publication:'date',
        price:'money',
        notation:'rating'  /** Type provided by the web plugin **/
      }    
    }); 
        <h1>List of books</h1>
        <xt-render [displayMode]="LIST_VIEW" [valueType]="book" [value]="listOfBooks" ></xt-render>
 - or allow editing a book information
        <h1>Enter your book details</h1>
        <div form="bookForm">
          <xt-render [displayMode]="FULL_EDITABLE" [valueType]="book" [formGroup]="bookForm" subName="book"></xt-render>
        </div>
 - To support more complex scenario, use
       <xt-render-sub [context]="context()"></xt-render-sub>
with `context ()` returning type information necessary to select the right component.

Thank you

Please check my other project Dont-code, it will soon run using ng-xtend ! Email: contact@ng-xtend.dev or developer@dont-code.net