This guide walks you through the process of building, reviewing, and publishing an app on Flower Hub.


1. Build Your App

It’s showtime—build your app! 🎉

You can refer to this example app for structure and best practices:

https://flower.ai/apps/yan-gao/example-app

Please follow the same README structure when creating your app.

Simulation vs. Deployment

Your app should run smoothly in both Simulation and Deployment without code changes. To achieve this, implement separate data loaders for each mode.

You can distinguish between Simulation and Deployment using context.node_config in ClientApp side. If ["partition-id", "num-partitions"] is present, the app is running in Simulation.

Here’s an example:

@app.train()
def train(msg: Message, context: Context):
    """Train the model on local data."""
    # Load the data
    batch_size = context.run_config["batch-size"]

    if (
        "partition-id" in context.node_config
        and "num-partitions" in context.node_config
    ):
        # **Simulation Engine**: use `flwr_datasets` and partition data on the fly
        partition_id = context.node_config["partition-id"]
        num_partitions = context.node_config["num-partitions"]
        trainloader, _ = load_sim_data(partition_id, num_partitions, batch_size)
    else:
        # **Deployment Engine**: load demo data or real user data
        data_path = context.node_config["data-path"]
        trainloader, _ = load_local_data(data_path, batch_size)

    # Training logic continues identically for both modes

Recommendations:


2. Open a Pull Request (PR) for Review

Once your app is ready:

  1. Add your project under the flower/examples repository.
  2. Follow the contribution guide to open a PR to the Flower main repository.