You are playing the famous TIC TAC TOE game against the Computer. The Computer NEVER lose.
Frontend - UI can be very simple, just to show 3X3 matrix and add X or O.
Backend - build REST API app which handles all requests and memory of your current game. The app must be writen OOP with a readable logic.