support@w4writers.com +44 7743 307695
May 01, 2024

Assignment: Backend for a Real-Time Chat Application

Objective:

Develop a comprehensive backend for a real-time chat application using the MERN stack, emphasizing the use of Node.js and MongoDB for server-side logic and database management. This assignment is designed to test your ability to manage real-time data exchange, database schema design, user authentication, and server-side logic, including integration with third-party APIs for language processing.

Requirements:
User Authentication:
Implement a registration and login system.
Users should sign up with an email and password.
Use JWT (JSON Web Tokens) for managing authentication.
Chat Functionality:
Users should be able to send and receive real-time messages.
Utilise Socket.io for efficient real-time communication.
Message Storage:
Store all messages in MongoDB.
Ensure messages in chat are retrievable for conversation between people.
User Online Status and LLM Integration (IMPORTANT):
A user can set their status as ‘AVAILABLE` or ‘BUSY`
Users can chat if they are online. If the recipient is ‘BUSY`, automatically generate an appropriate response using a language model API such as ChatGPT, Claude, Gemini or any free API available. (In case any API is not available/accessible to you, use the function at the end of assignment to mock the API response. Preferred to have an actual API functioning).
API Response from the LLM should be sent within 10 seconds. If the LLM API does not respond in 10 seconds, send a standard message indicating the user is unavailable. (IMPORTANT)
Basic Frontend (Optional):
Provide a simple frontend to demonstrate the backend functionalities.
This is primarily for testing and demonstration purposes.

Documentation:
Provide comprehensive documentation in a README file, including:
Setup and run instructions.

API route descriptions with expected inputs and outputs, along with logic.
Necessary environment configurations.

Submission:
Submit your work via a public GitHub repository link with a proper README file as described above.
Explain your code with all APIs built and logic in a short video, also demonstrating the functionality.
Include a Postman collection (JSON exported) on GitHub to show API interaction. (saved as hq_collection.json in the repo)

Evaluation Criteria:
Functionality: All specified features must be fully functional.
Code Quality: Code should be clean, well-commented, and organised.
Scalability: The system should handle multiple users simultaneously.
Security: Safely manage user data and credentials.
LLM Integration: Effectively integrate and manage third-party LLM APIs for offline user interaction.
This detailed assignment will gauge your proficiency in building a real-time chat
system that integrates advanced features and third-party services, testing your ability to create a functional and responsive backend architecture.

Node.js function
async function getLLMResponse(prompt) { return new Promise((resolve) => {
const timeout = Math.random() * (15000 - 5000) + 5000;


});
};
setTimeout(() => {
resolve(`This is a mock response from the LLM based on user input`);
}, timeout);


// Example usage getLLMResponse("Hello, how are you?")
.then(response => console.log(response));

Recent Post

Order this Assignment now

Total: GBP120

fables template