Mod 1 Project Week — Build a CLI App
Overview
In class, we studied the Task Manager Case Study application. For this project, you will use this task manager application as a guide for building something new!
Your task is to create an interactive command-line application using Node.js to demonstrate your understanding of JavaScript fundamentals, your systems-level thinking skills, and your ability to organize code into a well-structured application.
Project Options
Choose one of the following three projects to complete. They are ordered by difficulty, so pick the one that matches your comfort level and goals:
🎮 Project 1: Rock–Paper–Scissors (Simplest, but still a challenge!) Build a classic game where users play against the computer with score tracking across multiple rounds.
🛒 Project 2: Shopping List Manager (Similar to the task manager but with more complexity) Create a CRUD application where users can add, remove, and view items in their shopping list through a menu system.
🧠 Project 3: Quiz Game (The most challenging and new!) Develop a multiple-choice quiz application with questions, scoring, and replay functionality.
Once you have chosen your project, read through the sections below and then look for your project-specific requirements in their appropriate section of this document.
Tips / Common Mistakes to Avoid
For many of you, this will be the first "real" project that you build. This is an exciting opportunity! However, it can also become a frustrating one if you take the wrong approach. Here are some common mistakes to avoid and what you can do instead.
Trying to build everything at once
Build ONE feature, test it, commit, then move on
Writing lots of code before testing
Test after every 5-10 lines of code
Trying to write everything from scratch
Use the Task Manager Case Study as a guide for building your project! Take what you need, make what you need!
Copying the example without understanding it
Type the code yourself and make changes to match YOUR project
Forgetting to export/import functions
Check that every function you call is exported from its file and imported where you use it
Not committing often enough
Commit every time something works! You can always go back.
Getting Started
Setup Instructions
Once you have chosen your project, complete the following steps to get started:
Go to the swe-project-1-cli-app template repository and click "Use this template" to create a new repository. Set yourself as the owner and give your project a descriptive name!
Clone your repo down to your computer.
Run
npm init -y.Install
prompt-syncwithnpm install prompt-sync.Add, commit, and push all files with the commit message
"initializing project"
Git Workflow
To ensure that your main branch contains the most up-to-date working version of your application, you should use this workflow:
Project Grading
We care deeply about the quality of the code that is produced at Marcy. Even if your application works as described, was it created following best practices? Did you effectively use all of the skills from the module? Were you able to learn and grow from this project-building process?
To ensure that your project meets Marcy's standards of excellence, your project will be assessed on the following criteria (22 points total):
Technical Details (15 points)
Core JavaScript Concepts (7 points)
Code Organization (4 points)
User Interaction (4 points)
Reflection (2 points)
Professionalism & Craftsmanship (5 points)
Technical Details (15 points)
Technical details are broken up further into three groups:
Core JavaScript Concepts (7 points)
Variables: Uses clear, descriptive names that explain what data they hold
Functions: Breaks code into multiple functions that each handle specific tasks
Conditionals: Includes at least one
if/elsestatement that changes behavior based on user inputLoops: Uses at least one
whileloop to repeatedly prompt the userString Methods: Uses string methods (like
.toLowerCase(),.trim(), etc.) to validate user inputHigher Order Array Methods: Uses at least one array higher-order method (like
.forEach(),.filter(),.reduce(), etc...)Objects: Uses at least one object to organize related data together
Code Organization (4 points)
Split your code into at least 3 separate modules (files)
Use
require()andmodule.exportsto connect your modulesFollows a logical file structure:
index.js— the entry point of the application that displays a menu to the user.menu.js— handles the main menu loop and handles user input.A data layer (choose a name!) — handles the logic related to managing the data for your application.
A
package.jsonfile exists and includes dependencies for the project
User Interaction (4 points)
Creates an interactive experience that responds to user choices using the
prompt-syncpackageProvides warning messages when invalid input is provided and allows the user to try again.
Provides confirmation messages when user actions are completed.
All messages printed to the console have consistent spacing and are free of spelling and grammar mistakes.
Reflection (2 points)
In REFLECTIONS.md, respond to the prompts below. Your responses should each contain about 150-250 words and demonstrate thoughtful reflection.
Which project requirement did you find most challenging and how did you overcome this challenge? Be specific in your response.
Share one technical concept that you gained a deeper understanding of through building this project. Explain that concept in simple terms and explain how it is used in your project.
Professionalism & Craftsmanship (5 points)
Code is functional and free of bugs. Does not throw errors when used under expected circumstances.
Code is well-organized, spacing is consistent, variable/function names are descriptive, comments are concise and purposeful, and no unused code remains.
Commits are small, frequent, and have meaningful commit messages.
A branch is used for development while the
mainbranch is always functionalThe
README.mdincludes setup instructions, usage examples, and clear explanation of functionality. All writing in theREADME.mdfile and theREFLECTIONS.mdfile is polished and free of typos and grammatical errors.
How to Submit
When you have finished your application, merge everything into the main branch and push! Then, submit the URL to your GitHub repository on Canvas. No need to make a pull-request.
🎮 Project 1: Rock–Paper–Scissors CLI Game
Objective: Build a simple Rock–Paper–Scissors game where the user plays against the computer. The program should keep score across multiple rounds until the player decides to quit.
Key Features to Implement:
When a user starts the application, they are greeted with a nice message and are presented with a menu of options:
The user can enter a number, 1 through 3, to select their next action.
When playing, the user can select their choice by typing "rock", "paper", or "scissors" (case-insensitive).
The computer responds by randomly selecting "rock", "paper", or "scissors".
The game compares the choices and determines the winner based on standard Rock-Paper-Scissors rules (rock beats scissors, scissors beats paper, paper beats rock).
After each round, the game displays the choices and the result:
When viewing stats, the user can see games won, games lost, games tied, total games played, and win rate as a rounded percentage.
The game continues until the user chooses to quit, then displays final statistics.
Data Structure
Use an object to store game data. The object should look like this:
Stretch Features to Consider:
Add a "best of X rounds" mode where the game continues until someone wins a certain number of rounds
Add sound effects or ASCII art for different choices (rock, paper, scissors)
Track and display win streaks and longest winning/losing streaks
Allow saving/loading game statistics to/from a JSON file using the
fsmodule
🛒 Project 2: Shopping List CLI App
Objective: Create a CLI shopping list manager where users can add, remove, and view items through a menu system.
Key Features to Implement:
When a user starts the application, they are greeted with a nice message and are presented with a menu of options:
The user can enter a number, 1 through 4, to select their next action.
When adding an item to the list, the user can specify the
nameof the item, thequantity, and theprice. The user should then see a message summarizing the items they have added.When removing an item from the list, the user can specify the
nameof the item (case insensitive) and thequantityto remove. For example, if a user wants to remove two apples, the user interaction might look like this:When viewing the list, the user can see the total quantity of items in the list and the total price.
After selecting an action, the application displays a message to confirm the completion of their action.
After selecting an action, the menu is shown again to the user and they are prompted to choose their next action.
Data Structure
Use an array of objects to store shopping items. Each item should be an object with a name, quantity, and price, like this:
Stretch Features to Consider:
Add an option to sort. Let the user choose between
price,quantity, andnameAdd a
categoryto each item and add it as an option for sortingAdd a budget feature that warns when total cart value exceeds a set amount
Allow saving/loading shopping lists to/from a JSON file using the
fsmoduleAdd a "shopping mode" that lets users check off items as they shop
Add support for multiple shopping lists (e.g., groceries, hardware, gifts)
🧠 Project 3: Quiz Game CLI
Objective: Build a multiple-choice quiz game where users answer questions, get feedback, and see their score at the end.
Key Features to Implement:
When a user starts the application, they are greeted with a nice message and presented with a menu of options:
The user can enter a number, 1 through 3, to select their next action.
When starting a quiz, the application presents questions one at a time with multiple choice options. Each question displays the question text and numbered choices for the user to select from. For example:
After answering each question, the user receives immediate feedback on whether their answer was correct.
At the end of the quiz, the user sees their final score and percentage (rounded) of correct answers.
If the user's score is in the top 5, they are prompted again to enter their name to add their score to the high score leaderboard.
When viewing high scores, users can see the top 5 scores and a
Datetimestamp when the quiz was completed:After completing an action, the menu is shown again and the user is prompted to choose their next action.
Data Structure
Use an array of objects to store quiz questions. Each question should be an object with a question string, a choices array, and an answerIndex indicating the index of the answer in choices, like this:
In addition, use a separate array of objects to store high score history. Each score should be an object with a name, a score (representing percentage), and a date, like this:
Stretch Features to Consider:
Add different categories of questions (math, science, history, etc.) and let users choose their preferred category
Implement a difficulty system with easy, medium, and hard questions
Add a timer for each question to create a more challenging experience
Allow saving/loading quiz results and high scores to/from a JSON file using the
fsmodule
Stuck Getting Started?
If you're feeling stuck and don't know where to start, follow these steps. Each phase builds on the previous one, so don't skip ahead!
Phase 1: Get a Menu Working (Start Here!)
Goal: Display a menu and respond to user input. Nothing else.
Create
index.js— This is your entry point. For now, it should just call ashowMenu()function from themenufile. You can also print out some welcome/goodbye messages:Create
menu.js— This file handles user interaction. Start with just a menu that prints and exits:Run it! Type
node index.jsin your terminal. Does it print the menu and capture your input? Great! Commit your progress.Add a loop — Make the menu repeat until the user chooses "Exit":
Run and test it again! Can you select options and exit? Commit your progress.
Phase 2: Create Your Data Structure
Goal: Set up the data your app will manage.
Create a third file for your data — Name it based on your project:
Rock-Paper-Scissors →
gameData.jsShopping List →
shoppingList.jsQuiz Game →
quizData.js
Define your starting data — Look at the "Data Structure" section for your project. Create the initial data and export it:
Import your data into
menu.jsand print it to verify it works:Run and verify, then commit your progress.
Phase 3: Implement ONE Feature at a Time
Goal: Build each menu option one at a time. Don't move on until the current feature works!
Pick your FIRST feature (the easiest one):
Rock-Paper-Scissors: View Stats (just print the data)
Shopping List: View List (just print the data)
Quiz Game: View High Scores (just print the data)
Create a function for this feature in your data file:
Call that function from your menu:
Run and test it! Then commit.
Now pick your SECOND feature (the main action):
Rock-Paper-Scissors: Play Round
Shopping List: Add Item
Quiz Game: Start Quiz
Write a function for this feature. Break it into smaller steps:
What input do you need from the user?
What logic needs to happen?
What message should you show the user?
Test after EVERY small change. Don't write 50 lines and then test.
Commit after each feature works.
Continue until all features work!
Phase 4: Polish and Validate
Goal: Handle edge cases and make the experience smooth.
Add input validation — What if the user types something unexpected?
Test edge cases:
What if the user enters nothing (just presses Enter)?
What if they enter letters when you expect numbers?
What if they try to remove an item that doesn't exist?
Add helpful error messages:
Clean up your code:
Remove any
console.log()statements you used for testingMake sure variable names are descriptive
Add comments where the logic is complex
Final test — Run through your entire app like a user would. Does everything work smoothly?
Submission Checklist
Last updated