Doplax.Dev
← Back to projects
ChatGPT Clone

Capabilities

  • Streamed AI
  • Speech and transcription
  • Image generation
  • Local models

Frontend

AngularAngular
TypeScriptTypeScript
TailwindTailwind

Backend

NestJSNestJS
Node.jsNode.js
PostgreSQLPostgreSQL
OpenAIOpenAI
OllamaOllama

ChatGPT Clone

Completed

Full-stack app bundling several AI use cases on a shared backend: spell checking, translation, streamed pros-and-cons discussion, text to speech, audio transcription, image generation and variation, and a conversational assistant with persistent threads. Angular 19 frontend, NestJS backend with PostgreSQL.

The challenge

Putting an OpenAI key in a frontend isn't an option, and every model capability answers differently: JSON, text, a stream, audio or an image. The goal was an architecture where adding a new use case means adding one file, not rewiring half the app.

Implementation

  • The backend is the only thing holding the API key

    NestJS acts as a proxy: the browser never talks to OpenAI directly. Each capability lives isolated in its own use case, so adding one doesn't touch the rest.

  • Token-by-token streaming

    Long answers are relayed to the client as they arrive through a custom pipe over the OpenAI stream, which also shuts down cleanly if the client aborts mid-generation.

  • Multimodal, not just text

    Spelling, translation and pros/cons in text; text to speech and audio transcription with uploads validated by type and size; plus image generation and variation.

  • Assistant with persistent threads

    Alongside completions-based chat, a separate module uses the Assistants API, creating threads that keep conversation context across requests.

  • Swappable provider via Ollama

    The same use cases have an alternative Ollama implementation for running models locally, and a public endpoint reports which providers a given deployment has available.

  • History persisted in PostgreSQL

    Conversations and messages are stored with TypeORM, alongside JWT authentication, email password recovery and the app's own user accounts.

  • Hardened API

    Rate limiting with Throttler, security headers via Helmet, compression, environment validation with Joi at boot and DTOs validated with class-validator.