backend

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2024 License: MIT

README ΒΆ

Chatyx Backend

Coverage ci license go-version Go Report Card

πŸ“– 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.

πŸš€ 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 dialogs

Not 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
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://<POSTGRES_USER>:<POSTGRES_PASSWORD>@<POSTGRES_HOST>:<POSTGRES_PORT>/<POSTGRES_DB>?sslmode=disable' up
Manually building from source code
git clone git@github.com:Chatyx/backend.git chatyx-backend && cd chatyx-backend
make build

# Apply migrations
./bin/migrate -path=./db/migrations/ -database 'postgres://<POSTGRES_USER>:<POSTGRES_PASSWORD>@<POSTGRES_HOST>:<POSTGRES_PORT>/<POSTGRES_DB>?sslmode=disable' up

# Run the application
./build/chatyx-backend --config=<PATH_TO_THE_CONFIG>

βš™οΈ Configuration

Basic configuration defined as a single YAML file:

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:

$ ./chatyx-backend --config=<PATH_TO_THE_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 and use MessageCreate to send messages and Message to receive message.

See documentation for more details.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL