This is a chat application built using the MERN stack (MongoDB, Express, React, Node.js) with Prisma as the ORM and Socket.IO for real-time communication. The application also integrates with Google's Generative AI for generating content.
-
Clone the repository:
git clone https://github.com/vaibhav-katariya/prisma-ai-chat-app cd prisma-ai-chat-app
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory and add the following variables:PORT=8000 JWT_SECRET=your_jwt_secret GEMINI_API_KEY=your_gemini_api_key NODE_ENV=development
-
Run the application:
npm start
- The server will start on
http://localhost:8000
. - Use Postman or any API client to interact with the endpoints.
-
Sign Up
POST /api/user/sign-up
Request Body:
{ "name": "John Doe", "email": "john@example.com", "password": "password123" }
-
Sign In
POST /api/user/sign-in
Request Body:
{ "email": "john@example.com", "password": "password123" }
-
Sign Out
POST /api/user/sign-out
-
Get User
GET /api/user/me
-
Update User
PUT /api/user/update-user
Request Body:
{ "email": "john_new@example.com", "name": "John Doe Updated" }
-
Delete User
DELETE /api/user/delete-user
-
Create Project
POST /api/project/create
Request Body:
{ "name": "New Project", "description": "Project description" }
-
Add Users to Project
POST /api/project/add-users
Request Body:
{ "projectId": "project_id", "userIds": ["user_id1", "user_id2"] }
-
Get Projects
GET /api/project/get-projects
-
Get Project
GET /api/project/get-project/:projectId
-
Remove User from Project
DELETE /api/project/remove-user
Request Body:
{ "projectId": "project_id", "userId": "user_id" }
-
Delete Project
DELETE /api/project/delete-project
Request Body:
{ "projectId": "project_id" }
- Generate AI Content
Request Body:
POST /api/ai/gen-content
{ "prompt": "Generate some content about MERN stack." }
prisma-ai-chat-app/
├── controllers/
│ ├── ai.controller.js
│ ├── project.controller.js
│ └── user.controller.js
├── db/
│ └── db.config.js
├── middleware/
│ └── authMiddleware.js
├── routes/
│ ├── ai.route.js
│ ├── project.route.js
│ └── user.route.js
├── utils/
│ └── apiResponce.js
├── .env
├── package.json
├── server.js
└── README.md
This project is licensed under the MIT License.