A full-stack recipe sharing application built with MongoDB, Express.js, React, and Node.js (MERN). Users can create, share, explore recipes online with features like ratings, comments, favorites, user profiles, and more.
- β User Authentication: Register and login with JWT tokens
- π³ Recipe Management: Create, edit, delete, and view recipes
- π Search & Filter: Find recipes by category, cuisine, difficulty, and text search
- β€οΈ Likes: Like/unlike recipes
- β Ratings & Reviews: Rate recipes and write detailed reviews
- π¬ Comments: Add and interact with comments on recipes
- π Favorites: Save recipes to personal favorites list
- π€ User Profiles: View user profiles with recipe collection and favorites
- π₯ Follow System: Follow/unfollow other users
- πΌοΈ Image Support: Upload recipe images
- π± Responsive Design: Works on desktop and mobile devices
- Node.js: JavaScript runtime
- Express.js: Web framework
- MongoDB: NoSQL database
- Mongoose: MongoDB object modeling
- JWT: Authentication tokens
- bcryptjs: Password hashing
- CORS: Cross-origin resource sharing
- Multer: File upload handling
- React: UI library
- React Router: Client-side routing
- Axios: HTTP client
- CSS3: Styling with gradients and animations
Recipe Sharing App/
βββ backend/
β βββ models/
β β βββ User.js
β β βββ Recipe.js
β β βββ Comment.js
β β βββ Rating.js
β βββ routes/
β β βββ recipes.js
β β βββ comments.js
β β βββ ratings.js
β β βββ users.js
β βββ middleware/
β β βββ auth.js
β βββ server.js
β βββ package.json
β βββ .env
βββ frontend/
βββ src/
β βββ Component/
β β βββ Navbar.jsx
β β βββ Navbar.css
β βββ Pages/
β β βββ Home.jsx
β β βββ Login.jsx
β β βββ Register.jsx
β β βββ RecipeList.jsx
β β βββ RecipeDetail.jsx
β β βββ AddRecipe.jsx
β β βββ UserProfile.jsx
β β βββ [CSS files]
β βββ App.js
β βββ App.css
β βββ index.js
βββ package.json
- Install dependencies:
cd backend
npm install- Create
.envfile in backend directory:
MONGO_URI=mongodb://localhost:27017/recipe-app
JWT_SECRET=your_secret_key_here
PORT=3000
- Start MongoDB:
mongod- Run backend server:
npm start
# or for development with auto-reload
npm run devBackend will run on http://localhost:3000
- Install dependencies:
cd frontend
npm install- Start React app:
npm startFrontend will run on http://localhost:3001
POST /register- Register new userPOST /login- Login user
GET /api/recipes- Get all recipes with filtersGET /api/recipes/:id- Get single recipePOST /api/recipes- Create new recipe (auth required)PUT /api/recipes/:id- Update recipe (auth required)DELETE /api/recipes/:id- Delete recipe (auth required)POST /api/recipes/:id/like- Like recipe (auth required)POST /api/recipes/:id/favorite- Add to favorites (auth required)GET /api/recipes/author/:userId- Get user's recipes
GET /api/comments/recipe/:recipeId- Get recipe commentsPOST /api/comments- Create comment (auth required)PUT /api/comments/:id- Update comment (auth required)DELETE /api/comments/:id- Delete comment (auth required)POST /api/comments/:id/like- Like comment (auth required)
GET /api/ratings/recipe/:recipeId- Get recipe ratingsPOST /api/ratings- Create/update rating (auth required)DELETE /api/ratings/:id- Delete rating (auth required)
GET /api/users/:userId- Get user profilePUT /api/users/:userId- Update profile (auth required)POST /api/users/:userId/follow- Follow user (auth required)GET /api/users/:userId/favorites- Get user's favoritesPOST /api/users/:userId/change-password- Change password (auth required)
- Logo and branding
- Links to Home, Recipes, Create Recipe
- User authentication status
- Dropdown menu for logged-in users
- Grid view of all recipes
- Search functionality
- Filter by category, cuisine, difficulty
- Sort by latest, popular, rating
- Full recipe information
- Ingredients list with quantities
- Step-by-step instructions
- Comments section
- Ratings and reviews
- Like and favorite buttons
- Form to create new recipes
- Add multiple ingredients
- Add cooking steps
- Upload recipe image
- Set recipe metadata (prep time, servings, etc.)
- User information and bio
- Recipe collection
- Favorites list
- Followers/Following count
- Follow/Unfollow buttons
- Edit profile (own profile only)
- JWT tokens stored in localStorage
- Token expires in 7 days
- Protected routes require authentication
- Password hashed with bcryptjs (10 rounds)
{
username: String (unique, required),
email: String (unique, required),
password: String (hashed),
bio: String,
profileImage: String,
followers: [ObjectId],
following: [ObjectId],
favoriteRecipes: [ObjectId],
createdAt: Date,
updatedAt: Date
}{
title: String (required),
description: String (required),
author: ObjectId (required),
category: String,
cuisine: String,
servings: Number,
prepTime: Number,
cookTime: Number,
difficulty: String,
ingredients: [{name, quantity, unit}],
steps: [{stepNumber, description}],
image: String,
likes: Number,
likedBy: [ObjectId],
favorites: Number,
favoritedBy: [ObjectId],
averageRating: Number,
ratingCount: Number,
comments: [ObjectId],
createdAt: Date,
updatedAt: Date
}{
text: String (required),
author: ObjectId (required),
authorName: String,
recipe: ObjectId (required),
likes: Number,
likedBy: [ObjectId],
createdAt: Date,
updatedAt: Date
}{
rating: Number (1-5, required),
review: String,
author: ObjectId (required),
authorName: String,
recipe: ObjectId (required),
helpful: Number,
createdAt: Date,
updatedAt: Date
}- Register: Create a new account
- Login: Access your account
- Browse Recipes: View recipes from other users
- Create Recipe: Share your own recipes
- Interact: Like, comment, rate, and save recipes
- Follow Users: Follow cooking enthusiasts
- Profile: Manage your profile and favorite recipes
- Clone the repository
- Install dependencies in both backend and frontend
- Setup MongoDB
- Configure environment variables
- Start the backend server
- Start the frontend development server
- Access the app at
http://localhost:3001
MONGO_URI=mongodb://localhost:27017/recipe-app
JWT_SECRET=your_very_secret_key_here
PORT=3000
# Clone repository
git clone <repository-url>
cd recipe-app
# Backend setup
cd backend
npm install
npm start
# Frontend setup (new terminal)
cd frontend
npm install
npm startcd backend
heroku create your-app-name
git push heroku maincd frontend
npm run build
# Deploy the build folder to Netlify- Ensure MongoDB is running:
mongod - Check MONGO_URI in .env file
- Verify frontend URL in backend CORS config
- Ensure backend is running on correct port
- Check localStorage for token
- Verify JWT_SECRET is consistent
- Clear browser cache and login again
- Image upload to cloud storage (AWS S3)
- Advanced search with tags and ingredients
- Recipe difficulty ratings
- Cooking time estimates
- Shopping list generator
- Meal plan creation
- Social sharing features
- Email notifications
- Recipe recommendations
- Video upload for recipe steps
- Multi-language support
- Dark mode
MIT License - Feel free to use this project for personal or commercial use.
Contributions are welcome! Please feel free to submit a Pull Request.
For support, email support@recipeapp.com or open an issue on GitHub.
Happy Cooking! π¨βπ³π©βπ³