A modern, full-stack AI chat application built with React and Node.js, featuring credit-based usage, Stripe payments, and real-time AI interactions.
- AI Chat Interface: Interactive chat with OpenAI GPT models
- Credit System: Pay-per-use model with credit purchases
- User Authentication: Secure JWT-based authentication
- Payment Integration: Stripe for credit purchases
- Responsive Design: Mobile-friendly with Tailwind CSS
- Dark Mode Support: Built-in dark theme
- Real-time Updates: Live credit balance updates
- Code Highlighting: Syntax highlighting for code responses
- Community Features: Share and explore AI-generated content
- React 19.1.1 - Modern React with hooks
- Vite - Fast build tool and dev server
- TailwindCSS 4.1.12 - Utility-first CSS framework
- React Router - Client-side routing
- Axios - HTTP client for API calls
- React Hot Toast - Toast notifications
- React Markdown - Markdown rendering
- Prism.js - Code syntax highlighting
- Node.js - JavaScript runtime
- Express 5.1.0 - Web framework
- MongoDB - NoSQL database
- Mongoose - MongoDB object modeling
- JWT - Authentication tokens
- bcryptjs - Password hashing
- Stripe - Payment processing
- OpenAI - AI model integration
- ImageKit - Image management
My-QuickGPT/
βββ client/ # React frontend
β βββ src/
β β βββ components/ # Reusable components
β β βββ context/ # React context providers
β β βββ pages/ # Page components
β β βββ assets/ # Static assets
β β βββ App.jsx # Main App component
β βββ public/ # Public assets
β βββ package.json # Frontend dependencies
βββ server/ # Node.js backend
β βββ controllers/ # Route controllers
β βββ models/ # Database models
β βββ routes/ # API routes
β βββ middlewares/ # Custom middlewares
β βββ configs/ # Configuration files
β βββ server.js # Server entry point
βββ README.md # This file
- Node.js (v18 or higher)
- MongoDB (local or cloud instance)
- Stripe account (for payments)
- OpenAI API key
-
Clone the repository
git clone https://github.com/yourusername/My-QuickGPT.git cd My-QuickGPT -
Install frontend dependencies
cd client npm install -
Install backend dependencies
cd ../server npm install -
Environment Setup
Create
.envfiles in bothclientandserverdirectories:Server
.env:# Database MONGODB_URI=mongodb://localhost:27017/quickgpt # JWT JWT_SECRET=your_jwt_secret_key # OpenAI OPENAI_API_KEY=your_openai_api_key # Stripe STRIPE_SECRET_KEY=sk_test_... STRIPE_WEBHOOK_SECRET=whsec_... # ImageKit (optional) IMAGEKIT_PUBLIC_KEY=your_imagekit_public_key IMAGEKIT_PRIVATE_KEY=your_imagekit_private_key IMAGEKIT_URL_ENDPOINT=your_imagekit_endpoint # Server PORT=3000 NODE_ENV=development
Client
.env:VITE_API_URL=http://localhost:3000
-
Start the development servers
Backend server (in
serverdirectory):npm run server
Frontend dev server (in
clientdirectory):npm run dev
The application will be available at:
- Frontend: http://localhost:5173
- Backend API: http://localhost:3000
POST /api/user/register- Register new userPOST /api/user/login- User loginGET /api/user/data- Get user data (protected)
GET /api/credit/plan- Get available credit plansPOST /api/credit/purchase- Purchase credits (protected)
POST /api/chat/ask- Send message to AIGET /api/chat/history- Get chat history
GET /api/message/published- Get published messages
POST /api/stripe- Stripe webhook handler
| Plan | Price | Credits | Features |
|---|---|---|---|
| Basic | $10 | 100 | 100 text generations, 50 image generations |
| Pro | $20 | 500 | 500 text generations, 200 image generations |
| Premium | $30 | 1000 | 1000 text generations, 500 image generations |
- Create a Stripe account
- Get your API keys from the Stripe Dashboard
- Set up webhooks for payment completion
- Configure webhook endpoint:
https://yourdomain.com/api/stripe
- Create an OpenAI account
- Generate an API key
- Add the key to your server
.envfile
- Set up MongoDB (local or cloud)
- Create a database named
quickgpt - Add the connection string to your server
.envfile
- Connect your GitHub repository to Vercel
- Configure build settings:
- Build Command:
npm run build - Output Directory:
client/dist
- Build Command:
- Add environment variables
- Deploy the server directory
- Configure environment variables
- Set up Stripe webhooks for production
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the ISC License.
-
MongoDB Connection Error
- Ensure MongoDB is running
- Check connection string in
.env
-
Stripe Payment Issues
- Verify webhook endpoint is accessible
- Check Stripe webhook secret
-
OpenAI API Errors
- Verify API key is valid
- Check API usage limits
-
CORS Issues
- Ensure frontend URL is allowed in CORS settings
Set NODE_ENV=development in your server .env to enable detailed error logging.
For support, please open an issue on GitHub or contact the development team.
- Add more AI models
- Implement team features
- Add analytics dashboard
- Mobile app development
- API rate limiting
- Advanced user roles
- Custom themes
- Export chat history
Built with β€οΈ by Santhosh D