A modern, fullstack web application built with Next.js that allows users to discover, create, and share AI prompts. Users can authenticate with Google, manage their prompts, and explore a community-driven collection of creative AI prompts.
- Frontend: Next.js 16, React 19, TypeScript, Tailwind CSS
- Backend: Next.js API Routes, NextAuth.js
- Database: MongoDB with Mongoose ODM
- Authentication: NextAuth.js with Google OAuth, bcrypt
- Styling: Tailwind CSS, PostCSS, Autoprefixer
- Development: TypeScript, ESLint, tsx, dotenv
- 🔐 Authentication: Secure Google OAuth integration with NextAuth.js
- 📝 CRUD Operations: Create, read, update, and delete prompts with full user ownership
- 🔍 Advanced Search: Search prompts by keywords, tags, or usernames
- 👤 User Profiles: Personal profile pages with user-specific prompt collections
- 📱 Responsive Design: Mobile-first design that works on all devices
- 🌱 Database Seeding: Comprehensive seeding system with sample data
- 🔧 Environment Management: Robust environment variable handling
- 📊 Database Testing: Built-in connection testing utilities
- 🎯 TypeScript Support: Full type safety throughout the application
- Node.js 18+ and pnpm
- MongoDB database (local or MongoDB Atlas)
- Google OAuth credentials
-
Clone the repository
git clone <repository-url> cd share-prompts
-
Install dependencies
pnpm install
-
Set up environment variables
Create a
.envfile in the root directory:MONGODB_URL=your_mongodb_connection_string NEXTAUTH_URL=http://localhost:3000 NEXTAUTH_URL_INTERNAL=http://localhost:3000 NEXTAUTH_SECRET=your_nextauth_secret GOOGLE_ID=your_google_oauth_client_id GOOGLE_CLIENT_SECRET=your_google_oauth_client_secret
-
Seed the database (optional)
pnpm run seed
-
Start the development server
pnpm run dev
Visit http://localhost:3000 to see the application.
This project includes a comprehensive database seeding system for development and testing:
# Basic seeding (recommended)
pnpm run seed
# TypeScript version
pnpm run seed:ts
# Advanced seeding with options
pnpm run seed:advanced
# Seed only users
pnpm run seed:users
# Seed only prompts
pnpm run seed:prompts
# Seed without clearing existing data
pnpm run seed:clear- 5 Sample Users: Realistic user profiles with Google authentication data
- 15 Diverse Prompts: Various categories including creative writing, coding, business, and more
For detailed seeding documentation, see SEEDER_README.md.
├── app/ # Next.js 13+ app directory
│ ├── api/ # API routes
│ │ ├── auth/ # NextAuth.js configuration
│ │ ├── prompt/ # Prompt CRUD operations
│ │ └── users/ # User-related endpoints
│ ├── create-prompt/ # Create prompt page
│ ├── profile/ # User profile pages
│ └── update-prompt/ # Edit prompt page
├── components/ # Reusable React components
├── models/ # Mongoose schemas
├── scripts/ # Database and utility scripts
├── seeds/ # Sample data for seeding
├── styles/ # Global styles
└── utils/ # Utility functions
# Development
pnpm run dev # Start development server
pnpm run build # Build for production
pnpm run start # Start production server
pnpm run lint # Run ESLint
# Database Management
pnpm run seed # Seed database with sample data
pnpm run seed:ts # TypeScript seeder
pnpm run seed:advanced # Advanced seeder with CLI options
pnpm run check-env # Validate environment variables
pnpm run test-db # Test database connectionGET /api/auth/*- NextAuth.js authentication routes
GET /api/prompt- Get all promptsPOST /api/prompt/new- Create new promptGET /api/prompt/[id]- Get specific promptPATCH /api/prompt/[id]- Update promptDELETE /api/prompt/[id]- Delete prompt
GET /api/users/[id]/posts- Get user's prompts
The application is ready for deployment on platforms like Vercel, Netlify, or any Node.js hosting service.
Ensure all environment variables are properly configured in your deployment platform, especially:
MONGODB_URL- Your production MongoDB connection stringNEXTAUTH_URL- Your production domainNEXTAUTH_SECRET- A secure secret for production- Google OAuth credentials
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open source and available under the MIT License.
- Inspired by @JavascriptMastery
- Built with modern web development best practices
- Community-driven prompt sharing concept