Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chatyx/backend
Simple, powerful and scalable chat backend in Go
https://github.com/chatyx/backend
go golang postgres postgresql redis rest-api websocket
Last synced: 29 days ago
JSON representation
Simple, powerful and scalable chat backend in Go
- Host: GitHub
- URL: https://github.com/chatyx/backend
- Owner: Chatyx
- License: mit
- Created: 2021-09-20T09:02:36.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-02-04T09:26:52.000Z (9 months ago)
- Last Synced: 2024-09-28T05:02:22.404Z (about 1 month ago)
- Topics: go, golang, postgres, postgresql, redis, rest-api, websocket
- Language: Go
- Homepage:
- Size: 665 KB
- Stars: 10
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Chatyx Backend
![Coverage](https://img.shields.io/badge/Coverage-70.7%25-brightgreen)
![ci](https://github.com/Chatyx/backend/actions/workflows/release.yml/badge.svg)
![license](https://img.shields.io/github/license/Chatyx/backend)
![go-version](https://img.shields.io/github/go-mod/go-version/Chatyx/backend)
[![Go Report Card](https://goreportcard.com/badge/github.com/Chatyx/backend)](https://goreportcard.com/report/github.com/Chatyx/backend)## 📖 Description
Chatyx backend is an MVP monolith message service implemented in Go. The project will evolve
towards a microservice architecture. The target design is described in [this page](./docs/system_design/README.md).## 🚀 Features
Already done:
* ✅ Support groups and dialogs
* ✅ Support for sending text messages both via REST and Websocket
* ✅ Add and remove participants for group chats
* ✅ Participants can leave from group chats
* ✅ Block partners in dialogsNot done yet:
* ❌ Support uploading images
* ❌ View unread messages
* ❌ Show online/offline statuses of users, as well as when the user was last online
* ❌ Notifications if user isn't online
* ❌ Support cross-device synchronization## 🔧 Installation
### Using single docker container
```bash
docker run --rm --volume=$(PWD)/configs:/chatyx-backend/configs \
--publish=8080:8080 --publish=8081:8081 --detach \
--name=chatyx-backend mortalis/chatyx-backend:latest# Apply migrations
docker exec chatyx-backend ./migrate -path=./db/migrations/ -database 'postgres://:@:/?sslmode=disable' up
```### Manually building from source code
```bash
git clone [email protected]:Chatyx/backend.git chatyx-backend && cd chatyx-backend
make build# Apply migrations
./bin/migrate -path=./db/migrations/ -database 'postgres://:@:/?sslmode=disable' up# Run the application
./build/chatyx-backend --config=
```## ⚙️ Configuration
Basic configuration defined as a single [YAML file](./configs/config.yaml):
You can configure part of parameters with environment variables like these:
`POSTGRES_USER`, `POSTGRES_PASSWORD`, etc. The full list of supported environment variables
are described in a config file after comment prefix `# env: `.To run the application with substituted config you should perform:
```bash
$ ./chatyx-backend --config=
```## 📈 How to use
After running the application you can use REST API for creating groups and dialogs, adding participants
sending messages and so on. See swagger documentation `http://localhost:8080/swagger` for more details.Also, available to you WebSocket API for sending and receiving messages in the real time.
(by default at `ws://localhost:8081`). For getting that you should generate code for your
language from [proto file](./internal/transport/websocket/model/message.proto) and use `MessageCreate` to
send messages and `Message` to receive message.See [documentation](https://developers.google.com/protocol-buffers) for more details.