NPMChat v1.0
Built with Next.js & TypeScript
The backend is a Node.js application using Express and Mongoose.
/api/v1/auth)| Method | Endpoint | Description | Auth Required |
|--------|----------|-------------|---------------|
| POST | /signup | Create a new user account | No |
| POST | /login | Authenticate user & get token | No |
| GET | /check-auth | Verify current token & get user data | Yes |
| PUT | /update-profile | Update user bio, name, or avatar | Yes |
/api/v1/messages)| Method | Endpoint | Description | Auth Required |
|--------|----------|-------------|---------------|
| GET | / | Get list of users for sidebar with unseen counts | Yes |
| GET | /:userId | Get chat history between two users | Yes |
| POST | /send/:receiverId | Send a new text/image message | Yes |
| PUT | /mark-as-seen/:messageId | Mark a specific message as read | Yes |
email: String (Unique, Lowercase)password: String (Hashed)name: StringavatarUrl: String (Cloudinary URL)bio: StringsenderId: ObjectId (Ref: User)receiverId: ObjectId (Ref: User)text: Stringimage: String (Cloudinary URL)seen: Boolean (Default: false)protectRoute: Verifies the JWT in the Authorization header. If valid, attaches the user object to req.user.