A basic example of microservice architecture which demonstrates communication between a few loosely coupled services.
- Written in Go
- Uses RabbitMQ to communicate between services
- Uses WebSocket to talk to the front end
- Stores data in PostgreSQL
- Uses React for front end development
- Builds and runs with Docker
To run the example, clone the Github repository and start the services using Docker Compose. Once Docker finishes downloading and building images, the front end is accessible by visiting
git clone https://github.com/ebosas/microservices cd microservices
To access the back end service, attach to its docker container from a separate terminal window. Messages from the front end will show up here. Also, standart input will be sent to the front end for two way communication.
docker attach microservices_backend
To inspect the database, launch a new container that will connect to our Postgres database. Then enter the password
demopsw (see the
docker run -it --rm \ --network microservices_network \ postgres:13-alpine \ psql -h postgres -U postgres -d microservices
Select everything from the messages table:
select * from messages;
Access the RabbitMQ management interface by visiting
guest as both username and password.
For development, run the RabbitMQ and Postgres containers with Docker Compose.
docker-compose -f docker-compose-dev.yml up
Generate static web assets for the server service by going to
web/bootstrap and running:
npm run build-server
For React development, run
npm run serve in
web/react and change the script tag in the server's template to the following: