Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/labasubagia/realworld-backend
Backend implementation of Realworld Application (Medium Clone)
https://github.com/labasubagia/realworld-backend
gin go golang grpc hexagonal-architecture mongodb postgresql
Last synced: 2 months ago
JSON representation
Backend implementation of Realworld Application (Medium Clone)
- Host: GitHub
- URL: https://github.com/labasubagia/realworld-backend
- Owner: labasubagia
- License: mit
- Created: 2023-09-05T03:39:08.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-01-30T23:44:53.000Z (11 months ago)
- Last Synced: 2024-09-30T07:21:33.522Z (3 months ago)
- Topics: gin, go, golang, grpc, hexagonal-architecture, mongodb, postgresql
- Language: Go
- Homepage:
- Size: 329 KB
- Stars: 21
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# ![RealWorld Example App](logo.png)
> ### Golang Hexagonal Architecture codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the [RealWorld](https://github.com/gothinkster/realworld) spec and API.
### [Demo](https://demo.realworld.io/) [RealWorld](https://github.com/gothinkster/realworld)
This codebase was created to demonstrate a fully fledged fullstack application built with Golang including CRUD operations, authentication, routing, pagination, and more.
We've gone to great lengths to adhere to the Golang community styleguides & best practices.
For more information on how to this works with other frontends/backends, head over to the [RealWorld](https://github.com/gothinkster/realworld) repo.
# How it works
![Architecture](architecture.png)
The [hexagonal architecture](https://en.wikipedia.org/wiki/Hexagonal_architecture_(software)) is simply push any external dependency to the edge of the app and keep business logic (service) in the core part. With this architecture we can easily swap external dependencies such as swap restful API to gRPC, mongo to postgres etc.# Getting started
## Prerequisite
- [docker](https://www.docker.com/)
- [docker compose](https://docs.docker.com/compose/)
- [go](https://go.dev/)## Simple Mode
Run default app (rest-api, postgres) (see docker-compose.yaml)
```sh
$ docker compose --profile restful_postgres up -d```
## Development Mode
1. Add environment
```
cp env.example .env
```
1. Run all required external dependency for development (databases)
```sh
$ docker compose up -d
```
1. Run the app
```sh
$ go run main.go server
```
1. (optional) See help of application
```sh
$ go run main.go server --help
```
1. (optional) run app with different dependency
```sh
$ go run main.go server --server grpc --database mongo --log zap
```