Giter Club home page Giter Club logo

erinkelsey / shopapp-nodejs Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 319 KB

๐Ÿ›’ An eCommerce app built with Node.js, Express, mongoDB, mongoose and Stripe.

Home Page: https://shopapp-nodejs.herokuapp.com/

JavaScript 57.96% CSS 8.79% HTML 33.25%
nodejs stripe ejs embedded-javascript-templates express mysql sequelize mongodb mongoose bcryptjs connect-mongodb-session express-session csurf connect-flash sendgrid nodemailer nodemailer-sendgrid-transport express-validator aws aws-s3

shopapp-nodejs's Introduction

Shop App

An eCommerce app built with Node.js, Express, mongoDB, mongoose, Stripe, and AWS S3.

Hosted example: https://shopapp-nodejs.herokuapp.com/

Other Features

  • Uses bcryptjs for hashing and salting passwords, and connect-mongodb-session and express-session for managing user sessions. - Uses csurf to create CSRF tokens, and prevent for CSRF Attacks.
  • Uses connect-flash for sending messages on redirect responses.
  • Uses SendGrid, nodemailer, nodemailer-sendgrid-transport for sending emails.
  • Uses express-validator for server-side validation
  • Uses multer, multer-s3, and aws-sdk for handling file uploads
  • Uses pdfkit for creating PDF invoices for orders
  • Uses Stripe for payments

Install

$ npm install

Setup

SendGrid

  • Signup for a SendGrid account: https://sendgrid.com
  • Create an API Key (Settings -> API Keys -> Create API Key)
  • Give the API Key a name and Full Access for permissions
  • Copy the key, and add to .env, as described below
  • Verify sender identity by going to Settings -> Sender Authentication -> Single Sender Verification -> Create a Sender
  • Create a sender with an email address you have access to, and confirm
  • Add the email address you used to .env, as described below

Stripe

  • Signup for a Stripe account: https://stripe.com
  • Go to Developers -> API Keys to get your test API Key
  • Copy your public and private keys, and add to the .env file, as described below

To Test Transaction

Card Number: 4242 4242 4242 4242 Expiry: Any date in the future CVC: Any three numbers

AWS S3

  • Create an S3 bucket that allows public files
  • Add your AWS credentials, and bucket settings to the .env file, as described below

NOTE: The AWS SDK will automatically get your credentials from the environment variables, so it is unnecessary to configure them in the application.

Add the following bucket policy, so that the images are publicly accessible:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicRead",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
                "s3:GetObject",
                "s3:GetObjectVersion"
            ],
            "Resource": "arn:aws:s3:::YOUR_AWS_BUCKET_NAME/*"
        }
    ]
}

Environment Variables

Create a .env file in the main directory with the following environment variables:

MONGODB_CONNECTION=your_mongo_connection_string
SENDGRID_API_KEY=your_sendgrid_api_key
SENDGRID_FROM=email_verified_sender_identity
HOST_URL=http://localhost:3000
STRIPE_PRIVATE_KEY=your_private_stripe_key
STRIPE_PUBLIC_KEY=your_public_stripe_key
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_secret_access_key
AWS_REGION=your_s3_bucket_region
AWS_BUCKET_NAME=your_s3_bucket_name

Run

$ npm start

Sequelize Implementation

Check out the sequelize-implementation branch for the main app implemented using MySQL and the sequelize package.

shopapp-nodejs's People

Contributors

erinkelsey avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

nelglez

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.