Giter Site home page Giter Site logo

anonchat's Introduction

Anonchat

A simple websocket chat server/client project.

doc/demo1.png

doc/demo2.png

doc/demo3.png

Suggested architeture if you’re using docker-compose:

+-------------------------+         +-------------------+
|                         |         |                   |
|         server          |         |        proxy      |
|                         |         |                   |
|                    6969 +---------+ 6969         8692 |           client-web
+-------------------------+         |                   +----+---[ http(s)://host/ ]
                                    |                   |    |
                                    |                   |    +---[ ws(s)://host/ws ]
+-------------------------+         |                   |           server
|                         |         |                   |
|       client-web        |         |                   |
|                         |         |                   |              +--------------+
|                      80 +---------+ 7979              |              |              |
+-------------------------+         +-------------------+         []---+  client-cli  |
                                                                       |              |
                                                                       +--------------+

Server / client-web / client-cli can all be used standalone.

Server and client-cli are NodeJS (JS/Typecript) projects.

Client-web is a NodeJS + SolidJS + Vite (JS/Typescript) project.

This chat app features:

  • Customize your nickname
  • Join / Part channels
  • List channels
  • List users inside a channel
  • Talk on channel

You cannot:

  • Almost everything
  • Trust this is safe
  • Trust this is ready

Quick production install / run

To have the app quickly up and running, first go to docker-compose.yml and set the desired environment variables.

Server env vars can be set directly into this file, client-web variables must be created inside client-web/.env. Just copy the .env.example and set your customizations.

Build the app images with:

docker-compose build

Then just start it with:

docker-compose up

You can access the app frontend on http://localhost:8692.

Notice that if serve this port trought another proxy, the environment variable of the web client must contain the final hostname.

Development Mode

Install

Clone this repository.

Make sure you have node 20 installed.

Remove the /client-web/.env file or customize it (all environment vars have working defaults if no env vars are provided).

Inside server run npm install.

Inside client-cli run npm install.

Inside client-web run npm install.

Running

Start the server:

cd server
npm run server:local

You can also start npm run server:local:watch that will reload the server whenever you make changes to the code.

Start the client-cli:

cd client-cli
npm run client:local

There’s also a npm run client:local:watch that auto reloads when you make changes to the client-cli code.

Start the web-client:

cd client-web
npm run start

Notice package.json of each sub-project has its own set of utilities scripts.

Building

If you want generate the artifacts on your own (not automatically with docker-compose).

Server is compiled with npm run server:build, and artifacts are generated into build/src/.

Client-cli is compiled with npm run client:build, and artifacts are generated into build/src/.

Client-web is compiled with npm run build, and artifacts are generated into dist/.

anonchat's People

Contributors

lionyxml avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

jin-mok

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.