Week 7 - Project

School management CLI application

Command specifications

Technical interview

Back to core program

Description

You were asked to write a CLI application for a school. The school needs to maintain a list of trainees and courses, and manage the participation of trainees in a specific course.

The application must allow the school to create, update, delete, and view trainees and courses, as well as enroll and remove trainees from courses. The data must be saved locally, so your program needs to correctly store information and load it again when the application runs.

This project simulates a simple real-world management system. You will need to design clear commands, check that user input is valid, handle errors in a consistent way, and make sure the connection between trainees and courses always stays correct. The focus is on clear program structure, logical thinking, and reliable data handling in a Node.js CLI application.

Core functionalities

Starter code

We have provided a template repository with starter code. You can find it here

https://github.com/HackYourFuture/school-manager-template

Make sure to fully read the README file to understand the structure of the project.

Entities

This section specifies what information we store for each entity in the application. Pay attention to the property type and notes.

Trainee

Property Type Notes
ID number A random number between 0 and 99999
firstName string
lastName string

Course

Property Type Notes
ID number A random number between 0 and 99999
name string Course name
startDate string ISO8601 date format: yyyy-MM-dd
participants array List of trainee IDs who are participating in this course. Example: [124, 5554, 9998]

Business rules

  1. A trainee cannot join more than 5 courses
  2. Each course has max capacity of 20 trainees.

User input loop

When launching your application, display a prompt and wait for user input. After each input, parse the command, validate it and execute it. Report any errors if needed. After finishing processing the command, return to the prompt and wait for the next command.

node app.js
> COMMAND1
output
> COMMAND2
output
...

CLI Commands

The commands in the system are in the following format:

<COMMAND> <SUB_COMMAND> <PARAMETER1> <PARAMETER2> ...

For example:

TRAINEE ADD John Doe

Parsing and validation

A complete specification of the commands to implement is found in Command specifications

Requirements

  1. Your application must run without any errors.
  2. Implement all the required commands exactly as specified in Command specifications .
  3. Use prompt-sync or similar method to ask for the user input.
  4. All data must be saved in separate file(s). The application must save the data after closing and reopening.
  5. Use chalk to display errors in red. Feel free to use other colors as you wish.
  6. Save the data of the application in either JSON or CSV format.
  7. Add at least 4 unit tests
  8. Open and merge at least 3 pull requests.

Extra Requirements for pairs

  1. Implement also the bonus commands in Command specifications.
  2. Add at least 8 unit tests rather than 4
  3. You should both commit to a single Github Repository.
  4. Each pull request must be reviewed and approved by the other person before merging.

CC BY-NC-SA 4.0 Icons

*https://hackyourfuture.net/*

Found a mistake or have a suggestion? Let us know in the feedback form.