Skip to content
forked from LionyxML/anonchat

A minimal WebSocket Typescript/Javascript Anonymous chat server/client

License

Notifications You must be signed in to change notification settings

jin-mok/anonchat

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/.

About

A minimal WebSocket Typescript/Javascript Anonymous chat server/client

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 94.0%
  • HTML 3.1%
  • Dockerfile 2.9%