Secure RESTful web service for translating English to Moroccan Arabic (Darija) using Google Gemini, with multiple client implementations.
# English → Darija Translator (RESTful Web Service)
This project demonstrates the design and usage of a secure **RESTful web service** that translates text from **English** to **Moroccan Arabic dialect (Darija)** using a **Large Language Model (Google Gemini)**.
The primary objective is to understand how **REST APIs operate**, how they are **secured**, and how they can be **consumed by different types of client applications**.
---
## Project Objective
The objectives of this project are to:
- Understand the principles of **RESTful web services**
- Learn how clients interact with a REST API using **HTTP and JSON**
- Secure a REST endpoint using **Basic Authentication**
- Test a REST API using professional tools
- Consume the same REST service from different client platforms
---
## Project Structure
App_Darija_Translator/
├── backend/ # Java REST API (JAX-RS)
│ └── darija-translator/
│ └── src/main/java/my/project/translator/
│ ├── JaxrsApplication.java
│ ├── TranslatorResource.java
│ ├── CorsFilter.java
│ ├── dto/
│ │ ├── TranslateRequest.java
│ │ └── TranslateResponse.java
│ ├── llm/
│ │ └── GeminiClient.java
│ └── security/
│ └── InMemoryIdentityStore.java
│
├── php-client/ # PHP client application
├── chrome-extension/ # Chrome Extension (Manifest V3)
├── docs/
│ └── screenshots/ # Test and demo screenshots
└── README.md
---
## Backend – REST API (JAX-RS)
- **Technology**: Java, Jakarta EE, JAX-RS
- **Main resource**: TranslatorResource
### Endpoints
- `GET /api/translator/ping`
- `POST /api/translator/translate`
The REST service receives input data in **JSON format** and returns the translation as **JSON output**.
---
## LLM Integration
The translation task is performed using the **Google Gemini API**.
A clear prompt is sent to the language model to translate English tex …