An echo loop proves the chip can listen. The next step is for it to decide. The smallest interesting program is one that turns an LED on or off depending on whether the user typed "ON" or "OFF". It looks trivial, but it's the seed of every text-driven device protocol that exists.
Buffer until a delimiter, then dispatch
Bytes arrive one at a time. You can't decide what to do until you've collected a whole "message." The standard pattern: accumulate received characters into a small char buffer; when you see the delimiter (usually newline, '\n'), treat the buffer as a complete command; compare it against known commands; act; clear the buffer.
Watch out for the line ending. The Arduino IDE's serial monitor sends carriage return + newline by default ("\r\n"). Some terminals send just \n. Robust code strips trailing whitespace before comparing, or uses Serial.readStringUntil('\n') which handles the framing for you.
Every console protocol is this, scaled up
The G-code your 3D printer parses, the AT commands a modem accepts, the SMTP your mail server speaks — they're all line-buffered text protocols dispatching on commands. You just wrote one. Adding a third command (BLINK, maybe) is an extra else if; adding arguments is a strtok or a split. The pattern grows without changing.