Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

ChatDock 💭

"ChatDock is a fast, secure, and modern web-based messaging platform designed to bring all your conversations together in one seamless space. Whether you're at home, at work, or on the go, ChatDock keeps your messages organized, accessible, and synchronized across all your devices. With a clean, intuitive interface and robust encryption, you can chat confidently knowing your privacy is protected. Stay connected with friends, family, and colleagues — all from the comfort of your browser, without missing a single moment"


🔧 Server Setup (/server)

1. 📦 Install Dependencies

cd server
npm install

2. ⚙️ Environment Variables

Create a .env file in the server directory and add the following variables:
PORT=                       # Port number (e.g., 5000)
CLIENT_URL=                 # Your frontend URL (e.g., http://localhost:5173)

MONGO_URI=                  # Your MongoDB connection string

CLOUDINARY_CLOUD_NAME=      # Cloudinary cloud name
CLOUDINARY_API_KEY=         # Cloudinary API key
CLOUDINARY_API_SECRET=      # Cloudinary API secret

GOOGLE_CLIENT_ID=           # Google Client Id (for google authentication)
GOOGLE_CLIENT_SECRET=       # Google CLient Secret (for google authentication)
GOOGLE_CALLBACK_URL=        # http://localhost:(PORT)/api/auth/google/callback (Make sure add the same url that you gave on google cloud platform)

JWT_SECRET=                 # Secret key for JWT authentication
NODE_ENV=                   # your envionment like('development' or 'production')

3.📡 API Endpoints

🔐 User Endpoints:

✅Craeting A New User:

  • URL: /api/auth/signup
  • Method: POST
  • Body: fullname, email, password
  • Credentials: True
  • Auth required: No

🔓Login Existing User:

  • URL: /api/auth/login
  • Method: POST
  • Body: email, password
  • Credentials: True
  • Auth required: No

🚪Logout User:

  • URL: /api/auth/logout
  • Method: POST
  • Body: Null
  • Credentials: True
  • Auth required: (Optional)

✏️Update Existing User:

  • URL: /api/auth/update
  • Method: PUT
  • Body: fullname(Optional), about(Optional), profilePic(Optional
  • Credentials: True
  • Auth required: Yes

🗑️Remove Existing User Profile:

  • URL: /api/auth/removeProfile
  • Method: DELETE
  • Body: Null
  • Credentials: True
  • Auth required: Yes

👤Get Logged-In User Profile:

  • URL: /api/auth/me
  • Method: GET
  • Body: Null
  • Credentials: True
  • Auth required: Yes

👥Get All Users:

  • URL: /api/auth/allUsers
  • Method: GET
  • Body: Null
  • Credentials: True
  • Auth required: Yes

🤝 Friend Request Endpoints:

🫂 Get Logged-In User's Friend Requests:

  • URL: /api/requests/getMyRequests
  • Method: GET
  • Body: Null
  • Credentials: True
  • Auth required: Yes

👋 Send Friend Request:

  • URL: /api/requests/sendRequest/:id (It Requires Id Of user That You Want To send friend request)
  • Method: POST
  • Body: Null
  • Credentials: True
  • Auth required: Yes

🤝 Accept Friend Request:

  • URL: /api/requests/acceptRequest/:id (It Requires Id Of friend request)
  • Method: PUT
  • Body: Null
  • Credentials: True
  • Auth required: Yes

🗑️ Delete Friend Request:

  • URL: /api/requests/rejectRequest/:id (It Requires Id Of friend request)
  • Method: DELETE
  • Body: Null
  • Credentials: True
  • Auth required: Yes

🗑️ Remove Friend:

  • URL: /api/requests/removeFriend/:userId/:requestId (It Requires userId:(friend's id that you want to remove) and requestId: (friend request id))
  • Method: DELETE
  • Body: Null
  • Credentials: True
  • Auth required: Yes

✉️ Messages Endpoints:

📩 Get Logged-In User's Messages:

  • URL: /api/messages/getMessages
  • Method: GET
  • Body: Null
  • Credentials: True
  • Auth required: Yes

📨 Send Message to friend:

  • URL: /api/messages/sendMessage/:id (It Requires Id Of friend That You Want To send message)
  • Method: POST
  • Body: text(Optional), images(Optional), files(Optional)
  • Credentials: True
  • Auth required: Yes

👀 Make the message mark as seen:

  • URL: /api/messages/markAsSeen/:id (It Requires Id Of friend That You send message)
  • Method: PUT
  • Body: Null
  • Credentials: True
  • Auth required: Yes

4. 🧪 Run Server

# For development
npm run dev

# For production
npm start

The server should now be running at: http://localhost:(PORT)


📌 Important Notes

  • Ensure that .env files are properly configured in both the client and server folders.
  • All external APIs and services (MongoDB, Cloudinary) must be active and authorized.
  • The application will not function correctly without valid API credentials.

🙌 Acknowledgements

Special thanks to the APIs and services that made this project possible:

Made with ❤️ by Hammad Khatri