LLM-powered RESTful web service for translating English ↔ Moroccan Darija, implemented with JAX-RS, secured with Basic Authentication, with PHP client and Chrome Extension (Manifest V3).
# English ↔ Darija Translator (REST API, PHP Client & Chrome Extension)
This project implements a **secure RESTful web service** for translating text
between **English** and **Moroccan Arabic Dialect (Darija)** using a
**Large Language Model (LLM)**.
It combines:
* A **Java backend API (JAX-RS)**
* A **PHP client**
* A **Chrome Extension (Manifest V3)**
The main goal is to understand how **REST APIs**, **security**, and **multi-client architectures** work together in a real-world project.
---
## Project Goals
This project aims to:
* Learn how to design a **RESTful web service**
* Understand **HTTP communication with JSON**
* Secure endpoints using **Basic Authentication**
* Consume the same API from:
* A web client (PHP)
* A browser extension (Chrome)
* Integrate a **Large Language Model (LLM)** for NLP tasks
---
## Project Structure
```
english-darija-translator-extension/
├── translator-backend/ # Java REST API (JAX-RS)
│ └── src/main/java/com/darija/api/
│ ├── RestApplication.java
│ ├── TranslatorResource.java
│ └── BasicAuthFilter.java
│
├── php-client/ # PHP client
│ └── index.php
│
├── chrome-extension/ # Chrome Extension (Manifest V3)
│ ├── manifest.json
│ ├── sidepanel.html
│ ├── script.js
│ ├── style.css
│ └── content.js
│
├── TEST-Screenshots # cURL & POSTMAN
│
└── README.md
```
---
## Backend – REST API (JAX-RS)
The backend is implemented in **Java using JAX-RS**.
Main components:
* `RestApplication.java`: REST configuration
* `TranslatorResource.java`: Main translation endpoint
* `BasicAuthFilter.java`: Security filter
### Example Endpoints
* `GET /api/translator/ping`
Used to test if the service is alive.
* `POST /api/translator/translate`
Accepts JSON input and returns translated text.
All communication uses **JSON over HTTP**.
---
## LLM Integration
The translation is performed using a **Large Language Model (LLM)** via an external API (Gem …