A full-stack AI prompt creation and management platform built with React, TypeScript, Node.js, and MongoDB.
- Node.js (v16 or higher) - Download here
- MongoDB - Either local installation or MongoDB Atlas account
- Git - Download here
-
Clone the repository
git clone <repository-url> cd generative-prompt-studio
-
Run the project
Option A: Use the master startup script
# Double-click start-project.bat or run in terminal: start-project.bat
Option B: Start both services manually
# In one terminal (Backend): cd backend start-backend.bat # In another terminal (Frontend): cd frontend start-frontend.bat
-
Access the application
- Frontend: http://localhost:8080
- Backend API: http://localhost:8001
- Health Check: http://localhost:8001/health
generative-prompt-studio/
βββ backend/ # Node.js Express API
β βββ config/ # Database and app configuration
β βββ middlewares/ # Express middlewares
β βββ models/ # MongoDB models
β βββ routes/ # API routes
β βββ scripts/ # Utility scripts
β βββ services/ # Business logic
β βββ utils/ # Helper utilities
β βββ .env # Environment variables
β βββ server.js # Main server file
β βββ start-backend.bat # Backend startup script
βββ frontend/ # React TypeScript app
β βββ src/ # Source code
β βββ public/ # Static assets
β βββ scripts/ # Utility scripts
β βββ .env # Environment variables
β βββ vite.config.ts # Vite configuration
β βββ start-frontend.bat # Frontend startup script
βββ start-project.bat # Master startup script
βββ README.md # This file
The backend uses the following environment variables:
# Server Configuration
PORT=8001
NODE_ENV=development
# Database Configuration
MONGODB_URI=your_mongodb_connection_string
# JWT Configuration
JWT_SECRET=your_jwt_secret_key
JWT_EXPIRE=7d
# Frontend URL
FRONTEND_URL=http://localhost:8080
# API Keys (Optional)
ANTHROPIC_API_KEY=your_anthropic_api_key
OPENAI_API_KEY=your_openai_api_key
PERPLEXITY_API_KEY=your_perplexity_api_key
# Payment Configuration (Optional)
RAZORPAY_KEY_ID=your_razorpay_key_id
RAZORPAY_KEY_SECRET=your_razorpay_key_secret
# API Configuration
VITE_API_URL=http://localhost:8001/api
# App Configuration
VITE_APP_NAME=Promptify
VITE_APP_VERSION=1.0.0
-
Navigate to backend directory
cd backend
-
Install dependencies
npm install
-
Configure environment
# Copy example environment file copy .env.example .env # Edit .env with your configuration
-
Run validation and start server
# Validate configuration npm run validate # Start development server npm run dev
-
Navigate to frontend directory
cd frontend
-
Install dependencies
npm install
-
Configure environment
# Create .env file with API URL echo VITE_API_URL=http://localhost:8001/api > .env
-
Run validation and start development server
# Validate configuration npm run validate # Start development server npm run dev
npm run dev
- Start development server with nodemonnpm run dev:check
- Run validation then start development servernpm run validate
- Run startup validation checksnpm start
- Start production servernpm run build
- No build step required (Node.js)
npm run dev
- Start Vite development servernpm run dev:check
- Run validation then start development servernpm run validate
- Run startup validation checksnpm run build
- Build for productionnpm run preview
- Preview production buildnpm run lint
- Run ESLint
-
Port already in use (EADDRINUSE error)
Quick Fix:
cd backend npm run port:kill-all # Kill all Node.js processes npm run dev # Restart server
Advanced Solutions:
npm run port:check # Check what's using port 8001 npm run port:kill # Kill processes on port 8001 npm run dev:clean # Clean port and start server
The backend now automatically finds available ports if 8001 is busy.
-
Database connection failed
- Check your
MONGODB_URI
in backend/.env - Ensure MongoDB is running (if using local installation)
- Verify network connectivity to MongoDB Atlas (if using cloud)
- The server will continue running without DB (limited functionality)
- Check your
-
Dependencies not installed
- Run
npm install
in both backend and frontend directories - Delete
node_modules
andpackage-lock.json
, then reinstall - Use the startup scripts which auto-install dependencies
- Run
-
Environment variables not loaded
- Ensure
.env
files exist in both directories - Check for typos in variable names
- Restart the servers after changing .env files
- Use the startup scripts which auto-create .env files
- Ensure
Both backend and frontend include startup validation scripts that check:
- Node.js version compatibility
- Required files existence
- Environment variable configuration
- Dependencies installation
- Port availability
- Database connectivity (backend)
- API connectivity (frontend)
Run validation manually:
# Backend validation
cd backend && npm run validate
# Frontend validation
cd frontend && npm run validate
curl http://localhost:8001/health
Expected response:
{
"status": "OK",
"message": "Promptify API is running",
"timestamp": "2024-01-01T00:00:00.000Z"
}
- Open http://localhost:8080 in your browser
- The application should load without errors
-
Start both services
# Use the master script start-project.bat # Choose option 3 to start both
-
Make changes
- Backend changes trigger automatic restart (nodemon)
- Frontend changes trigger hot reload (Vite HMR)
-
Test your changes
- Frontend: http://localhost:8080
- Backend API: http://localhost:8001/api
-
Check logs
- Backend logs appear in the backend terminal
- Frontend logs appear in browser console and frontend terminal
-
Set production environment
NODE_ENV=production
-
Use production database
MONGODB_URI=your_production_mongodb_uri
-
Start production server
npm start
-
Build for production
npm run build
-
Serve built files
npm run preview # Or use a static file server
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
If you encounter any issues:
- Check this README for troubleshooting steps
- Run the validation scripts to identify configuration issues
- Check the console/terminal logs for error messages
- Ensure all prerequisites are properly installed
Happy coding! π