Skip to content

Czar-16/BuzzLine

Repository files navigation

πŸš€ Buzzline

A modern real-time chat application built with Next.js, TypeScript, Socket.io, MongoDB, Mongoose, Shadcn UI, Tailwind CSS, and NextAuth.js.

Buzzline enables users to create accounts, choose unique usernames, discover other users, start conversations, exchange messages instantly, and track real-time online presence with live status updates.


πŸ”— Live Demo

Live Demo

Frontend: https://buzzline-seven.vercel.app

Backend: Railway Deployment


✨ Features

πŸ” Authentication & Authorization

  • Google OAuth Authentication using NextAuth.js
  • Credentials-Based Signup & Login
  • JWT-Based Session Management
  • Protected Routes
  • Secure Password Hashing with bcrypt

πŸ‘€ User Onboarding

  • Unique Username Selection Flow
  • Username Availability Validation
  • One-Time Username Setup for Google Users
  • Persistent User Profiles

πŸ” User Search

  • Search Users by Username
  • Debounced Search Requests
  • Instant Search Results

πŸ’¬ Real-Time Messaging

  • One-to-One Conversations
  • Instant Message Delivery using Socket.io
  • Automatic Conversation Creation
  • Real-Time Chat Updates
  • Socket Room-Based Messaging
  • Persistent Message History

🟒 Presence System

  • Real-Time Online Status
  • Last Active Tracking
  • Live Presence Updates Across Clients
  • Automatic Online/Offline Detection

🎨 Chat Experience

  • Latest Message Preview in Sidebar
  • Automatic Conversation Sorting
  • Auto Scroll to Latest Messages
  • Message Timestamps
  • Responsive Chat Interface
  • Clean Minimal Design

βš™οΈ Account Management

  • Secure Logout Flow
  • Session Persistence
  • Protected Chat Access

πŸŒ™ UI / UX

  • AMOLED Dark Theme
  • Responsive Layout
  • Mobile Friendly Design
  • Built with Shadcn UI
  • Smooth User Experience

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                Frontend (Next.js)            β”‚
β”‚                                              β”‚
β”‚  β€’ Login / Signup                            β”‚
β”‚  β€’ Google OAuth                              β”‚
β”‚  β€’ Username Selection                        β”‚
β”‚  β€’ User Search                               β”‚
β”‚  β€’ Chat Interface                            β”‚
β”‚  β€’ Presence UI                               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚
                    β”‚ REST API
                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            Next.js API Routes                β”‚
β”‚                                              β”‚
β”‚  /api/register                               β”‚
β”‚  /api/auth                                   β”‚
β”‚  /api/users                                  β”‚
β”‚  /api/conversations                          β”‚
β”‚  /api/messages                               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚
                    β”‚ Mongoose
                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               MongoDB Atlas                  β”‚
β”‚                                              β”‚
β”‚  Users                                       β”‚
β”‚  Conversations                               β”‚
β”‚  Messages                                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


                    WebSocket
                         β”‚
                         β–Ό

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            Socket.io Server (3001)           β”‚
β”‚                                              β”‚
β”‚  Presence Management                         β”‚
β”‚  Room Management                             β”‚
β”‚  Real-Time Messaging                         β”‚
β”‚                                              β”‚
β”‚  user-connected                              β”‚
β”‚  user-online                                 β”‚
β”‚  user-offline                                β”‚
β”‚  join-conversation                           β”‚
β”‚  send-message                                β”‚
β”‚  receive-message                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚
                    β–Ό
           Conversation Rooms
                    β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β–Ό                       β–Ό
     User A                  User B

πŸ”„ Message Flow

User A
  β”‚
  β”‚ Send Message
  β–Ό
Next.js API Route
  β”‚
  β”‚ Save Message
  β–Ό
MongoDB Atlas
  β”‚
  β”‚ Return Saved Message
  β–Ό
Socket.io Server
  β”‚
  β”‚ socket.to(conversationId)
  β–Ό
Conversation Room
  β”‚
  β–Ό
User B Receives Message Instantly

πŸ› οΈ Tech Stack

Frontend

  • Next.js
  • React
  • TypeScript
  • Tailwind CSS
  • Shadcn UI

Backend

  • Next.js API Routes
  • Node.js
  • Socket.io

Database

  • MongoDB Atlas
  • Mongoose

Authentication

  • NextAuth.js
  • Google OAuth
  • JWT

πŸ“Έ Screenshots

Signup

Signup

Login

Login

Choose Username

Choose Username

User Search

User Search

Chat Interface

Chat Interface

Online Status

Presence

Last Seen

Last Seen

Logout Confirmation

Logout


πŸ“‚ Project Structure

Buzzline
β”‚
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ app
β”‚   β”œβ”€β”€ components
β”‚   β”œβ”€β”€ lib
β”‚   β”œβ”€β”€ models
β”‚   β”œβ”€β”€ schemas
β”‚   └── types
β”‚
β”œβ”€β”€ public
β”‚
β”œβ”€β”€ screenshots
β”‚
β”œβ”€β”€ socket-server
β”‚   β”œβ”€β”€ server.js
β”‚   └── User.js
β”‚
β”œβ”€β”€ .env.local
β”‚
└── README.md

βš™οΈ Environment Variables

Create a .env.local file in the root directory:

# MongoDB connection string from MongoDB Atlas
MONGODB_URI=your_mongodb_connection_string

# Random secret string used to sign JWT sessions (use: openssl rand -base64 32)
NEXTAUTH_SECRET=your_nextauth_secret

# Base URL of your app (use http://localhost:3000 for local dev)
NEXTAUTH_URL=http://localhost:3000

# From Google Cloud Console β†’ APIs & Services β†’ Credentials β†’ OAuth 2.0 Client
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret

# URL where your Socket.io server is running
NEXT_PUBLIC_SOCKET_URL=http://localhost:3001

πŸš€ Getting Started

Clone Repository

git clone https://github.com/Czar-16/BuzzLine.git

cd BuzzLine

Install Frontend Dependencies

npm install

Install Socket Server Dependencies

cd socket-server

npm install

Run Frontend

npm run dev

Application will be available at:

http://localhost:3000

Run Socket Server

Open another terminal:

cd socket-server

node server.js

Socket server runs at:

http://localhost:3001

πŸ“ˆ Key Highlights

  • Built a production-style real-time chat platform using Socket.io
  • Implemented conversation-based WebSocket room architecture
  • Developed a real-time online presence system with last-active tracking
  • Integrated Google OAuth and Credentials Authentication
  • Built username-based user discovery and onboarding flow
  • Designed normalized MongoDB schemas for Users, Conversations, and Messages
  • Created a responsive AMOLED dark-themed user interface
  • Implemented automatic conversation management and message persistence

🌐 Deployment

Frontend

Deploy using:

  • Vercel

Socket Server

Deploy using:

  • Railway

Database

  • MongoDB Atlas

πŸ”— Live Demo

https://buzzline-seven.vercel.app


πŸ‘¨β€πŸ’» Author

Anoop Jha (Czar16)


⭐ If you found this project useful, consider giving it a star.

About

πŸš€BuzzLine β€” Real-time chat app where messages hit before you finish thinking.

Topics

Resources

Stars

Watchers

Forks

Contributors