A modern, responsive recipe sharing application built with React.js frontend and Node.js/Express backend. Users can discover, create, share, and manage their favorite recipes with features like user authentication, recipe categorization, image uploads, and social interactions.
Email: demo@gmail.com
Password: 12345678
- User Authentication: Secure registration and login with JWT tokens
- Recipe Management: Create, edit, and delete personal recipes
- Image Upload: Cloud-based image storage with Cloudinary
- Recipe Discovery: Browse all recipes with category filtering
- Search Functionality: Real-time recipe search across titles and ingredients
- Responsive Design: Mobile-first design that works on all devices
- User Profiles: Personalized dashboard showing user's recipes
- Favorites System: Save favorite recipes for quick access
- Like System: Like recipes and see like counts
- Recipe Details: Detailed view with ingredients, instructions, and images
- Latest Recipes: Always see the newest recipes added
- RESTful API: Clean backend architecture with Express.js
- MongoDB Database: Scalable NoSQL database with Mongoose ODM
- Cloud Storage: Cloudinary integration for image management
- Protected Routes: Authentication-based route protection
- Loading States: Skeleton loaders for better UX
- Error Handling: Comprehensive error handling and user feedback
- React 19 with Vite build tool
- React Router v7 for client-side routing
- Axios for HTTP requests
- JWT Decode for token management
- Cloudinary React SDK for image handling
- Node.js with Express.js framework
- MongoDB with Mongoose ODM
- JWT for authentication
- Cloudinary SDK for image uploads
- BcryptJS for password hashing
- ESLint for code linting
- Nodemon for development server
- Vite for fast development and building
Before running this project, ensure you have the following installed:
- Node.js (v18 or higher)
- npm or yarn package manager
- MongoDB (local installation or MongoDB Atlas account)
- Cloudinary account for image storage
git clone https://github.com/narsijangid/RecipeShare.git
cd RecipeCreate a .env file in the backend directory:
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secretcd backend
npm install# Development mode with nodemon
npm run dev
# Production mode
npm startThe backend server will run on http://localhost:5000
cd frontend
npm installnpm run devThe frontend development server will run on http://localhost:5173
- Go to MongoDB Atlas
- Create a free cluster
- Create a database user
- Add your IP to the whitelist
- Get your connection string
- Install MongoDB Community Edition
- Start MongoDB service
- Use connection string:
mongodb://localhost:27017/recipebook
- Create account at Cloudinary
- Go to Dashboard to get your credentials
- Note down: Cloud Name, API Key, and API Secret
# Server Configuration
PORT=5000
# Database
MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/recipebook?retryWrites=true&w=majority
# Authentication
JWT_SECRET=your_super_secret_jwt_key_here
# Cloudinary (Image Storage)
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secretRecipe/
βββ backend/ # Backend Node.js application
β βββ config/ # Configuration files
β β βββ cloudinary.js # Cloudinary setup
β β βββ upload.js # Multer upload config
β βββ middleware/ # Custom middleware
β β βββ auth.js # JWT authentication middleware
β βββ models/ # MongoDB models
β β βββ Recipe.js # Recipe schema
β β βββ User.js # User schema
β βββ routes/ # API routes
β β βββ recipes.js # Recipe CRUD operations
β β βββ users.js # User authentication routes
β βββ .env # Environment variables
β βββ server.js # Main server file
β βββ package.json # Backend dependencies
β
βββ frontend/ # React frontend application
β βββ src/
β β βββ components/ # Reusable components
β β βββ context/ # React Context providers
β β β βββ AuthContext.js # Authentication context
β β β βββ RecipeContext.js # Recipe management context
β β βββ pages/ # Page components
β β β βββ Home.js # Home page with recipe listing
β β β βββ Login.js # User login page
β β β βββ Register.js # User registration page
β β β βββ CreateRecipe.js # Recipe creation/editing
β β β βββ RecipeDetail.js # Individual recipe view
β β β βββ Profile.js # User profile page
β β β βββ NotFound.js # 404 page
β β βββ utils/ # Utility functions
β β βββ config/ # Configuration files
β β βββ App.jsx # Main App component
β β βββ main.jsx # React entry point
β βββ index.html # HTML template
β βββ package.json # Frontend dependencies
β
βββ README.md # This file
npm start- Start production servernpm run dev- Start development server with nodemonnpm test- Run tests (placeholder)
npm run dev- Start Vite development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
POST /register- User registrationPOST /login- User loginGET /profile- Get user profile (protected)PUT /profile- Update user profile (protected)
GET /- Get all recipes (with pagination)GET /:id- Get single recipe by IDPOST /- Create new recipe (protected)PUT /:id- Update recipe (protected, owner only)DELETE /:id- Delete recipe (protected, owner only)GET /user/:userId- Get recipes by specific userPOST /:id/like- Like/unlike recipe (protected)
- Home (
/) - Recipe discovery with search and filtering - Recipe Detail (
/recipes/:id) - Detailed recipe view - Login (
/login) - User authentication - Register (
/register) - New user registration
- Create Recipe (
/create-recipe) - Add new recipe - Edit Recipe (
/edit-recipe/:id) - Modify existing recipe - Profile (
/profile) - User dashboard with personal recipes
- Mobile-first approach
- Breakpoints: 480px, 768px, 992px, 1200px
- Touch-friendly interface for mobile devices
- Skeleton Loaders: Smooth loading experience
- Gradient Design: Modern gradient backgrounds and buttons
- Hover Effects: Interactive elements with smooth transitions
- Loading States: Clear feedback during async operations
- Error Handling: User-friendly error messages
- User registration and login
- Recipe creation with image upload
- Recipe editing and deletion
- Search functionality
- Category filtering
- Like and favorite features
- Responsive design on mobile devices
- Protected route access
- Set environment variables on platform
- Connect GitHub repository
- Deploy automatically on push to main branch
- Connect GitHub repository
- Set build command:
npm run build - Set output directory:
dist - Add environment variables for API URL
# Frontend .env
VITE_API_URL=https://your-backend-url.com/api
# Backend production
NODE_ENV=production
PORT=process.env.PORTError: MongoDB Connection Error
Solution: Check your MONGO_URI in .env file and ensure MongoDB is accessible
Error: Cloudinary upload failed
Solution: Verify Cloudinary credentials and ensure file size limits
Error: CORS policy error
Solution: Backend CORS is configured for localhost:5173, adjust if needed
Error: Port 5000 already in use
Solution: Change PORT in .env file or kill existing process
For support or questions:
- Create an issue in the GitHub repository
- Check existing issues for solutions
- Review this README for setup guidance
Happy Cooking! π³ Share your favorite recipes with the world!