Skip to content

AmmarSathar/MasterChef

Repository files navigation

SOEN 341 Group Project - Team CookWise

Team Members

ID Name Github Username
40182146 Ammar Abdul Sathar @AmmarSathar
40268729 Navnit Chittoo @navnit7
40314694 Charrat Mohamed Taha @Nickeldon
40299470 Paulina Aguayo Dupin @paulinadupin
40248501 Nicolas Lopez Callupe @nlopezcallupe
40029237 Joey Chan @bitofsomething

Objective

The objective of this project is to develop a web app that allows students to plan meals, track groceries, and propose recipes.

Project

The web app includes 5 key features:

  • Feature 1: User account management
  • Feature 2: Recipe management
  • Feature 3: Weekly meal planner
  • Feature 4: Calendar and dashboard enhancements
  • Feature 5: Recipe import from URL (with AI-assisted parsing fallback)
    • AI Attribution: Feature 5 uses OpenAI-based extraction as an optional fallback when structured parsing is incomplete.

The web app was completed across 4 sprints:

  • Sprint 1: Setup GitHub; prepare sprint plan and user stories; implement Feature 1
  • Sprint 2: Setup continuous integration pipeline; create acceptance tests for Sprint 1 stories; implement Feature 2
  • Sprint 3: Create unit tests for Feature 1 and Feature 2; implement Feature 3 and Feature 4
  • Sprint 4: Expand unit/integration testing, static-analysis maintenance, final report/documentation, and project stabilization

Project Management


Tech Stack

  • Frontend: React 19 + TypeScript
  • Build Tool: Vite 6
  • Styling: Tailwind CSS 4
  • Testing: Vitest + React Testing Library + Playwright
  • Routing: React Router DOM 7

Getting Started

Prerequisites

  • Node.js 18+
  • npm

Installation

From the project root:

npm install

This installs dependencies for all workspaces (frontend, backend, shared).

Development

Start both frontend and backend:

npm run dev

Or run individually:

npm run dev:frontend   # Frontend only (port 3000)
npm run dev:backend    # Backend only (port 4000)

Testing

npm test                # Run frontend + backend unit/integration tests
npm run test:frontend   # Frontend tests only
npm run test:backend    # Backend tests only
npm run e2e             # Playwright end-to-end tests

Coverage (workspace-level):

npm run test:coverage -w frontend
npm run test:coverage -w backend

Production Build

npm run build         # Build all workspaces
npm run build:frontend
npm run build:backend

Linting

npm run lint          # Lint frontend and backend

Continuous Integration

GitHub Actions workflow: .github/workflows/ci.yml

  • Triggered on every push and pull request
  • Uses ubuntu-latest with Node.js 20
  • Pipeline steps:
    • npm ci
    • npm test
    • npx playwright install --with-deps
    • npm run e2e

Project Structure

Frontend

frontend/
- src/
- tests/                    # Frontend test suite (Vitest + RTL)
- index.html
- vite.config.ts
- vitest.config.ts
- package.json

Backend

backend/
- src/                      # App, routes, controllers, services, models, utils
- tests/                    # Backend unit/integration tests
- vitest.config.ts
- package.json

Scripts

Run all commands from the project root:

Script Description
npm run dev Start frontend and backend together
npm run dev:frontend Start frontend only (port 3000)
npm run dev:backend Start backend only (port 4000)
npm run build Build all workspaces
npm run build:frontend Build frontend only
npm run build:backend Build backend only
npm test Run frontend + backend tests
npm run test:frontend Run frontend tests only
npm run test:backend Run backend tests only
npm run e2e Run Playwright end-to-end tests
npm run lint Lint frontend and backend

Coding Standards

Coding standards are clearly defined and effectively communicated to the team through the Wiki.


Infrastructure

For CookWise, we initially went with a full-stack approach using React and Next.js. After further reconsideration, we chose a more standard approach using ReactJS + ViteJS for the frontend and Node.js + Express.js for the backend, encapsulated as a monorepo. This stack was chosen to offer the best performance-to-simplicity ratio for our application.

Frontend dependencies:

Backend:

  • Express.js, performant and scalable HTTP server with a fast learning curve
  • MongoDB, document-oriented model suited for flexible data structures throughout development

Core framework repositories: ReactJS | ViteJS | Node.js


Naming Conventions

Kebab-case, Node.js / TypeScript backend files and API routes

camelCase, variables, functions, and MongoDB fields

PascalCase, React components, interfaces, and types

UPPER_SNAKE_CASE, constants


Key Source Files

File Purpose
backend/src/app.ts App setup: mounts BetterAuth handler, CORS, routes, and global error handling
backend/src/lib/auth.ts Better Auth configuration: email/password + OAuth (Google/GitHub) with extended user fields
backend/src/models/recipe.model.ts Core Mongoose Recipe schema: ingredients, dietary tags, allergen computation, and text search index
backend/src/services/recipe.service.ts Business logic layer for recipes: CRUD, search, filtering, dietary tag helpers, and recommendation logic
frontend/src/context/UserContext.tsx Global auth/user state: provides session data and logout via BetterAuth's useSession() hook

Testing and Continuous Integration

Testing Strategy

The project uses a layered automated testing strategy across the frontend and backend:

  • Frontend unit tests use Vitest with React Testing Library in a jsdom environment to validate component behavior, state changes, API payload construction, and error handling.
  • Backend unit and service-level tests use Vitest in a Node environment. Logic that depends on MongoDB models is tested against mongodb-memory-server, an isolated in-memory database, instead of a shared external database.
  • End-to-end tests use Playwright to validate critical user flows such as registration, login/logout, and profile/preferences behavior in a real browser environment.

A current run of npm test passes with 23 frontend tests and 63 backend tests.

5 Important Unit Tests

Test File Testing Objective
frontend/tests/Login.test.tsx Ensure invalid passwords are rejected before submission, enforcing account-security rules and avoiding unnecessary backend requests
frontend/tests/RecipeCrudFlow.test.tsx Verify the full recipe-management workflow and confirm that create, update, and delete requests send the correct authenticated owner data
frontend/tests/AccountPreferences.test.tsx Confirm that preference changes are preserved correctly and sent to the backend in the expected payload format
backend/tests/recipe-search-filter.service.test.ts Validate the core search feature by proving that keyword search, time filters, and difficulty filters combine correctly and return accurate result sets
backend/tests/meal-plan-entry.service.test.ts Protect data ownership by ensuring a user cannot modify another user's meal plan entry, even when the referenced recipe is otherwise valid

3 Important Acceptance Tests

Test File User Story
e2e/registration.spec.ts A new user can register, complete the onboarding preferences flow, and reach the dashboard
e2e/login-logout.spec.ts A registered user can log in, remain authenticated across pages, and be redirected to login after logging out
e2e/profile-preferences.spec.ts A user can update dietary preferences and allergies and see the changes persisted after a page reload

Continuous Integration Environment

The project uses GitHub Actions for continuous integration, configured in .github/workflows/ci.yml.

  • Trigger policy: runs on every push to any branch and on every pull request
  • Runner: ubuntu-latest
  • Runtime: Node.js 20 with npm dependency caching enabled
  • Environment: test environment variables are injected in the workflow, including fallback values for Better Auth and OAuth credentials when GitHub secrets are not defined

Pipeline steps:

  1. Check out the repository
  2. Install dependencies with npm ci
  3. Run the workspace test suite with npm test
  4. Install Playwright browsers with npx playwright install --with-deps
  5. Run browser end-to-end tests with npm run e2e

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages