Spread Content Platform

November 26, 2021 mikehajj

Spread is a part of the Choueiri Group Network, an industry leader in the advertising and publishing sector of the Middle East and North Africa Area.

Spread created an innovative software solution for the advertisers and the publishers of Choueiri Group that introduces new features and functionalities that operate on top of multiple Ad managing platforms like Facebook and Google.

Spread launched its advertising and publishing platform and planned on targeting the MENA area (Middle East and North Africa ). This startup was struggling to transform its new idea into a solid product.

I joined their group in the second quarter of 2020 and introduced M360API, a Lightweight Portable, and Multitenant API Management Platform to them.

In just 3 months, their problems were resolved and their product was launched around June 2020.

Spread initially began with a proof of concept using Laravel, a popular PHP framework application, specifically designed to work with the Google Ad Manager Platform. However, the remarkable potential identified through market feedback prompted them to move forward.

Their objective of providing customers with a seamless interface for distributing Ad Campaigns across various advertising platforms, leveraging an AI engine in the background, necessitated modifications to work with multiple platforms beyond Google Ad Manager.

Additionally, the new version needed integration with:

  • Multiple payment networks across various countries, supporting various payment processors and currencies.
  • Multiple email and SMS solutions.
  • A legacy accounting system used by Choueiri Group for billing purposes.
  • Responsiveness to support mobile and tablet devices on Android and iOS.

Project Task/Challenge

Recognizing the limitations of the monolithic proof of concept built using Laravel, Spread faced challenges due to:

  1. Components requiring different programming languages, such as the AI Engine needing Python, introduce new challenges.
  2. The legacy accounting application lacks API support, necessitating a custom solution to bridge connections.
  3. Various payment networks with diverse procedures, workflows, and APIs require dynamic loading of drivers based on geographical location and credit card usage.
  4. Email and SMS notifications pose similar challenges, with customers needing options for how they receive notifications.

This led to the decision to divide the application’s backend into multiple components that work coherently, facilitating integration with external systems. However, this approach raised the need for a centralized system identifying logged-in customers, their roles, and permissions, presenting new challenges related to networking, security, and cloud awareness.

In summary, the new application, initially built with Laravel, had to transition from a monolithic architecture to a more adaptable architecture supporting legacy systems and seamless integration with multiple systems.

Solution

In response to these challenges, it became evident that transforming the new application into a microservices solution was imperative.

Additionally, recognizing the capabilities of the M360 API Management Platform, we concluded that leveraging it would enable Spread to pivot within just a few days during this migration stage.

Guiding a team of two other PHP engineers, I took the lead in the development of this solution, completing it in four months.

Stage 1 » Monolith to Microservice Architecture


In the first phase of the solution, a crucial step involved the complete decoupling of the front-end interfaces from the monolithic application.

These interfaces were reconstructed using VueJS, a renowned front-end JavaScript framework. The redesign aimed at establishing seamless communication with a novel backend.

Collaboratively developed by the two PHP engineers through APIs, the new backend was meticulously broken down into several microservices, each catering to distinct business features.

This comprehensive restructuring was accomplished within a four-month timeframe, with a keen focus on enhancing flexibility and efficiency in the application’s architecture.

Stage 2 » M360API Integration


In the subsequent phase of the solution, I seamlessly integrated the M360 API Management Platform.

Initially, I deployed the API Gateway of the platform in front of the microservices, configuring it as the primary entry point for all backend components. Simultaneously, I ensured that all interfaces were set up to communicate with the microservices through the Gateway.

Following this, I installed the platform’s middleware in all microservices, configuring it to establish communication with the API Gateway. The middleware, available in three versions (NodeJs, Python, PHP), is open source, allowing it to be downloaded and added as a dependency in every microservice.

Overall Solution


This revamped structure mandated that all incoming requests from the frontend interfaces traverse through the API Gateway. The Gateway, in turn, conducted vital functions such as authorization, authentication, access permissions, cloud awareness, and traffic management, and provided multitenancy support to all microservices behind it. Acting as a central hub, the Gateway intercepted incoming requests, enhanced them, and forwarded them to the microservices. The middleware then extracted the augmented information and passed it to the business logic created by engineers within the microservices.

This innovative design empowered Spread to develop various components using different programming languages while maintaining standardized communication between these diverse components. Spread could now construct its AI engine using Python, develop communication components using NodeJs connected to the legacy account system, and create PHP backend components linked to Google Ad Manager and Facebook.

Key features
  • The frontend interface has transformed and operates on a comprehensive Access Control List (ACL) system. This means the visibility and functionality of sections, modules, buttons, and data are dynamically loaded based on the access permissions granted to the logged-in user.
  • The recently upgraded payment system now boasts multi-driver capabilities, empowering it to seamlessly switch between various payment gateways without causing any disruptions for users.

The application transitioned from a constrained monolithic architecture to embrace the new microservices design, capitalizing on the advanced features provided by the API Gateway. These features not only eliminated the need for Spread Engineers to rebuild them but also empowered them to concentrate more on the business logic of the application they aimed to create.