# LLM-powered RESTful Web Service for Translation to Moroccan Darija
This university mini project delivers a complete multi-client system that translates text into Moroccan Darija using the **Google Gemini Developer API free tier only**.
## Gemini free-tier choices used in this project
Before implementation, the backend was intentionally fixed to these defaults:
1. **Model:** `gemini-2.5-flash-lite`
2. **API approach:** direct REST call to Google Gemini `generateContent`
3. **Environment variables / config:**
- `GEMINI_API_KEY`
- `GEMINI_MODEL` default: `gemini-2.5-flash-lite`
- `GEMINI_BASE_URL` default: `
generativelanguage.googleap…`
- `APP_BASIC_AUTH_USERNAME` default: `demo`
- `APP_BASIC_AUTH_PASSWORD` default: `demo123`
This choice follows Google's current public Gemini pricing/docs where free-tier Flash-family models are available. Free-tier limits can change, so always verify current Google AI Studio limits.
Source references:
- Gemini Developer API pricing
- Using Gemini API keys
## Architecture and folder tree
```text
.
|-- backend
| |-- pom.xml
| `-- src/main
| |-- java/com/university/darija
| | |-- api/dto
| | |-- api/resource
| | |-- config
| | |-- exception
| | |-- provider
| | |-- security
| | `-- service
| |-- resources/META-INF
| `-- webapp/WEB-INF
|-- chrome-extension
|-- php-client
|-- python-client
|-- react-native-client
`-- docs
```
## Backend architecture
- **Resource layer:** `TranslatorResource`, `HealthResource`
- **Service layer:** `TranslationService`
- **Provider layer:** `TranslationProvider`, `GeminiTranslationProvider`
- **Security layer:** `DemoIdentityStore` with Jakarta Security basic authentication
- **Configuration layer:** `ConfigService`, `microprofile-config.properties`
- **Error handling:** `AppException`, `GlobalExceptionMapper`
- **DTOs:** request/response classes for JSON APIs
## API endpoints
### `POST /api/transl …