Ai chatbot for civic edAi chatbot for civic education on the laws of South Sudan education on the laws of South Sudan.
# Digital Muolana — LegalBuddy South Sudan
Free, instant legal information from South Sudan law. Ask any question, get a cited answer, connect with a verified lawyer.
---
## Tech stack
| Layer | Technology |
|---|---|
| Runtime | Java 25, Spring Boot 4.0.7 |
| AI / RAG | Spring AI 2.0.0 — Gemini, Claude, or GPT-4o (switchable) |
| Vector store | PostgreSQL + pgvector (`gemini-embedding-001`, 1536 dims) |
| Database | PostgreSQL, Flyway migrations |
| Frontend | Thymeleaf, vanilla JS, SSE streaming |
| Auth | Spring Security, JWT (RSA-256), refresh tokens |
---
## Prerequisites
- Java 25+
- Maven 3.9+
- PostgreSQL 15+ with the pgvector extension
- An API key for at least one AI provider (Gemini, Anthropic, or OpenAI)
---
## Local setup
### 1. Clone and configure
```bash
git clone
cd muolana
```
Copy the environment template and fill in your values:
```bash
cp .env.example .env
```
### 2. Enable pgvector
Connect to your PostgreSQL instance and run:
```sql
CREATE EXTENSION IF NOT EXISTS vector;
```
Flyway handles the rest of the schema on first boot.
### 3. Generate RSA keys for JWT
The keys are **not** in the repository. Generate them once locally:
```bash
mkdir -p src/main/resources/certs
openssl genrsa -out src/main/resources/certs/private.pem 2048
openssl rsa -in src/main/resources/certs/private.pem \
-pubout -out src/main/resources/certs/public.pem
```
### 4. Set environment variables
Minimum required:
| Variable | Default | Description |
|---|---|---|
| `AI_PROVIDER` | `gemini` | Active LLM profile: `gemini`, `anthropic`, or `openai` |
| `GEMINI_API_KEY` | — | Required when `AI_PROVIDER=gemini` |
| `ANTHROPIC_API_KEY` | — | Required when `AI_PROVIDER=anthropic` |
| `OPENAI_API_KEY` | — | Required when `AI_PROVIDER=openai` |
| `SPRING_DATASOURCE_URL` | `jdbc:postgresql://localhost:5432/postgres` | PostgreSQL URL |
| `SPRING_DATASOURCE_USERNAME` | `postgres` | |
| `SPRING_DATASOURCE_PASSWORD` | `postgres` | |
| `ADMIN_EMAIL` | `admin@muolana …