Skip to content

lemboupharel/gmind

Repository files navigation

GMind

GMind is a dockerized Node.js AI chat application powered by Google AI Studio API and PostgreSQL, using Prisma ORM for database management.

Features

  • User registration and login with JWT authentication
  • Secure password hashing using bcrypt
  • Chat interface with Google Gemini AI responses
  • Persistent chat history per user
  • RESTful API endpoints
  • Dockerized for easy deployment
  • PostgreSQL database integration via Prisma

Project Structure

├── src/
│   ├── server.js            # Main server entry point
│   ├── prismaClient.js      # Prisma client setup
│   ├── routes/
│   │   ├── authroutes.js    # Authentication routes
│   │   └── chatroutes.js    # Chat routes
│   └── middleware/
│       └── authmiddleware.js# JWT authentication middleware
├── prisma/
│   ├── schema.prisma        # Prisma schema
│   └── migrations/          # Database migrations
├── public/                  # Static frontend files
│   └── style/               # CSS/JS assets
├── views/
│   ├── login.html           # Login page
│   └── chat.html            # Chat page
├── Dockerfile               # Docker build instructions
├── docker-compose.yaml      # Multi-container orchestration
├── package.json             # Node.js dependencies and scripts
└── .env                     # Environment variables

Getting Started

Prerequisites

Environment Variables

Create a .env file with the following (see .env):

API_KEY=your_google_api_key
PORT=5000
JWT_SECRET=your_jwt_secret_key
DATABASE_URL=postgresql://postgres:postgres@db:5432/gmind

Local Development

  1. Install dependencies:
    npm run setup
  2. Initialize Prisma:
    npm run setupPrismaORM
    npm run generateDB
  3. Start the server:
    npm run dev

Docker Deployment

  1. Build and start containers:

    docker compose build
  2. Match prisma schema to postgresql db by setting migration:

    docker compose run serverapp npx prisma migrate dev --name init
  3. Run server and db services:

    docker compose up
  4. Access the app at http://localhost:5000

API Endpoints

  • POST /auth/register — Register a new user
  • POST /auth/login — Login and receive JWT token
  • GET /chat/dash — Serve chat interface
  • POST /chat/ — Send a message to Gemini AI
  • GET /chat/ — Retrieve chat history

Technologies Used

  • Node.js
  • Express
  • Prisma ORM
  • PostgreSQL
  • Docker & Docker Compose
  • Google AI Studio API (Gemini)
  • JWT & bcryptjs

License

This project is licensed under the MIT License - see the LICENSE file for details.


Note: Replace API keys and secrets in .env and docker-compose.yaml with your own

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published