CMORSS-Tic-Tac-Toe is a web-based Tic-Tac-Toe game developed as a submission for the qualification stage of the ALX SE Face-Off Cup. This project showcases a modern, feature-rich implementation of the classic game using the MERN stack (MongoDB, Express.js, React, Node.js), enhanced with TailwindCSS for styling and Socket.io for real-time multiplayer functionality.
This was a collaborative projects of Six Software Engineering Students of the ALX Fullstack Software Engineering Programme, coming from different Cohorts from C18 to C22.
- Player vs AI mode
- Real-time multiplayer mode using Socket.io
- Client-side routing and authentication
- State management for user preferences
- Responsive design for mobile and desktop
- Frontend: React.js with TypeScript
- Backend: Node.js with Express.js with Typescript
- Database: MongoDB
- Real-time Communication: Socket.io
- Styling: TailwindCSS
- Build Tool: Vite
- Version Control: Git & GitHub
- Web Server: Nginx
- Node.js (v14 or later)
- MongoDB
- npm or yarn
CMORSS-Tic-Tac-Toe/
│
├── frontend/ # Frontend React application
│ ├── src/
│ │ ├── components/ # Reusable React components
│ │ ├── context/ # React context for state management
│ │ ├── pages/ # Page components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── types/ # Type Definitions
│ │ ├── utils/ # Utility functions
│ │ ├── App.css
│ │ ├── App.tsx # Main React component
│ │ ├── index.css
│ │ └── main.tsx # Entry point for the application
│ │
│ ├── public/ # Public assets
│ └── vite.config.js # Vite configuration
| |__ .env # environment variables
| |__ package.json # node.js frontend dependencies
│
├── backend/ # Backend Node.js/Express application
│ ├── src/
│ │ ├── controllers/ # Request handlers
│ │ ├── models/ # Database models
│ │ ├── routes/ # API routes
│ │ ├── middleware/ # Custom middleware
│ │ └── app.js # Express app setup
│ │
│ └── socket/ # Socket.io setup and event handlers
│ |__ .env # Environment variables
| |__ package.json # Node.js dependencies for the backend
|
├── .gitignore
└── README.md
-
Clone the repository:
git clone https://github.com/RyanTk03/CMORSS-Tic-Tac-Toe.git cd CMORSS-Tic-Tac-Toe/frontend
-
Install dependencies:
npm install
or
yarn install
-
Setup environment variables
- Create a .env file in the frontend directory with this content.
`VITE_SOCKET_SERVER="http://localhost:3000"` # if your backend is running on port 3000
-
Start the development server:
npm run dev
or
yarn dev
-
Open your browser and navigate to
http://localhost:5173
to view the application. -
Build for production
npm run build
or
yarn build
-
Serve the production build
npm run preview
or
yarn preview
-
Clone the repository:
git clone https://github.com/RyanTk03/CMORSS-Tic-Tac-Toe.git cd CMORSS-Tic-Tac-Toe/backend
-
Install dependencies:
npm install
or
yarn install
-
Setup Environment variables
- create .env file in the backend directory with env variables that includes
`MONGODB ='your mongodb url'`
`JWT_SECRET = 'XXXXX'`
`PORT=3000`
-
Start the development server:
npm run dev
or
yarn dev
-
Open your browser and navigate to
http://localhost:3000/api/hello
to check if the backend is running correctly. -
Build for production
npm run build
or
yarn build
-
Serve the production build
npm run start
This project is licensed under the MIT License - see the LICENSE file for details.
- ALX SE for organizing the Face-Off Cup
- The open-source community for the amazing tools and libraries used in this project