/logity

🌐📱 Minimalistic social network.

Primary LanguageGo


logity


Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contact

About The Project

Backend service for minimalistic social network logity. A user in logity communicates with others using chat rooms, each user can send a log (analogue of a message in social networks). Each log can contain a photo, text or picture.

Feature

  • Authentication / Authorization User with using JWT tokens and Postgresql.
  • Maintain relationships between users and manage their chat rooms Neo4j.
  • Real-time messaging management using Websocket and Centrifugo.

Built With

Go JWT Postgres Neo4j

Getting Started

Environment logity

  1. Create file dev.env from template.env and fill variables with your values
    • YOUR_POSTGRES_USERNAME, YOUR_POSTGRES_PASSWORD - postgres credentials, which you specify in environment postgres docker container.
    • YOUR_LOGITY_USERNAME, YOUR_LOGITY_PASSWORD - specify user credentials for neo4j-database logity.
    • YOUR_CENTRIFUGO_API_KEY - the api key by which logity to access centrifugo.
    • YOUR_CENTRIFUGO_SECRET_KEY - the secret key which logity will sign the client's JWT tokens for access to the centrifugo.
    • YOUR_SECRET_ACCESS_KEY - the secret key which logity will sign access tokens.
    • YOUR_SECRET_REFRESH_KEY - the secret key which logity will sign refresh tokens.
  2. To run locally without container, we recommended create another one file local.env.

Centrifugo

  1. Create file config.json from exports/template_config.json and fill variables with your values
    • YOUR_CENTRIFUGO_SECRET_KEY - the secret key which centrifugo will verify client's JWT tokens. Must be equal logity environment variable YOUR_CENTRIFUGO_SECRET_KEY
    • YOUR_CENTRIFUGO_API_KEY - the api key which centrifugo will verify service's JWT token. Must be equal logity environment variable YOUR_CENTRIFUGO_API_KEY.
    • YOUR_ADMIN_PASSWORD, YOUR_ADMIN_SECRET - admin credentials.
  2. Property token_issuer must be equal env variable APP_NAME.

Neo4j

  1. Run the docker-container with neo4j: docker-compose up neo4j --build
  2. Go to http://localhost:7474/browser/.
  3. Authenticate with neo4j / testify.
  4. In command line CREATE DATABASE logity; and :use logity
  5. Create user with role architect using :server user add and check it using :server user list

Run

  1. Run the docker-containers: docker-compose up --build
  2. Neo4j UI: http://localhost:7474/browser/.
  3. Centrifugo admin panel: http://localhost:9123/.
  4. If liquibase containers fail, try running them later. If successful, then postgres or neo4j did not have time to start to run.

Usage

REST API

logity has a REST API.

  1. OpenApi docs: http://localhost:8080/swagger/index.html.
  2. The postman v2.1 collection is also stored in the scripts/postman folder.

Log Client

To test the operation of real-time messages, you can use a simple go-client that uses the centrifugo API.

  1. Go to scripts/client/client.go
  2. SignIn by route http://<<**host**>>/auth/sign-in and copy
  3. From response copy rtc_token into const Token = <TOKEN>
  4. Run client.go
  5. Update subscribes using http://<<**host**>>/op/update-subscribes

Roadmap

  • Transactions Manager. Need to manage transactions from many sources(neo4j postgres).
  • Role model.
  • Logging, Tracing.

Contact

Your Name - @Tobiska - tobiskaKirill@gmail.com

Project Link: https://github.com/Tobiska/logity

(back to top)