Giter Site home page Giter Site logo

clacks's Introduction

Clacks

A quick and easy backend for real-time chat applications.

builds.sr.ht status

Clacks provides

  • A graphql endpoint with subscription support. Clients can connect and be notified of new messages.
  • An api for automatic configuration from another server or backend.
  • Storage for messages, and tracking of message reads
  • Channels for conversations between any number of users.

Clacks is supposed to serve as an intermediate project between Fanout and Mattermost. It provides the backend part of a real-time chat application, which leaving the front-end open for any sort of client. It does not handle user management, channels

Running

Run Clacks quickly and easily with Docker. The Dockerfile included in the repo will build an image.

Clacks requires a database backend. At the moment, the only supported database is Mysql (or Mariadb).

Client port

Graphql clients are expected to connect to the server's client port. This port accepts reqeusts on the /graphql endpoint. Requests should be authorized with the following header:

Authorization: bearer <JWT>

The JWT is in the format:

Header
{
  "alg": "HS256",
  "typ": "JWT"
}

Body

{
  "iss": "APP USER",
  "sub": "USER ID",
  "exp": Unix timestamp,
  "nbf": Unix Timestamp,
  "name": "User's name"
  ...: Optional fields with user info
}

To see the graphql API exposed by Clacks, look at /schema.graphql.

Management Port

The non-realtime portion of an application will likely want to setup user channels, or view data about them. For this reason, a seperate management port with a JSON API allows other servers to send requests to Clacks and update the live configuration.

See /openapi.yml for documentation of this API.

Developing

Here are some steps to get up and running:

  1. Install rust, cargo, mysql dev (build dependency) packages
  2. Start the docker-compose file to run the backend database: docker-compose up -d
  3. Initialize the new database with the diesel cli
  • cargo install diesel
  • diesel database setup --database-url='mysql://diesel::test123@[::1]/chat'
  1. Create your own .env file to configure the application. Start with .env-example
  2. You can use vscode with the included configuration to get debugging support. You will need the following things:
  • The vscode extension vadimcn.vscode-lldb
  • lldb
  1. Run some tests: cargo test, or run the app: cargo run

Clacks is mirrored on both Github and Sourcehut.

clacks's People

Contributors

dieff avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.