Skip to content

d3uceY/Chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Chat App Backend

This is the backend for the real-time chat application using Express, Socket.IO, and MongoDB (Mongoose).

It supports real-time messaging, likes, and comments.



Installation

  1. Clone the repository:
git clone <repo-url>
cd <repo-folder>
  1. Install dependencies:
npm install
  1. Install nodemon globally (optional, for development):
npm install -g nodemon

Or as a dev dependency:

npm install --save-dev nodemon

Environment Variables

Create a .env file in the src/ folder based on the .env.example file:

src/.env.example

Example .env:

MONGO_URI=mongodb:
PORT=3000
  • MONGO_URI — Your MongoDB connection string
  • PORT — Port for the server (default: 3000)

Running the Server

Development (with nodemon)

npx nodemon src/index.js

or if installed globally:

nodemon src/index.js

Production

node src/index.js

Project Structure

src/
├─ models/          # Mongoose schemas (Message, Comment, etc.)
├─ server.js        # Express & Socket.IO setup
├─ index.js         # Entry point
├─ .env.example     # Environment variable template

Notes

  • Messages, likes, and comments are persisted in MongoDB.
  • Socket.IO handles real-time updates.
  • Ensure MongoDB is running before starting the server.

About

simple chat app

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published