Created a clone of Amazon with a few tweaks to learn fullstack web development skills. Users can create an account and login using their gmail and the password associated with that gmail. Users can also add/remove items to their basket and purchase(not real payment) those items.
- How to utilize git/github using vsCode to efficiently push/pull code from repositories
- How to apply styling to components using CSS
- How to use 'prop's to making reusing code easier
- How to use React router and routes
<Router> </Router><Route path='/' element={ <Link> <Component1 /> <Component2 /> </> }/> - How to insert links into div's or img's using
<Link to='/'> </Link> - Learned how to use firebase and hook it up to my project
- Learned about BEM format. (Components should be capitalized)
- The reason for this because React might mistaken it for an HTML tag if its lowercase
- How to efficiently inspect elements to debug and test how different properties would look
- How to implement user login/authorization using Firebase
- How to hide private/secret api keys using
git ignore - How to deploy my project to Firebase for others to interact with it!
- How to emulate a build
- How to set up an API and utilize it to send data
- React and node
npm install(when testing on a new machine be sure to run this again)npx create-react-app(creates react app template)npm i react-router-dom(for<route />and<router />)npm install react-currency-format --save --force
- CCS
- Material-UI
- Axios
- Stripe (for payment processing)
- Firebase
- Firestore (real-time database)
- Commands:
npm install -g firebase-toolsnpm i firebasefirebase login
- Deployment commands:
firebase init- Select:
Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action Deploys - Select:
Use an existing project - Select the desired project (This is the project created in the Firebase site)
- Type and enter
buildwhen prompted:What do you want to use as your public directory(IMPORTANT for react apps) - Type and enter
ywhen prompted:Configure as single-app page?
- Select:
- To deploy and redeploy project using Firebase, use the following commands:
npm run buildfirebase deploy
- To deploy frontend ONLY, use the following command:
npm run buildfirebase deploy --only hosting
- To deploy backend (Firebase cloud functions) ONLY, use the following command:
firebase deploy --only functions
- Emulation commands:
firebase emulators:start
- Cloud function commands:
firebase init- Select
Functions: Configure a Cloud Functions directory and its files - Selected
Javascriptwhen prompted:What language would you like to use to write Cloud Functions? - Enter
ywhen prompted:Do you want to use ESLint to catch probable bugs and enforce style? - Enter
ywhen prompted:Do you want to install dependencies with npm now?
- Select
npm i react-router-domnpm install react-currency-format --save --forcenpm install npm install @mui/material @emotion/react @emotion/stylednpm install @mui/icons-material @mui/material @emotion/styled @emotion/reactnpm install -g firebase-toolsnpm i firebasenpm i axiosnpm i @stripe/stripe-jsnpm i @stripe/react-stripe-jsnpm i moment
npm i expressnpm i corsnpm i stripe
After deployment, the payment processing feature was not working. This was because the API request permissions were private. To fix this:
- Go the Google Cloud Console(Not Firebase Console) -> Search For Cloud Functions to see the list of functions
- Click the checkbox next to the function to which you want to grant access.
- Click Permissions at the top of the screen. The Permissions panel opens.
- Click Add principal.
- In the New principals field, type allUsers.
- Select the role Cloud Functions > Cloud Functions Invoker from the
- Select a role drop-down menu.
- Click Save.
Now anyone using the application can use the Stripe payment processing feature!