Skip to content

vaibhav-katariya/prisma-ai-chat-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prisma AI Chat App

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.

Table of Contents

Installation

  1. Clone the repository:

    git clone https://github.com/vaibhav-katariya/prisma-ai-chat-app
    cd prisma-ai-chat-app
  2. Install dependencies:

    npm install
  3. 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
  4. Run the application:

    npm start

Usage

  • The server will start on http://localhost:8000.
  • Use Postman or any API client to interact with the endpoints.

API Endpoints

User Routes

  • 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

Project Routes

  • 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"
    }

AI Routes

  • Generate AI Content
    POST /api/ai/gen-content
    Request Body:
    {
       "prompt": "Generate some content about MERN stack."
    }

Project Structure

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

License

This project is licensed under the MIT License.