iGotha is an open-source chat application designed for seamless communication. It supports user registration, authentication, and chat functionality, making it ideal for personal or collaborative use. Whether you're a developer looking to contribute or a user exploring its features, iGotha is easy to set up and use.
The objective of this project is to provide developers and engineers experience working with an open source project and also allow experience developers and engineers who hasnt work with node.js and it related technologies to be able contribute easily as the project is structured in a way that allows for easy integrations of news contributors. The project will also act as go to project to allow contributors to be able to show case it to there respected employer as soloproject they have contributed to in the past.
iGotcha/
└── frontend/
└── backend/
└── CODE_OF_CONDUCT.md
└── CONTRIBUTING.md
└── LICENSE
└── README.md
└── .gitignore
└── .github/
- Real-time Messaging: Chat with users or groups in real-time.
- User Authentication: Secure login and registration system.
- Group Chats: Create and manage group conversations effortlessly.
- Scalability: Built using modern technologies like React, Redux, Node.js, and Sequelize for scalability and performance.
The frontend is built using React and Redux. It provides a user interface for user registration, login, and chat functionality. The frontend is organized into the following components:
The frontend components are organized as follows:
iGotcha/
└── frontend/
├── src/
│ ├── components/
│ │ ├── Chat.js
│ │ ├── ChatInput.js
│ │ ├── ChatList.js
│ │ ├── LoginForm.js
│ │ ├── RegisterForm.js
-
Clone the repository and Navigate to directory:
git clone <https://github.com/rohteemie/iGotha.git> cd <frontend>
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory and add the following environment variables:
API_ENDPOINT=localhost:3000
# Run the command below in terminal
~/iGotha/frontend: npx dev start
You can now access the iGotha page at http://localhost:8000
This backend is built using node.js. It provides a user interface for user registration, login, and chat functionality. The frontend is organized into the following components:
-
Clone the repository:
git clone <https://github.com/rohteemie/iGotha.git> cd <backend>
-
Install dependencies:
npm install
-
Start MySQL:
# First check to see if mysql is installed on your local machine.
mysql --version
If mysql is not installed, Kindly reference the following link to install mysql on your local machine: Install MySQL
# If mysql is installed,
# Start MySQL on your local machine using the following command:
sudo service mysql start
# sign in to mysql
mysql -u root -p
# Enter your MySQL password when prompted.
mysql> SHOW DATABASES;
You should see a list of databases and select the preferable one to use, otherwise you will have to create a new one using the command below assuming you want to name the database testDB
/* Command to create the database. */
CREATE DATABASE testDB;
/* Exit the MySQL shell. */
mysql> exit;
- Set the environment variables:
Create a .env
file in the iGotha/backend directory and add the following environment variables:
DB
, DB_USER
, DB_PASSWORD
, DB_HOST
, and DB_DIALECT
environment variables in the .env
file.
DB=testDB
DB_USER=dbUser
DB_PASSWORD=dbPassword
DB_HOST=localhost
DB_DIALECT=mysql
JWT_SECRET=secret
EXPIRE_IN=1h
Replace testDB
, dbUser
, and dbPassword
with your MySQL database name, username, and password respectively.
-
Run the migrations:
Run the migrations to create the necessary tables in the database.
npx sequelize-cli db:migrate
-
Start the server:
npm start
-
Access the API:
You can now access the API at
http://localhost:3000
.
The backend routes are organized as follows:
iGotcha/
└── backend/
├── models/
├── services/
├── routes/
├── middleware/
├── config/
├── helper/
├── tests/
├── websocket/
This backend provides the following routes:
Route Path | HTTP Method | Description |
---|---|---|
/auth/login |
POST | Logs in a user |
/user |
GET | Fetches all users |
/user/create |
POST | Registers a new user |
/user/:username |
GET | Fetches a user by username |
/user/:username |
PUT | Updates a user by username |
/chat/ |
GET | Fetches all chats by users |
/chat/create |
POST | Create a new chat |
/chat/:chatId |
GET | Fetches a chat using it ID |
/group/ |
POST | Create a new group |
/group/ |
GET | Fetches all the group info |
/group/:groupId |
GET | Fetches group info using it ID |
/group/:groupId |
POST | Post messages to a group by ID |
/group/add |
PUT | Use to add a user to a group |
Authentication Routes (auth.route.js) File Path: /home/fin/backend/routes/auth.route.js
Description: This file contains routes for user authentication. Endpoints
Login User URL: /auth/login Method: POST Description: Authenticates a user and returns an access token upon successful login. Controller Function: auth.login Example: json Copy code { "email": [email protected], "password": "password123" }
User Routes (user.route.js) File Path: /home/fin/backend/routes/user.route.js Description: This file contains routes for user operations such as fetching, creating, and updating user information. Endpoints
Get All Users URL: /user Method: GET Description: Retrieves a list of all registered users. Controller Function: user_service.getAllUsers
Create a New User URL: /user/create Method: POST Description: Registers a new user in the system. Controller Function: user_service.registerUser Example: json Copy code
{
"username": "newuser",
"email": <[email protected]>,
"password": "securePassword123"
}
Get User by Username URL: /user/:username Method: GET Description: Fetches a specific user's details using their username. Controller Function: user_service.getUserName
Update User by Username URL: /user/:username Method: PUT Description: Updates information for a specific user identified by their username. Controller Function: user_service.updateUser Example: json Copy code
{
"email": <[email protected]>
}
Notes Middleware: Authentication and validation middlewares should be implemented as needed. Error Handling: All routes should have error handling to manage invalid input and server errors. License This project is licensed under the MIT License - see the LICENSE file for details.
Kinldy refer to the license page here: LICENSE