Skip to content

LovelySharma-dev/Pulse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

40 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Pulse Banner

Pulse Logo

Pulse

โšก Chat instantly. Share effortlessly. Stay connected.


Typing SVG


React Node.js MongoDB Socket.IO TailwindCSS Zustand


GitHub Issues License



๐Ÿ”— Live Demo ย ยทย  Report Bug ย ยทย  Request Feature



๐Ÿ“‹ Table of Contents



โœจ Overview

Pulse is a production-grade full-stack real-time chat app built on the MERN stack โ€” crafted to deliver fast, beautiful, and secure messaging experiences.

Unlike barebones chat demos, Pulse is built with a real architecture:

  • Optimistic UI so messages feel instant
  • Socket.IO for true bi-directional, event-driven communication
  • Cloudinary for image hosting
  • Arcjet for security middleware
  • JWT + HTTP-only cookies for bulletproof auth

Whether you're learning full-stack dev or want a solid chat foundation to build on โ€” Pulse has you covered.



๐ŸŽฅ Demo

Pulse Demo

๐Ÿ“ธ Application Preview

๐Ÿ“ Sign Up ๐Ÿ” Login
Sign Up Login

๐Ÿ’ฌ Chat Page ๐Ÿ–ผ๏ธ Image Sharing
Chat Page Image Sharing


๐ŸŒŸ Features


๐Ÿ’ฌ Core Messaging

Feature Description
โšก Real-time messaging Powered by Socket.IO โ€” no refresh needed
๐Ÿš€ Optimistic UI Messages appear instantly before server confirms
๐Ÿ–ผ๏ธ Image sharing Send images with preview before you hit send
๐Ÿ“œ Auto-scroll Chat always anchors to the latest message
๐Ÿ•’ Timestamps Every message has human-readable time

๐Ÿ‘ฅ User Experience

Feature Description
๐Ÿ” Secure Auth JWT tokens stored in HTTP-only cookies
๐ŸŸข Online Presence See who's online in real-time
๐Ÿ‘ค Profile Picture Upload and update your avatar via Cloudinary
๐Ÿ“‹ Contacts List Browse and start conversations easily
๐Ÿ•“ Recent Chats Quick access to your active conversations

๐ŸŽต The Fun Stuff

Feature Description
โŒจ๏ธ Typing sounds Satisfying keyboard clicks as you type
๐Ÿ”” Notification sounds Hear incoming messages
๐Ÿ”‡ Toggle sounds Turn effects on/off anytime
๐ŸŽž๏ธ Smooth animations Polished transitions throughout

โš™๏ธ Backend Power

Feature Description
๐Ÿ“ก Express REST API Clean, modular route structure
๐Ÿƒ MongoDB Atlas Cloud-hosted database
โ˜๏ธ Cloudinary Optimized image uploads & hosting
๐Ÿ“ง Resend Emails Welcome emails on signup
๐Ÿ›ก๏ธ Arcjet Rate limiting & security layer
๐Ÿ”Œ Socket.IO Full-duplex real-time events


๐Ÿ–ฅ๏ธ Tech Stack

Frontend

Technology Purpose
React UI Library
Zustand Global State Management
TailwindCSS Utility-first Styling
DaisyUI Component Library
Axios HTTP Client
React Router Client-side Routing
Lucide Icon Library

Backend

Technology Purpose
Node.js Server Runtime
Express Web Framework
MongoDB Database
Mongoose ODM
Socket.IO Real-time Engine
JWT Authentication
Cloudinary Image Hosting
Arcjet API Security


๐Ÿ“ Project Structure

๐Ÿ’œ Pulse/
โ”‚
โ”œโ”€โ”€ ๐Ÿ–ฅ๏ธ  frontend/
โ”‚   โ”œโ”€โ”€ ๐Ÿงฉ  components/          # Reusable UI components
โ”‚   โ”œโ”€โ”€ ๐Ÿช  hooks/               # Custom React hooks
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„  pages/               # Route-level page components
โ”‚   โ”œโ”€โ”€ ๐Ÿ—ƒ๏ธ  store/               # Zustand global state stores
โ”‚   โ”œโ”€โ”€ ๐Ÿ› ๏ธ  lib/                 # Utility functions & config
โ”‚   โ””โ”€โ”€ ๐ŸŽจ  assets/             # Images, sounds, static files
โ”‚
โ”œโ”€โ”€ โš™๏ธ  backend/
โ”‚   โ”œโ”€โ”€ ๐ŸŽฎ  controllers/         # Route handler logic
โ”‚   โ”œโ”€โ”€ ๐Ÿ”’  middleware/          # Auth, error, Arcjet middleware
โ”‚   โ”œโ”€โ”€ ๐Ÿ“  models/             # Mongoose data schemas
โ”‚   โ”œโ”€โ”€ ๐Ÿ›ฃ๏ธ  routes/             # Express API routes
โ”‚   โ”œโ”€โ”€ ๐Ÿ› ๏ธ  lib/                # DB connection, Cloudinary, utils
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ง  emails/             # Resend email templates
โ”‚   โ””โ”€โ”€ ๐Ÿ”Œ  socket/             # Socket.IO setup & events
โ”‚
โ””โ”€โ”€ ๐Ÿ“–  README.md


โšก Real-Time Architecture

Pulse Real-Time Architecture


๐Ÿ”’ Auth Flow

