A full-stack chat application: users create an account, sign in, chat with an OpenAI model and come back later to their saved conversations.

What it does

How I built it

The Spring Boot back end handles authentication, calls the OpenAI API with the conversation so far, and stores every message in MongoDB. A document database fits chat well: a conversation is a document with an array of messages, read and written as a whole.

The React front end stores the token after sign-in and sends it with every request; the conversation history is loaded from the API. The OpenAI key stays on the server in application.properties, never in the browser.

Docker Compose starts three containers (front end, back end and MongoDB) on a shared network, so the whole stack runs with docker-compose up.