Giter Site home page Giter Site logo

crwn-clothing's Introduction

This project was bootstrapped with Create React App.

This project was made following "Complete React Developer in 2020 (w/Redux, Hooks, GraphQL)". This is a small shop created width react, redux, reselect, firebase, stripe

INTRODUCTION

I'm growing on my knowledge in JS and React, it´is exciting for me to do this, understand interesting futures and learn best practices of React use. Thank for my teachers great and hard work.

@Xarlos_ / Carlos Gil Carrillo <ixarlos/>

INSTALLED AND DEPLOYED ON NETLIFY

Payment is only in avaible on Netlify

  • Install in the project yarn add stripe dotenv @stripe/react-stripe-js @stripe/stripe-js

  • Install NETLIFY CLI: npm install -g netlify-cli

  • Use command line: netlify

  • Connect your account: netlify login

  • Run dev server simulating netlify: netlify dev

  • NETLIFY folder is added and deployed in one instance of NODE.JS netlify/functions/create-payment-intent.js

INSTALLED AND DEPLOYED ON HEROKU

This project was uploaded to crw-ixarlos and deployed on heroku.com

  • Install heroku cli, see more...

  • Create new project with your $APP_NAME on your dashboard in heroku.com

  • Login into heroku

    $ heroku login

  • Link our project with heroku buildpack

    $ heroku create $APP_NAME --buildpack https://github.com/mars/create-react-app-buildpack

  • Inside the project need to create heroku

    $ cd ~/myapp $ heroku create

  • Push this and build the app

    $ git push heroku master

  • This app was published

    crw-ixarlos

TEACHERS

@From Andrei Neagoie and Yihua Zhang

TIPS & INFO

.ENV.DEVELOPMENT

  • Setting environment variable and create .env.development file

    PORT=8080
    REACT_APP_STRIPE_PUBLISHABLE_KEY=pk_test_ynKoKVdO2LNdu6elM9ALASDASasdasdDbw00z4OqJ1lk
    STRIPE_SECRET_KEY=sk_test_51DVfpMMX54S0dNtEP6nJWo000FdlCynRjXDF

.ENV.PRODUCTION

  • Setting environment variable and create .env.production file:

    PORT=80
    REACT_APP_STRIPE_PUBLISHABLE_KEY=pk_test_Hdu6elM9ALASDASasdasdDbw00z4OqJ1lk
    STRIPE_SECRET_KEY=sk_test_81DVfpMMX54S0dNtEP6nJWo000FdlCynRjXDF

STRIPE API

Added payment method our app (Stripe)

FIREBASE (Will update)

  • QueryReference

    Represent the "currend" place in the database, this object not have the actual data. Snapshot objetct is necesary to get the refe:rence data

    • Document

      firestore.doc('/users/:userId')

    • Collection

      firestore.collection('/users')

  • DocumentReference

    • We use documentRef obj. to perform our CRUD

      .set(), .get(), .update() and delete()

    • To add documents to our collectio we can use

      .add() // collectionRed.add({ value : prop })

    • We get the snapshotObject from referenceObject using

      .get() // documentRef.get() or collectionRef.get()

      • documentRef rerturns documentSnapshot object
      • collecionRef returns a querySnapshot object
  • QuerySnapshot

    We get our querySnapshot object from a collectionReference object

    • Document Snapshot
    • Collection Snapshot

Example to load firebase collection

    import firebase from 'firebase/app';
    import 'firebase/firestore';
    import 'firebase/auth';

    const firebaseConfig = {
      apiKey: 'SOME-API-KEY',
      authDomain: 'domain.com',
      databaseURL: 'https://URL',
      projectId: 'proyId',
      storageBucket: 'crwn-db-be028.appspot.com',
      messagingSenderId: 'number',
      appId: 'appid',
      measurementId: 'messureId',
    };

    firebase.initializeApp(firebaseConfig);

    const firestore = firebase.firestore();

    const userRef = firestore.doc(users/${userAuth.uid});

    const snapShot = await userRef.get();

    if (!snapShot.exists) {
      const { displayName, email } = userAuth;
      const userRef = firestore.doc(users/${userAuth.uid});

      const snapShot = await userRef.get();


    if (!snapShot.exists) {
      const { displayName, email } = userAuth;
      const createAt = new Date();

      try {
        await userRef.set({
          displayName,
          email,
          createAt,
          ...additionalData,
        });
      } catch (error) {
        console.log('Error creating user', error.message);
      }
    }
  • Securuty Rules

TOPICS

The topics covered will be:

  • React Basics [ ✅ ]

  • React Router [ ✅ ]

  • Redux [ ✅ ]

  • Redux Saga [ ✅ ]

  • Asynchronous Redux [ ✅ ]

  • React Hooks [ ✅ ]

  • Context API [ ✅ ]

  • React Suspense + React Lazy

  • Firebase [ ✅ ]

  • Stripe API [ ✅ ]

  • Styled-Components [ ✅ ]

  • GraphQL

  • Apollo

  • PWAs

  • React Performance [ ✅ ]

  • React Design Patterns

  • Testing with Jest, Enzyme and Snapshot testing

  • React Best Practices [ ✅ ]

  • Persistance + Session Storage [ ✅ ]

  • State Normalization

Redux graphic guide

  1. Redux Store

Redux Store

  1. Redux Middleware

Redux Sagas

  1. Redux Sagas

Redux Sagas

  1. Redux Sagas Flow

    • First go to the middlewares and reducers
    • Return to sagas and apply the changes

Redux Sagas Flow

  1. Stripe Payment

Stripe

crwn-clothing's People

Contributors

i-xarlos avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

crwn-clothing's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.