Solution architecture
How Ask Ahmed works
A production-minded portfolio assistant: static Next.js on cPanel, an external FastAPI service, hybrid RAG, tools, and bilingual chat UX.
System context
The portfolio stays a static export on Apache/cPanel. The browser calls a separate AI API over HTTPS with SSE. Secrets never ship in frontend JavaScript.
┌─────────────┐ ┌──────────────────┐ ┌────────────────┐
│ Visitor │────▶│ Static Next.js │────▶│ FastAPI AI │
└─────────────┘ │ (cPanel/Apache) │ │ (Contabo VPS) │
└──────────────────┘ └───────┬────────┘
│
┌──────────────────────┼──────────────────────┐
▼ ▼ ▼
┌────────────────┐ ┌────────────────┐ ┌────────────────┐
│ Hybrid RAG │ │ Tools │ │ Groq LLM │
└───────┬────────┘ └────────────────┘ └────────────────┘
▼
┌────────────────┐
│ Knowledge EN/AR│
└────────────────┘Visitor
- Ask Ahmed UI (static)
AI API
- Retrieval + embeddings
- Structured tools
- LLM
- Bilingual knowledge
Retrieval
Knowledge is ingested from structured files, embedded with a multilingual model (or a local fallback), and searched with hybrid vector + keyword ranking. Answers include citations when sources are used.
- Ingest knowledge
- Embed & retrieve
- Ground the answer
- Cite sources
Tool calling
Deterministic tools return verified profile, experience, project, resume, and contact data — including Arabic queries that map to the same resume downloads.
- Profile
- Experience
- Projects
- Skills
- Resumes
- Contact
- Case studies
English & Arabic in the chat
The portfolio site itself stays English. Ask Ahmed supports English and Arabic inside the chat (including RTL), so recruiters and visitors can ask in either language without duplicating the whole website.
Security & cost control
CORS allowlists, rate limits, prompt-injection guards, off-topic refusal, and a daily token budget protect the public endpoint. Groq / OpenAI keys live only on the AI API.
Deployment
Frontend: pnpm build:cpanel → static zip to public_html. Backend: FastAPI on Contabo (systemd + Nginx; Railway remains an alternative) with optional Neon Postgres + pgvector. See docs/architecture/ask-ahmed-implementation.md.
[ Browser / CDN ] → static Next.js export (nemreen.info)
│
└── HTTPS → AI API (NEXT_PUBLIC_AI_API_URL)
├── /v1/session
├── /v1/chat (SSE)
├── /v1/assess-role
└── /v1/suggested-prompts