GMind is a dockerized Node.js AI chat application powered by Google AI Studio API and PostgreSQL, using Prisma ORM for database management.
- 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
├── 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
- Docker
- Node.js (for local development)
- PostgreSQL (if not using Docker)
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
- Install dependencies:
npm run setup
- Initialize Prisma:
npm run setupPrismaORM npm run generateDB
- Start the server:
npm run dev
-
Build and start containers:
docker compose build
-
Match prisma schema to postgresql db by setting migration:
docker compose run serverapp npx prisma migrate dev --name init
-
Run server and db services:
docker compose up
-
Access the app at http://localhost:5000
POST /auth/register— Register a new userPOST /auth/login— Login and receive JWT tokenGET /chat/dash— Serve chat interfacePOST /chat/— Send a message to Gemini AIGET /chat/— Retrieve chat history
- Node.js
- Express
- Prisma ORM
- PostgreSQL
- Docker & Docker Compose
- Google AI Studio API (Gemini)
- JWT & bcryptjs
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