Skip to content

Kan-06/dishdash

Repository files navigation

🍽️ DishDash — Recipe Discovery Platform

A full-stack recipe web application built with Node.js, Express, EJS, and SQLite.
Features real-time search, veg/non-veg filtering, nutritional scaling, and a working feedback system.

Node.js Express SQLite License


🌐 Live Demo

Deploy link will appear here after Render deployment.


✨ Features

  • 🔍 Real-time recipe search with instant debounced filtering
  • 🟢🔴 Veg / Non-Veg filter across all categories
  • 📊 Dynamic serving scaler — adjusts ingredients and macros from 1–20 people
  • 🗄️ SQLite database with 78+ recipes across 4 categories
  • 📬 Working feedback system — saves to DB, rate-limited, validated, sends email confirmation
  • 🌐 REST APIGET /api/recipes?category=&type=&search=
  • 📱 Fully responsive dark-themed UI
  • 🔒 Security — Helmet.js headers, input sanitization (XSS prevention), rate limiting

🛠️ Tech Stack

Layer Technology
Runtime Node.js
Framework Express.js v5
Templating EJS (Server-side rendering)
Database SQLite via better-sqlite3
Validation express-validator
Rate Limiting express-rate-limit
Security Helmet.js
Email Nodemailer + Gmail SMTP

📁 Project Structure

dishdash/
├── config/
│   └── db.js                  ← SQLite connection + schema creation
├── public/
│   ├── css/styles.css         ← Unified design system
│   ├── js/
│   │   ├── filter.js          ← Shared search/filter logic
│   │   ├── recipe.js          ← Shared serving scaler logic
│   │   └── main.js            ← Nav, toast, utilities
│   └── images/categories/     ← Category hero images
├── src/
│   ├── controllers/
│   │   ├── recipeController.js
│   │   └── feedbackController.js
│   ├── data/
│   │   └── recipes.json       ← Source data for seeding
│   ├── models/
│   │   ├── Recipe.js
│   │   └── Feedback.js
│   ├── routes/
│   │   ├── index.js           ← Page routes
│   │   ├── api.js             ← REST API routes
│   │   └── feedback.js        ← Feedback routes
│   └── views/
│       ├── pages/             ← index, category, recipe, feedback, 404
│       └── partials/          ← navbar, footer
├── seed.js                    ← Initial seed (20 base recipes)
├── seed-breakfast.js          ← 15 breakfast recipes
├── seed-lunch.js              ← 13 lunch recipes
├── seed-snack.js              ← 17 snack recipes
├── seed-dinner.js             ← 13 dinner recipes
├── server.js                  ← Express app entry point
├── .env.example               ← Environment variable template
└── package.json

🚀 Getting Started

Prerequisites

  • Node.js v18+
  • npm

Installation

# 1. Clone the repository
git clone https://github.com/Kan-06/Dish_Dash.git
cd Dish_Dash

# 2. Install dependencies
npm install

# 3. Configure environment variables
cp .env.example .env
# Edit .env with your Gmail credentials (optional — for email confirmation)

# 4. Seed the database
node seed.js
node seed-breakfast.js
node seed-lunch.js
node seed-snack.js
node seed-dinner.js

# 5. Start the server
npm run dev       # Development (auto-restart)
npm start         # Production

Open http://localhost:3000 in your browser.


🔌 API Reference

Method Endpoint Description
GET /api/recipes All recipes
GET /api/recipes?category=breakfast Filter by category
GET /api/recipes?type=veg Filter by dietary type
GET /api/recipes?search=dosa Search by name
GET /api/recipes/:slug Single recipe by slug
POST /submit-feedback Submit user feedback
GET /api/feedback?secret=ADMIN_SECRET View all feedback (admin)

Example:

GET /api/recipes?category=breakfast&type=veg&search=dosa

🗄️ Database Schema

CREATE TABLE recipes (
  id          INTEGER PRIMARY KEY AUTOINCREMENT,
  slug        TEXT UNIQUE NOT NULL,
  name        TEXT NOT NULL,
  category    TEXT NOT NULL,     -- breakfast | lunch | snack | dinner
  type        TEXT NOT NULL,     -- veg | nonveg
  description TEXT,
  prep_time   INTEGER,           -- minutes
  cook_time   INTEGER,           -- minutes
  servings    INTEGER DEFAULT 1,
  calories    INTEGER,
  protein     REAL,
  carbs       REAL,
  fats        REAL,
  ingredients TEXT NOT NULL,     -- JSON array
  instructions TEXT NOT NULL,    -- JSON array
  image_url   TEXT,
  created_at  DATETIME DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE feedback (
  id         INTEGER PRIMARY KEY AUTOINCREMENT,
  name       TEXT NOT NULL,
  email      TEXT NOT NULL,
  rating     INTEGER NOT NULL CHECK(rating BETWEEN 1 AND 5),
  comments   TEXT,
  created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);

🔒 Security Features

  • Helmet.js — sets secure HTTP headers
  • XSS Prevention — all user input sanitized before storage and rendering
  • Rate Limiting — feedback endpoint limited to 5 submissions per 15 minutes per IP
  • Input Validation — server-side validation via express-validator
  • Environment Variables — secrets kept out of source control via .env

🚀 Deployment (Render.com)

  1. Push code to GitHub
  2. Go to render.comNew → Web Service
  3. Connect your GitHub repository
  4. Set build command: npm install && node seed.js && node seed-breakfast.js && node seed-lunch.js && node seed-snack.js && node seed-dinner.js
  5. Set start command: node server.js
  6. Add environment variables from your .env in the Render dashboard
  7. Deploy — live URL in ~5 minutes

Note: Render's free tier uses an ephemeral filesystem; the SQLite .db file resets on redeploy. For persistent storage, attach a Render Disk or migrate to Neon.tech (free PostgreSQL).


👤 Author

Kanishk — 2nd Year CSE Student, NITTE University

GitHub


📄 License

ISC © Kanishk

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors