Table of Contents
Overview
Tenu Chat is a simple chat application where you can talk to a custom-trained AI bot in real time. It features streaming responses, markdown rendering, bilingual support (English/Spanish), dark/light mode, and a responsive layout that works on both mobile and desktop.
Note: The app is hosted on Render’s free tier, if it’s been inactive, the server may take a moment to spin up. Give it a few seconds and the page will load.
Key Features
- Streaming Responses: AI tokens appear in real time as they’re generated via Server-Sent Events (SSE).
- Secure Proxy Architecture: API keys, system prompts, and model names are injected server-side — never exposed to the browser bundle.
- Markdown Rendering: Assistant messages support rich formatting (headings, lists, code blocks, links) with sanitized link protocols.
- Bilingual Support: Full UI translation between English and Spanish via a custom lightweight i18n layer.
- Dark/Light Mode: Toggle via header button with a custom brand accent color and Inter font typography.
- Responsive Design: Layout adapts at all breakpoints; sidebar collapses gracefully on smaller screens.
- Security First: Helmet headers, rate limiting (20 req/min), body size limits, error masking, and no data persistence.
Role
Lead Developer
Goal
- Build a clean, minimalist AI chat app with real-time streaming responses.
- Demonstrate a secure server-proxy pattern where the client never touches sensitive data.
- Deliver a polished, bilingual, responsive UI that works seamlessly across mobile and desktop.
Challenges and Learnings
- SSE Streaming: Implementing an async generator pattern to parse SSE streams token-by-token from OpenRouter through the Express proxy to the client.
- Security Architecture: Designing the proxy so API keys, system prompts, and model names are injected server-side, with rate limiting, Helmet headers, and error masking to prevent data leakage.
- Smart Auto-Scroll: Tracking whether the user has scrolled up and only auto-scrolling if they’re near the bottom, avoiding the frustrating behavior of being scrolled down while reading.
- Lightweight i18n: Building a typed dictionary-based translation system instead of pulling in a full i18n library, keeping the bundle small with full TypeScript safety.
Final Thoughts
- Security by Design: Keeping sensitive data server-side from the start is far easier than retrofitting it — the proxy pattern should be the default for any AI chat app.
- Clean UX Matters: Streaming responses, smart auto-scroll, and a minimalist UI make the chat feel fast and natural, which is what users expect from modern AI tools.