Notice (September 15, 2024): Due to an issue I have not yet identified, the application does not work properly on iPhone devices. Therefore, if you need to test on a mobile device, using an Android phone will yield more accurate results. For the most reliable results, please use the desktop version.
This project was developed as part of the backend module final project in the Full Stack Web Development course at DCI. It is a Fullstack (MERN) chat bot application with a focus on the backend. This README file explains the setup and features of the project in detail.
Note: The chatbot functionality is powered by ChatGPT for natural language processing.
To quickly log in without registration, use the following test credentials:
Email: [email protected]
Password: test123!
Note: All messages will be deleted on each login with the test account to keep the chat history clear.
- Features
- Installation
- Technologies Used
- Screenshots
- Trimming: Remove whitespace from both ends of this input.
- Validation: Ensure input meets required formats and rules.
- Google reCAPTCHA: Prevent automated registrations.
- Hashing: Securely store user passwords.
- Confirmation Email: Send a confirmation mail about the registration.
- Hashing Check: Validate password by comparing hashes.
- Authentication with JWT: Use JSON Web Tokens for user sessions.
- Access Token: Store access token in cookies upon login.
- Input Limitations: Enforce maximum input length.
- Spam Prevention: Disable input until a response is received.
- Empty Input Check: Ensure input is not empty.
- Sanitization: Trim input and sanitize HTML on the server.
- Response Limitation: Use hidden prompt to restrict response to under 5 words.
- Traffic Reduction: Limit response tokens with
max tokens
. - Message Limit: Disable input after 5 messages per user in the database.
- Conversation-User Relationship: Establish a one-to-many relationship between users and conversations using parent reference.
- Edit User: Allow users to update their email addresses.
- Delete User: Enable users to delete their accounts and associated conversations.
- Token Removal: Delete access token from cookies on logout.
- Node.js
- MongoDB
- npm (Node Package Manager)
-
Clone the repository (SSH):
git clone [email protected]:barisbalcimusic/backendFinalProject.git cd backendFinalProject
-
Install dependencies for the backend:
cd backend npm install
-
Install dependencies for the frontend:
cd ../frontend npm install
-
Create a
.env
file in theserver
directory and add the following variables:PORT=your_port MONGO_URI=your_mongodb_uri JWT_SECRET=your_jwt_secret APP_PASSWORD=your_app_password_for_gmail EMAIL_USER=[email protected] CAPTCHA_SECRET=your_google_recaptcha_secret API_KEY=your_openai_apikey
-
Start the development server:
cd ../backend npm start
- Frontend: React, Tailwind CSS
- Backend: Node.js, Express.js
- AI Integration: OpenAI API
- Database: MongoDB, Mongoose
- Authentication: JWT, bcrypt
- Email: Nodemailer
- Security: Google reCAPTCHA, sanitize-html