Skip to content

anastr0/comlink

Repository files navigation

comlink

A real time messaging API

https://starwars.fandom.com/wiki/C1_personal_comlink

https://starwars.fandom.com/wiki/C1_personal_comlink/Legends

Run in local

Run postgres db and kafka

docker-compose up -d

To run API

go run main.go

To run worker service (consumer)

go run worker/main.go

Test

post messages

curl -s -X POST http://localhost:8080/message \
    -H 'content-type: application/json' \
    -d '{"content": "hi", "sender": 5, "receiver": 6}' | jq

curl -s -X POST http://localhost:8080/message \
    -H 'content-type: application/json' \
    -d '{"content": "how are you?", "sender": 5, "receiver": 6}' | jq

curl -s -X POST http://localhost:8080/message \
    -H 'content-type: application/json' \
    -d '{"content": "All good. How about you?", "sender": 6, "receiver": 5}' | jq

curl -s -X POST http://localhost:8080/message \
    -H 'content-type: application/json' \
    -d '{"content": "Same here", "sender": 5, "receiver": 6}' | jq

retrieve conversation

curl -X GET "http://localhost:8080/message?user1=5&user2=6" | jq

mark message read

curl -s -X PATCH http://localhost:8080/message/:id/read | jq

phase 2 roadmap

  1. Add client - react
  2. QR code - 1 to 1 conversations
  3. websocket chat in client
  4. encryption
  5. docker - run api and worker process

About

API for a real-time messaging platform. Stores messages asynchronously in db.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published