Skip to content

This application is a Chatbot that uses the OpenAI API to maintain a conversation, it has an interface similar to ChatGPT itself

License

Notifications You must be signed in to change notification settings

Sup3r-Us3r/chatbot-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chatbot App

Chatbot App Preview

Overview

This application is a Chatbot that uses the OpenAI API to maintain a conversation, it has an interface similar to ChatGPT itself.

chatbot-demo.mov

Project Architecture Overview

Project Architecture Overview

Project Architecture (Next.js Deeper Look)

Project Architecture Next.js Deeper Look

gRPC and Streams

gRPC and Streams

Chat Front-end

  • Next.js
  • BFF (Route Handlers)
  • SES
  • gRPC Client
  • MySQL
  • Prisma
  • SWR
  • Next Auth
  • Keycloak
  • Tailwindcss
  • Docker + Docker Compose

Chat Microservice

  • Golang
  • MySQL
  • SQLC
  • Go Chi
  • Go OpenAI
  • gRPC Server Stream
  • REST API
  • Docker + Docker Compose

Setup app

Chat Microservice

Access the folder:

$ cd chat-service

Create .env file:

$ cp .env.example .env

Update the variable values as needed.

Create OpenAI Secret Key and update the variable below:

OPENAI_API_KEY="PASTE THE OPENAI SECRET KEY VALUE"

Chat Front-end

Access the folder:

$ cd chat

Create .env file:

$ cp .env.example .env

Update the variable values as needed.

Configure /etc/hosts:

# Mac and Linux
# /etc/hosts

# Windows
# C:\Windows\System32\drivers\etc\hosts

127.0.0.1 host.docker.internal

Keycloak settings

Access Keycloak Administration Console

Username: admin

Password: admin

http://host.docker.internal:9000

Create Realm:

Realm name: chat-app

Enabled: yes

create-realm

Create User:

This user will be used for you to access app, so define as you wish the name, email, etc.

After create user, go to Credentials tab and set a new password, unchecked temporary option.

create-user

Create Client:

ClientID: nextjs

Valid redirect URIs: http://localhost:3000/*

Web origins: http://localhost:3000/*

Client authentication: On

Authentication flow: Standard flow and Direct access grants

create-client

After create client, go to Credentials tab and copy Client secret value and add in the .env file:

KEYCLOAK_CLIENT_SECRET="PASTE THE CLIENT SECRET VALUE"

Run app

Chat Microservice

Up Container:

$ docker-compose up -d

Access container:

$ docker exec -it chatservice_app /bin/bash

Install dependencies:

$ go mod tidy

Run migrations:

$ make migrate

Run microservice:

$ go run cmd/chatservice/main.go

Chat Front-end:

Up Container:

$ docker-compose up -d

Access container:

$ docker exec -it chat_app /bin/bash

Install dependencies:

$ npm install

Run migrations:

$ npx prisma migrate dev

Run front-end:

$ npm run dev

About

This application is a Chatbot that uses the OpenAI API to maintain a conversation, it has an interface similar to ChatGPT itself

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published