flowchart TD
    A(["Signup / Login"])
    B["JWT Generated โ€” HS256 Signed"]
    C["HTTP-Only Cookie โ€” Sent to browser"]
    D{"Protected Route request?"}
    E["Auth Middleware โ€” Verify JWT from cookie"]
    F["401 Unauthorized"]
    G["Socket Handshake โ€” Token verified on connect"]
    H(["Connected & Online"])

    A --> B --> C --> D
    D -- Yes --> E
    D -- No --> H
    E -- Valid --> G --> H
    E -- Invalid --> F
Loading


โš™๏ธ Environment Variables

Create a .env file in /backend:

# โ”€โ”€ Server โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
PORT=3000
CLIENT_URL=http://localhost:5173

# โ”€โ”€ Database โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
MONGODB_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/pulse

# โ”€โ”€ Auth โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
JWT_SECRET=your_super_secret_jwt_key_here

# โ”€โ”€ Cloudinary โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret

# โ”€โ”€ Email (Resend) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
RESEND_API_KEY=re_xxxxxxxxxxxxxxxxxxxx
EMAIL_FROM=hello@yourdomain.com
EMAIL_FROM_NAME=Pulse

# โ”€โ”€ Security (Arcjet) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
ARCJET_KEY=ajkey_xxxxxxxxxxxxxxxxxxxx

๐Ÿ’ก Tip: Never commit your .env file. Add it to .gitignore immediately!



๐Ÿš€ Getting Started

Prerequisites

Make sure you have these installed:

node --version   # v18+
npm --version    # v9+

You'll also need accounts for:


1๏ธโƒฃ Clone the Repository

git clone https://github.com/LovelySharma-dev/Pulse.git
cd Pulse

2๏ธโƒฃ Set Up the Backend

cd backend
npm install

Create your .env file (see Environment Variables above), then:

npm run dev
# โœ… Server running at http://localhost:3000

3๏ธโƒฃ Set Up the Frontend

Open a new terminal:

cd frontend
npm install
npm run dev
# โœ… App running at http://localhost:5173

4๏ธโƒฃ Open the App

Navigate to http://localhost:5173 and start chatting! ๐ŸŽ‰



๐Ÿ“ธ Screenshots

๐Ÿ” Login Screen

Login


๐Ÿ’ฌ Chat Screen

Chat


๐Ÿ“‹ Contacts

Contacts


๐Ÿ“ฑ Mobile View

Mobile View 1 Mobile View 2


๐ŸŽฏ Roadmap

What's coming next for Pulse ๐Ÿ‘€

  • โŒจ๏ธ Typing Indicator โ€” See when someone is typing
  • โœ… Read Receipts โ€” Know when your message is seen
  • ๐Ÿ˜Š Emoji Picker โ€” React and express yourself
  • ๐ŸŽ™๏ธ Voice Messages โ€” Record and send audio
  • ๐Ÿ“น Video Calling โ€” Face-to-face in the browser
  • ๐Ÿ”” Push Notifications โ€” Never miss a message
  • ๐Ÿ‘ฅ Group Chats โ€” Bring everyone together
  • ๐Ÿ” Message Search โ€” Find any conversation instantly
  • โ†ฉ๏ธ Reply to Messages โ€” Thread-style replies
  • โœ๏ธ Edit / Delete Messages โ€” Because typos happen
  • ๐ŸŒ™ Dark & Light Themes โ€” Choose your vibe

๐Ÿ’œ Want to help build any of these? Open a PR!



๐Ÿ’ก Lessons Learned

Building Pulse was a deep dive into real-world full-stack challenges. Here's what made it interesting:


โšก Optimistic UI Updates Making messages appear instantly while the server processes them โ€” and gracefully rolling back on failure โ€” required careful state management with Zustand.

๐Ÿ”„ Real-Time Synchronization Keeping socket events, REST state, and UI in sync without stale data or race conditions taught the importance of a single source of truth.

๐Ÿ”Œ Socket Lifecycle Management Connecting, disconnecting, and reconnecting sockets cleanly โ€” especially across auth boundaries โ€” is more nuanced than the docs suggest.

๐Ÿ–ผ๏ธ Image Upload Pipeline Handling file selection โ†’ preview โ†’ base64 encoding โ†’ Cloudinary upload โ†’ URL storage in MongoDB without blocking the UI.

๐Ÿ”’ JWT + Cookie Auth Understanding why HTTP-only cookies beat localStorage for token storage, and how to propagate auth context to Socket.IO handshakes.

๐Ÿ—ƒ๏ธ Zustand State Design Structuring stores so that chat state, auth state, and socket state stay decoupled but reactive to each other.

๐Ÿ”— REST + WebSockets Together Knowing when to use a REST call vs. a socket event โ€” and why you often need both for the same action.



๐Ÿค Contributing

Contributions are what make open source awesome. Any contributions you make are genuinely appreciated.

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/AmazingFeature
  3. Commit your changes: git commit -m 'Add some AmazingFeature'
  4. Push to the branch: git push origin feature/AmazingFeature
  5. Open a Pull Request

Found a bug? Open an issue Have an idea? Start a discussion



โญ Support

If Pulse helped you learn something or saved you hours of boilerplate...

Give it a star! โญ It genuinely helps.

Star on GitHub Fork on GitHub




Made with โ˜• & ๐Ÿ’œ.

Happy Building ๐Ÿš€


forthebadge forthebadge forthebadge

About

Built Pulse, a real-time messaging platform using React, Node.js, Socket.io, MongoDB, JWT authentication, Cloudinary, and rate-limited APIs with online presence and media sharing.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors