QAP 3 - Personal Recipe Box

QAP 3 - Personal Recipe Box

Objective

Build a recipe management application using Express and EJS. Users must be able to sign up, log in, create recipes, view them, and manage their own collection. Admins can see all recipes across all users. Due date: July 31st, 2026, at 11:59 PM

Getting Started

  • To help you get started, a base repository has been provided for you to work from. The repository is set up as a GitHub Assignment to help you quickly get started.

Steps to Create Your Own Repository

  1. Click the link and choose your name.
  2. Click “Accept this assignment.”
  3. Clone your newly created repository:
    git clone <your-new-repo-url>
  4. Navigate to the folder and install dependencies:
    cd <your-new-repo-name>
    npm install
  5. Start the app:
    npm start

Requirements

Technology Requirements

  • You are allowed to use additional npm packages to enhance your application. However, ensure that any extra packages are relevant and add value to your project.
  • You must use express-session for login persistence.
  • You must use bcrypt to hash user passwords.
  • All data must be stored in-memory using variables; no database is required.
  • All pages must be created using EJS templates. Do not use other templating engines (e.g., Handlebars, Pug) or frameworks such as React.
  • Your application must run on Node.js using Express for the backend.

Required Pages

  • Home Page
    • Displays a welcome message describing the recipe box application.
    • Shows login and registration buttons.
    • If already logged in, shows a personalized welcome and a link to the My Recipes page.
  • Registration Page
    • Allows users to register with a username, email, and password.
    • Usernames and email addresses must be unique.
    • Passwords must be at least 8 characters in length.
    • Hash passwords using bcrypt before storing them.
  • Login Page
    • Users can log in using email and password.
    • Authenticates using bcrypt password comparison.
    • Redirects to the My Recipes page after login.
  • My Recipes Page (Protected)
    • Lists all recipes created by the logged-in user, showing each recipe’s name.
    • Each recipe name links to the recipe’s detail page.
    • Includes a “Create New Recipe” button.
    • Displays a message if the user has no recipes yet.
    • Admin users see all recipes from all users, with the creator’s username shown for each.
  • Create Recipe Page (Protected)
    • Form with fields: recipe name (required), ingredients (required), and instructions (required).
    • Ingredients and instructions should be text areas to allow multi-line content.
    • On successful creation, redirects to the new recipe’s detail page.
    • Displays validation errors if required fields are missing.
  • Recipe Detail Page (Protected)
    • Shows the full recipe: name, ingredients, instructions, and the username of who created it.
    • Shows a “Delete” button if the recipe belongs to the current user or if the user is an admin.
    • Deleting a recipe removes it and redirects to the My Recipes page.
  • Logout
    • Ends the user’s session and redirects to the Home Page.

Functional Requirements

  • Authentication:
    • Use express-session to authenticate users and persist their login state across requests.
    • Ensure only logged-in users can access protected pages (My Recipes, Create Recipe, Recipe Detail).
    • Redirect unauthenticated users to the login page with an appropriate message.
  • Role-Based Access:
    • Regular users should only see their own recipes on the My Recipes page.
    • Admin users should see all recipes across all users on the My Recipes page.
    • Regular users can only delete their own recipes. Admins can delete any recipe.
  • Recipe Management:
    • Users must be able to create new recipes with a name, ingredients, and instructions.
    • Each recipe must belong to the user who created it.
    • Users must be able to view a list of their own recipes.
    • Users must be able to view the full details of any recipe they have access to.
    • Users must be able to delete their own recipes.
    • No edit/update functionality is required.
  • Error Handling:
    • Display appropriate error messages on the login and registration pages if authentication or validation fails.
    • Follow best practices: avoid revealing whether it was the email or password that was incorrect.
    • Display validation errors on the Create Recipe page if required fields are missing.
    • Handle attempts to access non-existent recipes gracefully (e.g., show a “Recipe not found” message rather than crashing).
  • Security:
    • Hash passwords using bcrypt before storing them.
    • Never store plaintext passwords in memory
    • Ensure users cannot access or delete recipes that do not belong to them (unless they are an admin).
  • Data Storage:
    • Store users in memory using an array of objects.
    • Store recipes in memory using an array of objects.
    • No database is required for this assignment.

Pass Outstanding Criteria

  • Achieve a grade of 80% or above

Submission Guidelines

  • Ensure the application runs correctly (with the npm start command) and all features are implemented as specified.
  • Submissions should be made on Teams under the appropriate assignment.
  • Submissions should only include a link to your GitHub repository containing the completed code for your QAP.
  • The repository used should be the private one provided by the GitHub Classroom assignment. Public repositories from your personal account should not be submitted.
  • Submissions are subject to the Keyin late assessment policy found here
    • If an extension is needed, please reach out to me directly before the assignment due date.

Grading Rubric

CategoryCriteriaPoints
Functionality65
    RegistrationRegisters new users, enforces uniqueness, and hashes passwords with bcrypt.15
    LoginAuthenticates users using sessions and bcrypt password comparison.10
    Recipe CreationLets logged-in users create recipes with name, ingredients, and instructions.15
    Recipe ViewingUsers can see their own recipes; admins can see all recipes.10
    Recipe DeletionUsers can delete their own recipes; admins can delete any recipe.5
    Access ControlUnauthenticated users are redirected to login. Unauthorized access to other users’ data blocked.5
    Error HandlingDisplays appropriate error messages for registration, login, and missing/invalid data.5
Code Quality15
    ReadabilityCode is well-organized and easy to follow (indentation, naming, structure).10
    ModularityLogic is separated into clean, reusable functions and route handlers.5
Git Hygiene10
    Commit FrequencyFrequent, meaningful commits throughout development.5
    Commit QualityCommit messages are clear and descriptive.5
User Experience10
    UI/UXClean, user-friendly interface and consistent design across all pages.10
Total Points100

Good luck! If you have any questions, please don’t hesitate to ask!