Read the full tutorial here: >> How to build an Instagram Clone with React and Node.js
This demo uses:
- CometChat Pro 3.0.0
- CometChat UI Kit
- React.js
- Uuid
- Validator
- @emotion/core
- dateformat
- emoji-mart
- react-html-parser
- twemoji
- Node.js
- Express.js
- MySQL
- Cors
- Dotenv
- Nodemon
To run the demo follow these steps:
- Head to CometChat Pro and create an account
- From the dashboard, add a new app called "instagram-clone-react-node"
- Select this newly added app from the list.
- From the Quick Start copy the APP_ID, APP_REGION and AUTH_KEY. These will be used later.
- Also copy the REST_API_KEY from the API & Auth Key tab.
- Navigate to the Users tab, and delete all the default users and groups leaving it clean (very important).
- Download the repository here or by running
git clone https://github.com/hieptl/instagram-clone-react-node.git
and open it in a code editor. - Create a file called .env in the root folder of your project.
- The content of the .env file should be as follow.
REACT_APP_COMETCHAT_APP_ID=xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx
REACT_APP_COMETCHAT_REGION=xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx
REACT_APP_COMETCHAT_AUTH_KEY=xxx-xxx-xxx-xxx-xxx-xxx-xxx-xxx
- Make sure to exclude .env in your gitIgnore file from being exposed online.
- Run the following command to install the app.
npm install
npm run start
To run the demo follow these steps:
- We will use the MySQL database. For this reason, this section describes how to create the database and its table. Before proceeding, you need to make sure that you have installed the MySQL database on your computer already. To create the database and its table, you need to get the instagram.sql and run it.
- Create .env file and replace the below information with the information of your database connection.
PORT=xxx - xxx - xxx - xxx - xxx - xxx - xxx - xxx
DB_HOST=xxx - xxx - xxx - xxx - xxx - xxx - xxx - xxx
DB_USER_NAME=xxx - xxx - xxx - xxx - xxx - xxx - xxx - xxx
DB_USER_PASSWORD=xxx - xxx - xxx - xxx - xxx - xxx - xxx - xxx
DB_NAME=xxx - xxx - xxx - xxx - xxx - xxx - xxx - xxx
DB_PORT=xxx - xxx - xxx - xxx - xxx - xxx - xxx - xxx
- Install all the dependencies of the applicatoin by running
npm install
- Because we are installing the nodemon library. Therefore you can run one of the follow statements to run your project.
node index.js
or
npx nodemon index.js
- Make sure to include the .env file in your gitIgnore file from being exposed online.
Questions about running the demo? Open an issue. We're here to help ✌️