fusio

Fusio Project is a free open source API management platform which helps to build and manage REST APIs. It provides all the necessary tools to quickly build an API from different data sources yet it is possible to create complete customized responses. Fusio Project could be used as :

  • API-Gateway: Fusio can be used as gateway to your internal API and microservices.
  • Low-Code-Platform: It allows you to build API endpoints without coding knowledge.
  • API-Framework: The project can be used as API framework to build complete customized API endpoints.

The version 2.0 have just been released few days ago and marks a huge milestone for the project. The latest edition introduce Backend based on actions, Improved RPC support, Async action, TypeSchema, Deploy changes to a remote Fusio instance, Moved all CLI commands to a separate package fusio/cli, Added Role concept, Updated client SDKs, and finally moved apps folder to public folder.

Fusio routes

Fusio is an API management platform where you can configure routes which execute specific actions. An action triggers your business logic, it is like a controller in a classical framework, you can also think of it like a serverless lambda function, which can be executed on a route call or via RPC. Fusio covers many aspects of the API management life cycle so that you can concentrate on writing the actual business logic of your API. 

A comprehensive list of features of Fusio Project includes :

  • OpenAPI generation : Fusio generates automatically an OpenAPI specification for the defined routes
  • SDK generation Fusio can automatically generate a client SDK for your API based on the defined schema
  • Subscription support Fusio contains a subscription layer which helps to build pub/sub for your API
  • Rate limiting Fusio provides a way to rate limit requests based on the user or app
  • Authorization Fusio uses OAuth2 for API authorization
  • RPC support Fusio provides RPC support, every action which you create can be also called via JsonRPC
  • Monetization Fusio provides a simple payment system to charge for specific routes
  • Validation Fusio uses the TypeSchema to automatically validate incoming request data
  • Analytics Fusio monitors all API activities and shows them on a dashboard
  • User management Fusio provides a developer app where new users can login or register a new account through GitHub, Google, Facebook or through normal email registration

For simple uses cases you also dont need to use the deployment. You can simply build your API based on the available actions and only through the backend. This means you use Fusio Project more like a CMS. The following actions are available by default:

Fusio project actions
Fusio ACtions

In Fusio an action contains the business logic of your API. It i.e. inserts data to a database or returns specific data for an endpoint. Fusio contains already example Todo actions, please take a look at the src/ folder. To give you a first impression the following action shows how to insert a todo entry:

<?php

namespace App\Action\Todo;

use App\Model\Todo;
use Fusio\Engine\ActionAbstract;
use Fusio\Engine\ContextInterface;
use Fusio\Engine\ParametersInterface;
use Fusio\Engine\RequestInterface;

class Insert extends ActionAbstract
{
    public function handle(RequestInterface $request, ParametersInterface $configuration, ContextInterface $context)
    {
        /** @var \Doctrine\DBAL\Connection $connection */
        $connection = $this->connector->getConnection('System');

        $body = $request->getPayload();
        $now  = new \DateTime();

        assert($body instanceof Todo);

        $connection->insert('app_todo', [
            'status' => 1,
            'title' => $body->getTitle(),
            'insert_date' => $now->format('Y-m-d H:i:s'),
        ]);

        return $this->response->build(201, [], [
            'success' => true,
            'message' => 'Insert successful',
        ]);
    }
}

Code generation

 If you build an API based on entities which should be stored in a relational database you can use Fusio code generator to simply build all routes, schemas and actions based on a simple YAML definition. The code can be used as great starting point to rapidly build your API. An interesting and powerful RAD tool to automatically generate REST APIs based on OpenAPI or Entity definitions.

Serverless coming soon

The serverless feature of Fusio is actually under development, it will provide a self hosted platform written in PHP which you can simply host on your own bare-metal server, but it is also possible to move the entire application to a serverless provider i.e. AWS. If you develop your API with Fusio you can start hosting your app on a cheap self-hosted server and move to serverless only if you actually need the scaling capabilities.

Fusio Project ecosystem

In addition to the API Management platform, there are many projects and tools in the Fusio ecosystem that you should be aware of including :

  • Fusio : Contains a configured Fusio instance with a simple Todo app.
  • Fusio-Impl : Contains the backend API implementation of Fusio. This is the place if you like to change the internal API of Fusio
  • Fusio-CLI : Contains the CLI client for Fusio, it is automatically included in every Fusio installation but you can also run the CLI client standalone. It allows you to directly interact with the API and to deploy specific YAML configuration files
  • Fusio-Model : Contains all Fusio models automatically generated via TypeSchema. This repository helps if you want to work with the Fusio API since you can use the same model classes which we also use at the backend
  • Fusio-Engine : Contains mostly interfaces which are also needed by adapters. This repository is very stable and there are few changes
  • Fusio-Adapter : Page which shows all available adapters. An adapter can extend Fusio by providing i.e. custom Actions or Connections to different services. I.e. There is an adapter MongoDB which helps to work with a MongoDB
  • Fusio-Docker : Contains a Docker-Image to run Fusio, it helps to quickly create a Fusio instance in the cloud. You can find it also directly on DockerHub
  • App-Backend : Contains the Fusio backend app which you can use to configure your API. This is the place if you like to change or improve the backend app
  • App-Consumer : Contains a developer portal app where external developers can register to use your API

Make sure you check Fusio project youtube channel for introduction, installation, and tutorial to deploy the platform or create simple route.

Fusio Project is an open source software, released under an AGPLv3 License. More information at https://www.fusio-project.org/

LEAVE A REPLY

Please enter your comment!
Please enter your name here