# Extending the B2B Platform

The B2Bsellers Suite is designed for maximum extensibility. Developers can create new Vue.js modules, override core components, or build entirely new pages and menu items using patterns that are highly similar to the Shopware Administration.

## Quick Overview

* Familiar Syntax: Uses the same Vue.js structure as Shopware’s admin area.
* Automatic Loading: New modules are automatically detected via a central entry point.
* Hot Reloading: Use the Platform-Watcher CLI command for real-time development.
* Total Control: Override existing logic, add custom components, or register new menu entries.

## Step-by-Step Guide

### **Initialize the Entry Point**

Before starting development, you must create a `main.js` file in your plugin at: `<PluginRoot>/src/Resources/app/b2b_platform/src/main.js`

{% hint style="info" %}
The Watcher scans for this file on startup. If you create it while the Watcher is already running, you must restart the process to detect the new file.
{% endhint %}

### **Start the Watcher**

{% content-ref url="/pages/waMGPjlhhwvTotGMG6op" %}
[Watcher for the B2B Platform](/b2b-platform/developer-guide/cli-commands/development-commands/watcher-for-the-b2b-platform.md)
{% endcontent-ref %}

To verify it's working, add `console.log("B2B Platform Loaded")` to your `main.js`. You should see the output in your browser console immediately.

## Customization Examples

For a deep dive into implementation, refer to:

{% content-ref url="/pages/dYXWl5eudbdquVn13CQK" %}
[Example Plugin](/b2b-platform/developer-guide/first-steps/example-plugins.md)
{% endcontent-ref %}

### **Overriding an Existing Component**

You can modify core components using `Component.override`. In this example, we customize the address index page.

```javascript
// .../extension/address/pages/address-index/index.js

import template from './template.html.twig';

const { Component } = B2bPlatform;

Component.override('address-index', {
    template,
});
```

```twig
// ../template.html.twig

{% block address_index %}
    <p>This block has been overridden by the Example Plugin.</p>
{% endblock %}
```

### **Registering a New Module**

To create a complex feature, you can register a new module. This typically involves:

1. Creating a custom Entity and Store-API controller.
2. Building the Vue.js component.
3. Registering the module in the B2B Platform.

## Best Practices

1. The development process is almost identical to Shopware Administration development. The only key difference is the directory path: simply use the `b2b_platform` directory instead of the `administration` directory within your plugin's `Resources` folder.
2. Mirror the structure of the `B2BsellersCore` plugin for consistency. Create a folder for your component/module containing a Vue.js file and a template.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.b2b-sellers.com/b2b-platform/developer-guide/how-to/extending-the-b2b-platform.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
