Home

Awesome

Go Report Card

Valkyrie

<p align="center"> <img src="https://harmony-cdn.s3.eu-central-1.amazonaws.com/logo.png"> </p>

A Discord clone using React and Go.

Notes:

Video

https://user-images.githubusercontent.com/38354571/137365365-a7fe91d6-51d7-4739-8742-f68517223f8f.mp4

Features

Stack

Server

Web

For the mobile app using Flutter check out ValkyrieApp


Installation

Server

If you are familiar with make, take a look at the Makefile to quickly setup the following steps or alternatively copy the commands into your CLI.

  1. Install Docker and get the Postgresql and Redis containers (make postgres && make redis)
  2. Start both containers (make start) and create a DB (make createdb)
  3. Install the latest version of Go and get all the dependencies (go mod tidy)
  4. Rename .env.example to .env and fill in the values
  1. Run go run github.com/sentrionic/valkyrie to run the server

Alternatively: If you only want to run the backend without installing Go and all dependencies, you can download the pre compiled server from the Release tab instead. You will still need to follow the above steps 1, 2 and 4.

Web

  1. Install Node 20 or the LTS version of Node.
  2. Install yarn
  3. Run yarn to install the dependencies
  4. Run yarn start to start the client
  5. Go to localhost:3000

Endpoints

Once the server is running go to localhost:<PORT>/swagger/index.html to see all the HTTP endpoints and localhost:<PORT> for all the websockets events.

Tests

All tests are run on all push and pull requests. Only if they are successful it will run the other Github Actions to automatically deploy the updates.

Server

All routes in handler have tests written for them.

Function calls in the service directory that do not just delegate work to the repository have tests written for them.

Run go test -v -cover ./service/... ./handler/... (make test) to run all tests

Additionally this repository includes E2E tests for all successful requests. To run them you have to have Postgres and Redis running in Docker and then run go test github.com/sentrionic/valkyrie (make e2e).

Web

Most useQuery hooks have tests written for them.

To run them use yarn test.

Additionally Cypress is used for E2E testing.

To run them you need to have the server and the client running. After that run yarn cypress to open the test window.

Note: For unkown reasons websockets connection only randomly work during Cypress runs, which makes testing them impossible.

Credits

Ben Awad: The inital project is based on his Slack tutorial series and I always look at his repositories for inspiration.

Jacob Goodwin: This backend is built upon his tutorial series and uses his backend structure.

Jeroen de Kok: The websockets structure is based on his tutorial.

ericellb: His repository helped me implement voice chat.