LLM-powered Moroccan Darija translation platform with a secured Jakarta REST/Open Liberty backend, Gemini integration, Chrome MV3 side-panel extension, Python/PHP clients, Expo mobile app, and UML architecture docs.
# Darija Translator
Darija Translator is an LLM-powered translation platform for converting text from a source language, such as English, into Moroccan Arabic Dialect (Darija). It combines a secured Jakarta REST backend with a Chrome side-panel extension and multiple client applications, all using the same translation API.
The project demonstrates how to build a practical AI translation service around a clean server-side contract: the browser and clients never own the Gemini key, while the Java backend handles authentication, prompt shaping, LLM calls, validation, and error mapping.
## Highlights
- Java backend built with Jakarta REST, CDI, JSON-B/JSON-P, and Jakarta Security on Open Liberty.
- Secured `POST /translator-service/api/translator/translate` endpoint using HTTP Basic authentication.
- Gemini REST integration through Java `HttpClient`, with configurable model and endpoint.
- Chrome Manifest V3 extension with side panel UI, context-menu translation, automatic selected-text pickup, speech input, and read-aloud support.
- Python CLI client using only the standard library.
- PHP form client for browser-based testing.
- React Native Expo mobile app client.
- Technical UML documentation with visual class and deployment diagrams.
## Architecture
The backend is the trust boundary of the system. It reads `GEMINI_API_KEY` from a local environment file, validates Basic Auth credentials, calls Gemini, and returns a stable JSON response to all clients.
Visual architecture diagrams are available in:
- `docs/class-diagram.svg`
- `docs/deployment-diagram.svg`
- `docs/technical-architecture.md`
## Repository Structure
```text
backend/ Jakarta REST backend on Open Liberty
extension/ Chrome Manifest V3 side-panel extension
python-client/ Standard-library Python CLI client
php-client/ PHP form client
mobile-expo/ React Native Expo mobile client
docs/ Setup notes, cURL examples, Postman collection, UML diagrams
```
## REST API
Base UR …