A realtime chat application
PingChat is a Realtime chat application where users can talk to strangers anonymously from anywhere in the world. PingChat was created by Ernest Wambua using the popular MERN stack.
- Typescript
- MongoDB
- React with (Typescript) and Vite
- Tailwindcss
- Express JS
- Socket.IO
- NodeJS
In case you encounter any issues when running the application, feel free to reach me via ernestwambua2@gmail.com
First of all you need to clone the contents of this repository using git.
git clone https://github.com/tallninja/Ping-Chat
This is the backend API of the application. It is responsible for handling all the business logic.
From the root folder, move to the api directory.
Next you need to install the dependencies before running the API. You can use a package manager of your own choosing.
npm install
yarn
pnpm install
After all the dependencies have been installed, you need to create a .env file at the root of the api directory. This file contains some of the environment variables used in the API. The file should contain...
BASE_URL=YOUR_DOMAIN eg 'https://my-domain.com' or 'http://localhost' or 'http://127.0.0.1'
MONGO_URI=YOUR_MONGO_URI
SESSION_SECRET=YOUR_AUTH_SESSION_SECRET eg 'jhskdkasdsakbn'
Now that everything is set up, you can run the API using the following command...
npm run dev
This is the frontend of the application. This is where the users interract with the application.
From the root folder move to the client directory. Just like the backend API we also need to install client dependencies.
npm install
yarn
pnpm install
After all the dependencies have been installed, you need to create a .env file at the root of the client directory. This file contains some of the environment variables used in the client. The file should contain...
VITE_API_URL=YOUR_API_URL eg 'http://localhost:5000' this is the URL to the backend API
Now that everything is set up, you can run the client using the following command...
npm run dev
This is the socket server. It is responsible for the realtime communication between users. From the root folder move to the socket directory and install the dependencies
npm install
yarn
pnpm install
After all the dependencies have been installed, you need to create a .env file at the root of the socket directory. This file contains some of the environment variables used in the client. The file should contain...
CLIENT_URL=YOUR_CLIENT_URL eg 'http://localhost:5173' this is the URL to the client application
Now that everything is set up, you can run the API using the following command...
npm start
.
βββ api
βΒ Β βββ node_modules
βΒ Β βββ nodemon.json
βΒ Β βββ package.json
βΒ Β βββ pnpm-lock.yaml
βΒ Β βββ requests.http
βΒ Β βββ src
βΒ Β βΒ Β βββ controllers
βΒ Β βΒ Β βΒ Β βββ auth.controller.ts
βΒ Β βΒ Β βΒ Β βββ conversation.controller.ts
βΒ Β βΒ Β βΒ Β βββ index.ts
βΒ Β βΒ Β βΒ Β βββ message.controller.ts
βΒ Β βΒ Β βΒ Β βββ user.controller.ts
βΒ Β βΒ Β βββ middlewares
βΒ Β βΒ Β βΒ Β βββ auth.middleware.ts
βΒ Β βΒ Β βΒ Β βββ index.ts
βΒ Β βΒ Β βββ models
βΒ Β βΒ Β βΒ Β βββ Conversation.ts
βΒ Β βΒ Β βΒ Β βββ index.ts
βΒ Β βΒ Β βΒ Β βββ Message.ts
βΒ Β βΒ Β βΒ Β βββ User.ts
βΒ Β βΒ Β βββ routes
βΒ Β βΒ Β βΒ Β βββ auth.routes.ts
βΒ Β βΒ Β βΒ Β βββ conversation.routes.ts
βΒ Β βΒ Β βΒ Β βββ index.ts
βΒ Β βΒ Β βΒ Β βββ message.routes.ts
βΒ Β βΒ Β βΒ Β βββ user.routes.ts
βΒ Β βΒ Β βββ server.ts
βΒ Β βββ tsconfig.json
βββ client
βΒ Β βββ index.html
βΒ Β βββ node_modules
βΒ Β βββ package.json
βΒ Β βββ pnpm-lock.yaml
βΒ Β βββ postcss.config.cjs
βΒ Β βββ public
βΒ Β βΒ Β βββ smartphone-mobile-alert-SBA-300463374-preview.mp3
βΒ Β βΒ Β βββ vite.svg
βΒ Β βββ src
βΒ Β βΒ Β βββ api
βΒ Β βΒ Β βΒ Β βββ index.ts
βΒ Β βΒ Β βββ App.tsx
βΒ Β βΒ Β βββ assets
βΒ Β βΒ Β βΒ Β βββ react.svg
βΒ Β βΒ Β βββ components
βΒ Β βΒ Β βΒ Β βββ BrandLogo.tsx
βΒ Β βΒ Β βΒ Β βββ ChatBubble.tsx
βΒ Β βΒ Β βΒ Β βββ ChatWindow.tsx
βΒ Β βΒ Β βΒ Β βββ ConvoList.tsx
βΒ Β βΒ Β βΒ Β βββ Convo.tsx
βΒ Β βΒ Β βΒ Β βββ index.ts
βΒ Β βΒ Β βΒ Β βββ MessagePrompt.tsx
βΒ Β βΒ Β βΒ Β βββ PersisLogin.tsx
βΒ Β βΒ Β βΒ Β βββ ProtectedRoute.tsx
βΒ Β βΒ Β βΒ Β βββ SideMenu.tsx
βΒ Β βΒ Β βΒ Β βββ UserCard.tsx
βΒ Β βΒ Β βΒ Β βββ UsersList.tsx
βΒ Β βΒ Β βββ context
βΒ Β βΒ Β βΒ Β βββ AuthContext.tsx
βΒ Β βΒ Β βΒ Β βββ ConversationContext.tsx
βΒ Β βΒ Β βΒ Β βββ index.ts
βΒ Β βΒ Β βΒ Β βββ SocketContext.tsx
βΒ Β βΒ Β βββ hooks
βΒ Β βΒ Β βΒ Β βββ index.ts
βΒ Β βΒ Β βΒ Β βββ useApi.ts
βΒ Β βΒ Β βΒ Β βββ useAuthContext.ts
βΒ Β βΒ Β βΒ Β βββ useConvoContext.ts
βΒ Β βΒ Β βΒ Β βββ useSocketContext.ts
βΒ Β βΒ Β βββ index.sass
βΒ Β βΒ Β βββ main.tsx
βΒ Β βΒ Β βββ pages
βΒ Β βΒ Β βΒ Β βββ Home.tsx
βΒ Β βΒ Β βΒ Β βββ index.ts
βΒ Β βΒ Β βΒ Β βββ Login.tsx
βΒ Β βΒ Β βΒ Β βββ Signup.tsx
βΒ Β βΒ Β βββ vite-env.d.ts
βΒ Β βββ tailwind.config.cjs
βΒ Β βββ tsconfig.json
βΒ Β βββ tsconfig.node.json
βΒ Β βββ vite.config.ts
βββ images
βββ index.html
βββ README.md
βββ socket
βββ index.ts
βββ node_modules
βββ package.json
βββ pnpm-lock.yaml
βββ tsconfig.json
I really enjoyed creating this. I learned a lot in the process. It is far from perfect but I will continue to make it better.
Enjoy :)


