An Ecommerce website that utilizes the MERN Stack.
TypeScript, MongoDB, Twingate, AWS(EC2), Express, React, node, Bcrypt, JWT, HTML, CSS, Bootstrap
This project utilizes MongoDB to store users and products in their own respective collections within the database. To operate this database remotely, Twingate is used to host a remote network that utilizes an AWS EC2 instance as it's provider. It is entirely possible to operate this website without the use of Twingate as you may choose to use the IP address of your machine instead and both options are equally viable.
With Twingate
- Create a Twingate remote network
- Launch an AWS EC2 instance
- Connect the remote network to the EC2 instance using a SSH client
- Download the client for Twingate
- Add the IP address of the remote network to the MongoDB Network Access
- Add the MongoDB database as a resource to the remote network
Without Twingate
- Save your current IP address to the MongoDB network access
There are several ways to access the database but in this project we use a connection string. You can also create your own .env file to store the connection string or you may choose to use the string directly.
Product Collection For the product page, you may choose to add your own products to the database but if you wish to use the same products used in this project, the text file named "ProductDocuments.txt" contains all the documents in an array so you can easily insert it into the database.
-
Clone repository to your local machine
$ git clone https://github.com/AntMa4002/RoyalKeyboardsEcommerce
-
Change into the directory
$ cd RoyalKeyboardsEcommerce/server
-
Run the following command to start the server
$ npm run dev
-
A popup should appear if you have the Twingate client installed and will ask you to authenticate by logging in
-
Open a new terminal and change the directory
$ cd RoyalKeyboardsEcommerce/client/react-app
-
Make sure that vite is updated to the latest version by running
$ npm install
-
Run the following command to start the website
$ npm run dev
-
You may now go to http://localhost:5173 and enjoy the website!