Building a Singaporean LegalTech Platform with RAG: Lessons
Key takeaways
- RAG architecture provides accurate, source‑grounded answers essential for legaltech.
- User feedback, even negative, is invaluable for prioritizing product improvements.
- Performance optimizations—streaming APIs and edge caching—are crucial for mobile usability.
- Transparent citations and clear error handling build trust in high‑risk applications.
- Adopting established design guidelines (Apple HIG) elevates perceived quality across devices.
When I first announced Explore Singapore on Hacker News under the title “Show HN: After a lot of backlash I fixed and built it,” the response was a mix of curiosity and harsh criticism. Users questioned the feasibility of a Singapore‑focused legaltech solution, the choice of a RAG (Retrieval‑Augmented Generation) architecture, and the ambition to deliver an Apple‑like UI on both mobile and desktop. Rather than dismiss the feedback, I treated it as a roadmap for improvement.
---
1️⃣ Understanding the Problem Space
Singapore’s legal landscape is highly regulated, with statutes, case law, and regulatory guidance spread across multiple government portals. For citizens and businesses, navigating this information can be daunting. The goal of Explore Singapore is simple yet ambitious: provide instant, context‑aware answers to legal queries while maintaining the aesthetic elegance of Apple’s design language.
Key requirements emerged from the community discussion:
- Accuracy – Answers must be grounded in official sources. - Speed – Users expect near‑instant responses on mobile networks. - Responsiveness – The UI should feel native on iOS, Android, and desktop browsers. - Transparency – Show users the source documents behind each answer.
---
2️⃣ Choosing Retrieval‑Augmented Generation (RAG)
RAG combines the best of two worlds: a vector store for fast similarity search and a large language model (LLM) for natural language generation. This architecture satisfies the need for both accuracy (by grounding answers in retrieved documents) and fluency (by letting the LLM craft readable responses).
How It Works in Explore Singapore
1. Document Ingestion – PDFs, HTML pages, and CSVs from Singapore’s Ministry of Law, the Courts, and the Accounting and Corporate Regulatory Authority are scraped and chunked into 500‑token segments. 2. Embedding Generation – Each chunk is converted into a dense vector using OpenAI’s text‑embedding‑ada‑002 model. 3. Vector Store – Vectors are stored in Pinecone, enabling sub‑second similarity search. 4. Query Flow – When a user asks a question, the query is embedded, the top‑k most relevant chunks are fetched, and the LLM (GPT‑4‑Turbo) generates an answer, citing the source URLs.
This pipeline ensures that the model never hallucinates facts; it always references a concrete document.
---
3️⃣ Crafting an Apple‑Inspired UI
Design was the second major pain point highlighted by the community. Many felt the initial prototype looked generic. I decided to adopt the Apple Human Interface Guidelines as a visual north star, focusing on:
- Clean typography – San Francisco font family for iOS/macOS, system‑fallback fonts for other platforms. - Whitespace – Generous margins to improve readability on small screens. - Micro‑interactions – Subtle haptic feedback on button taps and smooth transitions between pages.
Technical Stack for the Frontend
| Layer | Technology | Reason | |-------|------------|--------| | Framework | Next.js 14 (React) | Server‑side rendering for SEO and fast first paint | | Styling | Tailwind CSS + Headless UI | Utility‑first approach for rapid iteration | | Animations | Framer Motion | Declarative, performant animations | | Deployment | Vercel (edge network) | Near‑global CDN, zero‑config builds |
The result is a responsive web app that feels at home on iPhone Safari, Android Chrome, and desktop browsers alike. The URL https://exploresingapore.vercel.app/ showcases the final product.
---
4️⃣ Overcoming the Backlash: What I Fixed
| Issue | Original State | Fix Implemented | |-------|----------------|-----------------| | Data freshness | Static snapshot of statutes (updated yearly) | Added a GitHub Actions workflow that re‑scrapes government sites weekly and updates the Pinecone index. | | Latency | 3‑4 seconds per query on 4G | Switched to OpenAI’s streaming API and enabled edge‑caching of retrieval results, dropping average latency to ~1.2 seconds. | | Citation clarity | Bare URLs at the bottom of the answer | Implemented a collapsible citation panel with preview snippets, improving transparency. | | Mobile ergonomics | Tiny tap targets, cramped layout | Refactored UI with larger touch targets (44 px minimum) and a bottom navigation bar for quick access. | | Error handling | Generic “Something went wrong” toast | Added granular error messages (e.g., “Unable to fetch latest statutes – please try again later.”) and a retry button. |
Each fix was directly inspired by a comment on the original Show HN post, turning community critique into concrete improvements.
---
5️⃣ Lessons Learned & Best Practices
1. Embrace Early Feedback – The initial backlash was a goldmine of user expectations. Listening early prevents costly redesigns later. 2. Ground LLMs in Real Data – RAG mitigates hallucination, a critical requirement for legal advice. 3. Prioritize Performance on Mobile – Legal queries are often time‑sensitive; sub‑second latency can be a differentiator. 4. Design for Trust – Transparent citations and clear error states build user confidence, especially in high‑stakes domains. 5. Iterate with CI/CD – Automated data pipelines and continuous deployment keep the product fresh without manual intervention.
---
6️⃣ Looking Ahead
The journey is far from over. Upcoming milestones include:
- Multilingual support (English, Mandarin, Malay, Tamil) to serve Singapore’s diverse population. - Integration with the SingPass** API for personalized legal checklists. - Community‑driven knowledge base where lawyers can contribute curated annotations. - Open‑source SDK so other jurisdictions can replicate the model.
If you’re interested in contributing, the code lives on GitHub at adityaprasad-sudo/ExploreSingapore. Feel free to open issues, submit pull requests, or simply try the demo.
---
Explore Singapore demonstrates that even a project born under fire can evolve into a polished, user‑centric platform when you combine technical rigor, design empathy, and community collaboration.
---
Happy exploring!
Sources: https://github.com/adityaprasad-sudo/ExploreSingapore