REST API Chat (Clean Architecture)

Entities:

  • User
  • Chat
  • Message

Docker Compose


Start APi with PostgreSQL
BridgeNetworking: API, PostgreSQL
HostNetworking: API on 0.0.0.0:5000

docker compose up -d

Start API with MySQL
BridgeNetworking: API, MySQL
HostNetworking: API on 0.0.0.0:5000

docker compose -f docker-compose.mysql.yml up -d

Start API with frontend
(This frontend does not fully implement the capabilities of the backend and serves as an example)
BridgeNetworking: Frontend, API, PostgreSQL
HostNetworking: Frontend on 0.0.0.0:8080

docker compose up -f docker-compose.psql.front.yml up -d

Docker Development Build

Statrt PostgreSQL

docker run --name postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres -e POSTGRES_DB=api_chat_db -p 5433:5432 -d postgres:15

Start MySQL

docker run --name mysql -e MYSQL_ROOT_PASSWORD=root -e MYSQL_PASSWORD=mysql -e MYSQL_USER=mysql -e MYSQL_DATABASE=api_chat_db -p 3305:3306 -d mysql:8

Build API

docker build -t api_chat:v1.0.0 .

Build Frontend

docker build -t front_chat:v1.0.0 ./front_example/.

Generate certificate

git clone https://github.com/redrockstyle/api_chat_golang.git
cd api_chat_golang/certs
chmod +x gen_localhost.sh
./gen_localhost.sh