A Discord clone using React and Go.
Notes:
For the mobile app using Flutter check out ValkyrieApp
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.
make postgres
&& make redis
)make start
) and create a DB (make createdb
)go mod tidy
).env.example
to .env
and fill in the valuesRequired
PORT=4000
DATABASE_URL=postgresql://<username>:<password>@localhost:5432/valkyrie
REDIS_URL=redis://localhost:6379
CORS_ORIGIN=http://localhost:3000
SECRET=SUPERSECRET
HANDLER_TIMEOUT=5
MAX_BODY_BYTES=4194304 # 4MB in Bytes = 4 * 1024 * 1024
Optional: Not needed to run the app, but you won't be able to upload files or send emails.
AWS_ACCESS_KEY=ACCESS_KEY
AWS_SECRET_ACCESS_KEY=SECRET_ACCESS_KEY
AWS_STORAGE_BUCKET_NAME=STORAGE_BUCKET_NAME
AWS_S3_REGION=S3_REGION
GMAIL_USER=GMAIL_USER
GMAIL_PASSWORD=GMAIL_PASSWORD
go run github.com/sentrionic/valkyrie
to run the serverAlternatively: 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.
yarn
to install the dependenciesyarn start
to start the clientlocalhost:3000
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.
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.
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
).
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.
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.