An open API service indexing awesome lists of open source software.

https://github.com/mediacomem/one-chat-room

Real-time Node.js/Vue/Socket.io demo application
https://github.com/mediacomem/one-chat-room

chat chatroom node nodejs real-time realtime socket-io socketio vue vuejs

Last synced: about 1 year ago
JSON representation

Real-time Node.js/Vue/Socket.io demo application

Awesome Lists containing this project

README

          

# One Chat Room

A real-time demo application written with [Node.js](https://nodejs.org/en/), [Vue](https://vuejs.org/) and [Socket.io](https://socket.io/):
one chat room where anyone can post messages.

[![build](https://github.com/MediaComem/one-chat-room/actions/workflows/build.yml/badge.svg)](https://github.com/MediaComem/one-chat-room/actions/workflows/build.yml)
[![publish](https://github.com/MediaComem/one-chat-room/actions/workflows/publish.yml/badge.svg)](https://github.com/MediaComem/one-chat-room/actions/workflows/publish.yml)
[![license](https://img.shields.io/github/license/MediaComem/one-chat-room)](https://opensource.org/licenses/MIT)

- [Installation](#installation)
- [Requirements](#requirements)
- [Setup](#setup)
- [Run in development mode](#run-in-development-mode)
- [Run in production mode](#run-in-production-mode)
- [Configuration](#configuration)

## Installation

### Requirements

- [Node.js](https://nodejs.org) 22+
- [Installation](https://nodejs.org/en/download/package-manager/)
- [MongoDB](https://www.mongodb.com) 8+
- [Installation](https://docs.mongodb.com/manual/administration/install-community/)

### Setup

- Clone the repository
- Install dependencies

```
cd /path/to/repo
npm install
```

- Set up environment variables for [configuration](#configuration) if needed.

### Run in development mode

```
cd /path/to/application
npm run dev
```

### Run in production mode

```
cd /path/to/application
npm start
```

## Configuration

The following environment variables can be set to customize the application's behavior:

| Variable | Default value | Description |
| :------------------- | :---------------------------------- | :----------------------------------------------------------------------------------------- |
| `BASE_URL` | _none_ | Base URL at which the application is deployed. |
| `DATABASE_URL` | `mongodb://localhost/one-chat-room` | [MongoDB connection string](https://docs.mongodb.com/manual/reference/connection-string/). |
| `MONGODB_URI` | _none_ | Same as and takes precedence over `DATABASE_URL`. |
| `MAX_MESSAGE_LENGTH` | 500 | Maximum number of characters allowed in a message. |
| `MAX_MESSAGES` | 10000 | Maximum number of messages the application will store before deleting the oldest ones. |
| `PORT` | 3000 | Port on which to listen to. |