Mailing Microservice - My solution for Moroccan PHPers's February 2022 Challenge

Overview

Mailing Microservice

GitHub Tests

Solution for Moroccan PHPers's February 2022 Challenge by Rabyâ Raghib ([email protected]).

It mainly consists of:

  • a php app that provides 3 endpoints

    • POST /send: request sending an email. It expects a payload like:
      {
          "sender": "[email protected]", // the email address of the sender.
          "recipient": "[email protected]", // the email address of the receiver.
          "message": "Hello World!", // email body as HTML format.
          "priority": 4 // oprtional, default to 0
      }
      
    • GET /status/{id}: get the status of request with id {id}, the response:
      {
          "request_id": "24E69C73-D9D6-7B93-77F3-82D7968E8DED",
          "status": "processing",
          "priority": 3
      }
      
    • POST /status-webhook: to handle webhook calls it expect:
      {
          "ID": "The id we sent in the first request",
          "STATUS": "DELIVERED" | "REJECTED" | "FAILED"
      }
      
  • a worker for submitting emails (that failed submitting in the /send request) for delivery taking in consideration prioritization

    Its background job that keep checking & submitting queued emails every $WORKER_PERIOD_SECONDS or can also run only once and exit. See Project setup Section.

Architecture diagram:

Architecture Diagram

Project setup:

Please ensure you set the env variables before running the project. either in .env, .env.local (not committed) or via system environment variables

# run both app & worker services
docker-compose up -d

or instead you can run just the app via:

docker-compose up -d nginx

you can try submitting queued emails via the worker with:

# To keep checking & submitting queued emails every $WORKER_PERIOD_SECONDS
docker-compose up -d worker-service 
# Submit all current queued emails and exist
docker-compose run worker-service " " # clearing default CMD (--serve)

Assumptions:

List of assumptions if you had to take any.

  • The webhook call is made via a POST request to /status-webhook
  • An env variable will be set with the mail delivery service API_BASE
  • This is a private api that can be accessed only by trusted (authorized) services

Improvements:

What would you have added if you had more time.

  • Implement prioritizing logic (#2)
  • Write some unit tests for each endpoint (#3)
  • GitHub action workflows for tests and release (#6)
  • Add endpoint PATCH /que-emails/{id} to add ability to update not submitted emails (#7)
Comments
Releases(v1.1.0)
Owner
Rabyâ Raghib
Rabyâ Raghib
My own implementation of the backend challenge.

Millions backend challenge My own implementation of the backend challenge. Implemented features Show posts paginated, and ordered by creation date wit

Mouad ZIANI 8 Jun 21, 2022
Challenge for 123 milhas.

This app is part of a job interview with 123 Milhas. This repo is functionality complete. Access live demo by click HERE! Getting started Installation

Higor Rocha 1 Nov 11, 2021
A challenge to develop frontend-backend forms and account creating.

Symfony + Vue (Back/Front) Helped and assisted by Vanessa and Paulo. This project have two sides, the back-end(Symfony) and the front-end(Vue.js) for

Rickelme Dias 1 Feb 10, 2022
2022 edition of the inRage Theme fully based on Gutenberg with the support of Roots Sage 10

2022 Edition - inRage theme This version of the theme is compatible with the Full site editing of Wordpress 5.8/5.9 and use Sage 10 in order to manage

inRage 5 Jan 3, 2023
Projet Jura2021-2022

CodeIgniter 4 Framework What is CodeIgniter? CodeIgniter is a PHP full-stack web framework that is light, fast, flexible, and secure. More information

null 2 Jan 3, 2022
Queue Management Systems for LPG vendor agencies of Sri Lanka, for the LPG shortages in 2022

gas-queue-mgt Queue Management Systems for LPG vendor agencies of Sri Lanka, for the LPG shortages in 2022 Installation Requirements PHP 7.4 or later

Madhusanka Goonathilake 14 Oct 18, 2022
Trabajo final de la materia Bases de Datos 1. Creación de una base de datos con MySQL y desarrollo de una página web con PHP para manipularla. UNAL sede Medellín, semestre 2022-1.

Trabajo final BD: i-Lunch Materia: Bases de Datos I Profesor: Francisco Javier Moreno Arboleda Institución: Universidad Nacional de Colombia sede Mede

Emmanuel López Rodríguez 2 Jul 9, 2022
Major Security Vulnerability on PrestaShop Websites - CVE-2022-31101

Fix Major Security Vulnerability on PrestaShop Websites ?? CVE-2022-31101 detector and fixer! A newly found exploit could allow remote attackers to ta

Mathias Reker ⚡️ 25 Nov 22, 2022
CVE-2022-29221 Proof of Concept Code

CVE-2022-29221-PoC This is a very basic Smarty sceleton app with a single template that shows the Proof of Concept code for CVE-2022-29221. Injection

S Bani 12 Nov 4, 2022
Repositorio del código fuente utilizado en la página web Lifo.es durante los años 2017 a 2022

Lifo.es Código fuente del juego de rol online Lifo modificado por mi (Sora) durante los años 2017 a 2022. Este código es una modificación del código b

null 5 Dec 28, 2022
Demo Silverstripe and JavaScript sources for Lightning Talk "FormField Mini Apps" at StripeCon EU 2022

Watch the Lightning Talk on Youtube ?? Demo repository for Lightning Talk "FormField Mini Apps with the JavaScript framework/lib/style of your choice"

Julian Scheuchenzuber 2 Sep 20, 2022
A DDD microservice did in laravel, to test infrastructure

A DDD microservice did in laravel, to test infrastructure

pegons 3 Jul 8, 2022
A PHP microservice for helping know who's who

Identity service Identity is a microservice and API (Application Programming Interface) used for handling everything to do with who's who. For now the

The Big Give 1 Dec 22, 2022
Simple IT Documentation Solution for MSPs

SimpleMSPDoc RC 1.0 I wasn't happy with what other IT documention software had. I felt they over complicated things and required so much clicky clicky

null 4 Jun 5, 2022
Ultimate solution to your KopoKopo needs

ultimate-kopokopo Smith Ultimate Kopokopo PHP SDK This is a module to assist php developers in consuming Kopokopo's API Installation You can install t

Heinrich Smith Ondeyo 2 Nov 9, 2021
S11 Selection est une solution web PHP faite pour automatiser la création d'une grille d'évaluation d'un étudiant puis de les rassembler pour en faire un classement.

[S11] SELECTION BTS 0.1.0 FR Description S11 Selection est une solution web PHP faite pour automatiser la création d'une grille d'évaluation d'un étud

NOIZET Maxence 1 Oct 25, 2022
X1 - A very simple web based note solution that's designed to serve as my second brain.

X1 A very simple web based note solution that's designed to serve as my second brain. Starting Server To start the tool simply clone the repo and then

Joel Dare 118 Dec 28, 2022
meterN is a lightweight set of PHP/JS files that make a " Home energy metering & monitoring " solution.

meterN - Home energy monitor - (PHP/JS Energy Metering & Monitoring) What can meterN do for you ? meterN is a lightweight set of PHP/JS files that mak

Jean-Marc Louviaux 4 Nov 30, 2022
Magento 2 Blog Extension - FREE, fully featured, powerful Blog solution for your online store!

Blog MX | Magento 2 Blog Module by Mirasvit FREE, fully featured, powerful Blog solution for your online store! Magento 2 Blog MX allows you to open a

Mirasvit 71 Dec 7, 2022