Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🍳 RecipeShare - Full-Stack Recipe Sharing Platform

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.

Demo Credentials:

Email: demo@gmail.com

Password: 12345678

Screenshots

image image image image image

🌟 Features

Core Features

  • 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 Features

  • 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

Technical Features

  • 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

πŸ› οΈ Tech Stack

Frontend

  • 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

Backend

  • Node.js with Express.js framework
  • MongoDB with Mongoose ODM
  • JWT for authentication
  • Cloudinary SDK for image uploads
  • BcryptJS for password hashing

Development Tools

  • ESLint for code linting
  • Nodemon for development server
  • Vite for fast development and building

πŸ“‹ Prerequisites

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

πŸš€ Quick Start

1. Clone the Repository

git clone https://github.com/narsijangid/RecipeShare.git
cd Recipe

2. Backend Setup

Environment Variables

Create 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_secret

Install Dependencies

cd backend
npm install

Start Backend Server

# Development mode with nodemon
npm run dev

# Production mode
npm start

The backend server will run on http://localhost:5000

3. Frontend Setup

Install Dependencies

cd frontend
npm install

Start Development Server

npm run dev

The frontend development server will run on http://localhost:5173

πŸ”§ Detailed Setup Instructions

MongoDB Setup

Option 1: MongoDB Atlas (Recommended)

  1. Go to MongoDB Atlas
  2. Create a free cluster
  3. Create a database user
  4. Add your IP to the whitelist
  5. Get your connection string

Option 2: Local MongoDB

  1. Install MongoDB Community Edition
  2. Start MongoDB service
  3. Use connection string: mongodb://localhost:27017/recipebook

Cloudinary Setup

  1. Create account at Cloudinary
  2. Go to Dashboard to get your credentials
  3. Note down: Cloud Name, API Key, and API Secret

Environment Configuration

Backend Environment Variables (.env)

# 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_secret

πŸ“ Project Structure

Recipe/
β”œβ”€β”€ 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

🎯 Available Scripts

Backend Scripts

  • npm start - Start production server
  • npm run dev - Start development server with nodemon
  • npm test - Run tests (placeholder)

Frontend Scripts

  • npm run dev - Start Vite development server
  • npm run build - Build for production
  • npm run preview - Preview production build
  • npm run lint - Run ESLint

πŸ” API Endpoints

Authentication Routes (/api/users)

  • POST /register - User registration
  • POST /login - User login
  • GET /profile - Get user profile (protected)
  • PUT /profile - Update user profile (protected)

Recipe Routes (/api/recipes)

  • GET / - Get all recipes (with pagination)
  • GET /:id - Get single recipe by ID
  • POST / - 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 user
  • POST /:id/like - Like/unlike recipe (protected)

πŸ–ΌοΈ Frontend Pages

Public Pages

  • Home (/) - Recipe discovery with search and filtering
  • Recipe Detail (/recipes/:id) - Detailed recipe view
  • Login (/login) - User authentication
  • Register (/register) - New user registration

Protected Pages (Requires Login)

  • Create Recipe (/create-recipe) - Add new recipe
  • Edit Recipe (/edit-recipe/:id) - Modify existing recipe
  • Profile (/profile) - User dashboard with personal recipes

🎨 Design Features

Responsive Design

  • Mobile-first approach
  • Breakpoints: 480px, 768px, 992px, 1200px
  • Touch-friendly interface for mobile devices

UI/UX Features

  • 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

πŸ§ͺ Testing

Manual Testing Checklist

  • 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

πŸš€ Deployment

Backend Deployment (Heroku/Railway)

  1. Set environment variables on platform
  2. Connect GitHub repository
  3. Deploy automatically on push to main branch

Frontend Deployment (Vercel/Netlify)

  1. Connect GitHub repository
  2. Set build command: npm run build
  3. Set output directory: dist
  4. Add environment variables for API URL

Environment Variables for Production

# Frontend .env
VITE_API_URL=https://your-backend-url.com/api

# Backend production
NODE_ENV=production
PORT=process.env.PORT

πŸ” Troubleshooting

Common Issues

MongoDB Connection Error

Error: MongoDB Connection Error

Solution: Check your MONGO_URI in .env file and ensure MongoDB is accessible

Cloudinary Upload Error

Error: Cloudinary upload failed

Solution: Verify Cloudinary credentials and ensure file size limits

CORS Issues

Error: CORS policy error

Solution: Backend CORS is configured for localhost:5173, adjust if needed

Port Already in Use

Error: Port 5000 already in use

Solution: Change PORT in .env file or kill existing process

πŸ“ž Support

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!

About

Full-Stack Recipe Sharing Platform 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.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages