One of the clearest ways to separate a real engineering internship from a passive tutorial is to look at the architectural patterns you are required to implement. In DBERT's AI Agent & LLM and Full-Stack sprints, fellows build three foundational production patterns: Hybrid RAG, Multi-Tenant SaaS, and OWASP-Hardened Authentication.
Here is the practical engineering blueprint for implementing all three cleanly.
1. How to Build a Hybrid RAG Retrieval Pipeline
Basic RAG tutorials embed a PDF into a vector store and call top_k=4. In production, that fails on exact identifiers (like CERT-DBERT-2026-DA-057, error codes, or Indian statutory clauses).
The 3-Stage Hybrid Retrieval Flow 1. Sparse Search (BM25 / Postgres `tsvector`): Captures exact keyword and ID matches. 2. Dense Vector Search (`pgvector` / Qdrant): Captures semantic intent and paraphrased queries. 3. Reciprocal Rank Fusion (RRF) + Reranking: Merges both candidate lists using:
def reciprocal_rank_fusion(bm25_ids: list[str], vector_ids: list[str], k: int = 60) -> list[str]:
scores: dict[str, float] = {}
for rank, doc_id in enumerate(bm25_ids):
scores[doc_id] = scores.get(doc_id, 0.0) + 1.0 / (k + rank + 1)
for rank, doc_id in enumerate(vector_ids):
scores[doc_id] = scores.get(doc_id, 0.0) + 1.0 / (k + rank + 1)
return [doc_id for doc_id, _ in sorted(scores.items(), key=lambda x: x[1], reverse=True)]Pair this with a cross-encoder reranker on the top 15 fused chunks before passing the top 4–5 chunks to your LLM context window.
2. How to Architect Multi-Tenant SaaS APIs Safely
In multi-tenant SaaS, a single missed WHERE tenant_id = $1 clause causes a cross-customer data breach.
- Extract `tenant_id` from verified JWT/session context, never from an untrusted request body or query parameter.
- Enable PostgreSQL Row-Level Security (RLS) on shared tables so the database engine itself enforces tenant isolation:
ALTER TABLE project_documents ENABLE ROW LEVEL SECURITY;CREATE POLICY tenant_isolation_policy ON project_documents USING (tenant_id = current_setting('app.current_tenant_id')::uuid); ```
- Index composite keys `(tenant_id, created_at DESC)` so tenant dashboards remain fast under concurrent load.
3. How to Harden JWT, OAuth2 & OWASP Security
Every authentication PR reviewed by DBERT mentors is audited against a strict security checklist:
- JWT Hygiene: Keep access tokens short-lived (15 minutes), store refresh tokens in
HttpOnly,Secure,SameSite=Laxcookies, and implement token family revocation on reuse detection. - OAuth2 PKCE: Always validate the cryptographic
stateparameter to prevent login CSRF, and use PKCE (code_verifier/code_challenge) for public or SPA clients. - OWASP Top 10 Guardrails:
- - Broken Object-Level Authorization (BOLA): Verify resource ownership on every
GET / PATCH / DELETEroute. - - Rate Limiting: Apply sliding-window rate limits (e.g., Redis) on
/login,/otp, and/api/enroll/*endpoints. - - Input Validation: Enforce strict Zod or Pydantic schemas at the API boundary.
Want to Ship These Patterns in a Reviewed Production Repo? (₹1,999 Incubation)
Implement Hybrid RAG, PostgreSQL RLS, and OWASP-hardened auth with 1:1 senior mentor code reviews in DBERT's 8-week Technical Incubation:
| ✅ Tiered Value Ladder | 📌 Detail |
|---|---|
| 1. Verified Certificate | Cryptographic 3-doc packet with Turnitin originality seal (< 3%) on /verify |
| 2. ₹5,000+ Stipend Unlock | Released at Gate 1 on completing 3 approved production PRs & >=75% attendance |
| 3. 100% Placement Assistance | Direct Round-1 screening waiver + featured Tab 1 placement on /verify/directory |
Already paid the ₹499 caution deposit? Your deposit is credited in full — only ₹1,500 balance is due.
👉 [Complete Enrollment → dbert.in/enroll/1999](/enroll/1999)