A full-stack AI assistant application that provides intelligent chat conversations, image generation, and voice input capabilities. Built with Spring Boot backend and Next.js frontend, powered by Azure OpenAI services.
- AI Chat: Engage in intelligent conversations with AI assistant
- Image Generation: Create images from text descriptions using AI
- Voice Input: Record audio and transcribe it to text using speech-to-text
- File Upload: Upload PDF documents for context-aware conversations (RAG)
- Vector Search: Store and search document embeddings using pgvector
- Real-time Chat Interface: Modern, responsive UI with message history
- Voice Recording: Browser-based audio recording with visual feedback
- File Attachments: Support for PDF uploads in chat
- Image Download: Generated images can be downloaded or viewed
- Responsive Design: Works on desktop and mobile devices
- Java 25 - Programming language
- Spring Boot 3.5.7 - Web framework
- Spring AI 1.0.3 - AI integration framework
- Azure OpenAI - AI models for chat, image generation, and transcription
- PostgreSQL + pgvector - Vector database for document embeddings
- Gradle - Build tool
- SpringDoc OpenAPI - API documentation
- Next.js 16 - React framework
- TypeScript - Type-safe JavaScript
- Tailwind CSS - Utility-first CSS framework
- Shadcn UI - Accessible UI components
- Zustand - State management
- Lucide React - Icon library
- Docker Compose - Container orchestration for PostgreSQL
- pgvector - PostgreSQL extension for vector operations
Before running this application, make sure you have the following installed:
- Java 25
- Node.js 18+
- PostgreSQL 15+ with pgvector extension
- Azure OpenAI Account
git clone https://github.com/Meet-08/chatgpt-clone-spring-ai.git
cd chatgpt-clone-spring-aicd chatgpt-clone-backend
# Build the application
./gradlew build
# Start PostgreSQL with pgvector using Docker Compose
docker-compose up -d
# Run the Spring Boot application
./gradlew bootRunThe backend will start on http://localhost:8080
cd ../chatgpt-ui
# Install dependencies
pnpm install
# Start the development server
pnpm devThe frontend will start on http://localhost:3000
The application uses PostgreSQL with the following default settings (configured in application.yml):
- Host: localhost
- Port: 5432
- Database: chatgpt_clone
- Username: meet
- Password: 1234
To change these settings, modify src/main/resources/application.yml:
spring:
datasource:
url: jdbc:postgresql://localhost:5432/your_database
username: your_username
password: your_passwordConfigure your Azure OpenAI deployments in application.yml:
spring:
ai:
azure:
openai:
api-key: ${AZURE_OPENAI_API_KEY}
endpoint: ${AZURE_OPENAI_ENDPOINT}
chat:
options:
deployment-name: your-chat-deployment
temperature: 1
image:
options:
deployment-name: your-image-deployment
audio:
transcription:
options:
deployment-name: your-whisper-deployment- POST
/api/v1/chat/message- Send a chat message with optional file attachments
- Body:
FormDatawithquery(string) andfiles(multipart files)
- POST
/api/v1/image/generate?prompt={prompt}- Generate an image from text description
- Query Parameter:
prompt(string)
- POST
/api/v1/audio/transcribe- Transcribe audio file to text
- Body:
FormDatawithaudioFile(multipart file)
- Navigate to the chat page from the home screen
- Type your message in the text area
- Optionally attach PDF files for context
- Use voice recording for hands-free input
- Press Enter or click Send to get AI response
- Go to the "Create Image" page
- Enter a detailed description of the image you want
- Use voice recording to dictate your prompt
- Click "Generate Image" to create the image
- Download or view the generated image
- Click the microphone button to start recording
- Speak clearly into your microphone
- Click stop when finished
- The transcribed text will be added to your current prompt
chatgpt-clone/
βββ chatgpt-clone-backend/ # Spring Boot backend
β βββ src/main/java/com/meet/chatgpt/
β β βββ ChatgptCloneBackendApplication.java
β β βββ config/
β β β βββ ChatClientConfig.java
β β βββ controller/
β β β βββ AudioController.java
β β β βββ ChatController.java
β β β βββ ImageController.java
β β βββ service/
β β βββ AudioService.java
β β βββ ChatService.java
β β βββ ImageService.java
β βββ src/main/resources/
β β βββ application.yml
β β βββ init/schema.sql
β βββ build.gradle
β βββ compose.yaml
βββ chatgpt-ui/ # Next.js frontend
βββ app/
β βββ layout.tsx
β βββ page.tsx
β βββ chat/page.tsx
β βββ create-image/page.tsx
β βββ api/ # API routes (if any)
β βββ store/uiStore.ts
βββ components/ui/ # Reusable UI components
βββ lib/utils.ts
βββ package.json
βββ tsconfig.json
The Spring Boot application can be deployed as a JAR file:
./gradlew bootJar
java -jar build/libs/chatgpt-clone-backend-0.0.1-SNAPSHOT.jarBuild the Next.js application for production:
pnpm build
pnpm startFor Vercel deployment:
pnpm build- Spring AI for AI integration
- Azure OpenAI for AI models
- pgvector for vector database functionality
- Next.js for the React framework
- Tailwind CSS for styling
- Shadcn UI for accessible components
If you have any questions or need help, please open an issue on GitHub
Note: This application requires valid Azure OpenAI API keys and a running PostgreSQL instance with pgvector extension to function properly.