MongoChatDart πŸ’¬

MongoChatDart is a powerful Dart package designed to simplify the implementation of chat functionality in your applications. It provides a robust backend solution for managing users, direct messages, group chats, and more, all powered by MongoDB.

✨ Features

  • Easy Setup: Get your chat system up and running with just a few lines of code.
  • MongoDB Integration: Utilize your own MongoDB database for data storage and management.
  • User Management: Easily create, retrieve, and manage user profiles.
  • Direct Messaging: Support for one-on-one conversations between users.
  • Group Chats: Create and manage group conversations with multiple participants.
  • Message Management: Send, retrieve, and manage messages within conversations.
  • Read Receipts: Track when messages have been read by recipients.
  • Real-time Updates: Utilize streams for real-time message and chat room updates.
  • Scalable: Designed to handle growing user bases and increasing message volumes.

πŸš€ Getting Started

πŸ“¦ Installation

Add MongoChatDart to your pubspec.yaml file:

dependencies:
  mongo_chat_dart: ^1.0.0

Then run:

dart pub get

πŸ”§ Basic Usage

  1. Initialize MongoChatDart with your MongoDB connection string:
import 'package:mongo_chat_dart/mongo_chat_dart.dart';

void main() async {
  final mongoChatDart = MongoChatDart();
  await mongoChatDart.initialize('mongodb://localhost:27017/your_database');

  // Your chat application logic here
}
  1. Create a new user:
final user = ChatUser(
  name: 'John Doe',
  userName: 'johndoe',
  emailId: 'john@example.com',
);

await mongoChatDart.chatUser.addUser(user);
  1. Create a DM room:
final dmRoom = DmModel(
  participant1Id: user1.id,
  participant2Id: user2.id,
  createdOn: DateTime.now(),
);

await mongoChatDart.dmModel.createDmRoom(dmRoom);
  1. Send a message:
final message = Message(
  text: 'Hello!',
  sentAt: DateTime.now(),
  sentBy: user1.id,
);

await mongoChatDart.dmModel.addMessage(message, dmRoom.id);
  1. Retrieve messages:
final messages = await mongoChatDart.message.getMessages(dmRoom.messageIds);
  1. Listen for real-time updates:
mongoChatDart.dmModel.getDmRoomsStream([dmRoom.id]).listen((dmRooms) {
  // Handle updates to DM rooms
});

πŸ“š Documentation

For more detailed information on how to use MongoChatDart, please refer to our API documentation.

πŸ—ΊοΈ Roadmap

We're constantly working to improve MongoChatDart. Here are some features we're planning to add in the future:

  • πŸ“± Client-side package for easy UI integration
  • πŸ” End-to-end encryption for messages
  • πŸ“΅ Offline message support
  • πŸ“Ž File and media sharing
  • πŸ” Advanced search functionality
  • πŸ“Š Analytics and reporting tools

🀝 Contributing

We welcome contributions to MongoChatDart! Please see our contributing guidelines for more information on how to get involved.

πŸ“„ License

MongoChatDart is released under the BSD 3-Clause License.

πŸ†˜ Support

If you encounter any issues or have questions about using MongoChatDart, please open an issue on our GitHub repository.


We hope MongoChatDart helps you build amazing chat features in your applications quickly and efficiently. Happy coding! πŸŽ‰

Libraries

mongo_chat_dart