GithubHelp home page GithubHelp logo

borguuh / mail_out Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 651 KB

A fullstack MongoDB, Express, React, and Node.js customer survey web app that helps users to create email campaigns and get their customer feedbacks on their services, the feedbacks are recorded and summarized in the company dashboard. Users have buy credits on their accounts which are used on to send their email surveys. Lol, the design and styling are horrible though.

Home Page: https://mailout.herokuapp.com

HTML 7.37% JavaScript 92.63%
react nodejs mongodb mongoose expressjs redux sendgrid stripe

mail_out's Introduction

Mail_Out

Contents

About Project

Mail_Out is a MERN fullstack web app that helps companies to create email campaigns and get customer feedback in a simple 'yes/no' format, the feedbacks are recorded and summarized in the company dashboard. Users buy credits to their account which is used on the email service which they send.

Tech Stack

The tech stack mainly comprises of MongoDB, Express, React, and Node.js and deployed to Heroku. Other services include Google OAuth for authentication, Stripe for payments, and SendGrid for mailing out survey campaigns. Materialize CSS for minor styling.

Deployment

The app is already deployed on Heroku here.
PS : Use credit card number "4242 4242 4242 4242" and CVC security code with future expiration date to test payment.

Needed Tools

Development Configuration

Create a file "dev.js" in /config and paste the following configuration keys with appropriate values.

module.exports = {
  googleClientID: 'YOUR_GOOGLE_PLUS_ID',
  googleClientSecret: 'YOUR_GOOGLE_PLUS_SECRET_KEY',
  mongoURI:'YOUR_MONGODB_URI',
  cookieKey:'YOUR_COOKIE_KEY',
  stripePublicKey: 'YOUR_STRIPE_PUBLIC_KEY',
  stripeSecretKey: 'YOUR_STRIPE_SECRET_KEY',
  sendGridKey: 'YOUR_SEND_GRID_API_KEY',
  redirectDomain:'YOUR_LOCAL_DEVELOPMENT_SERVER_ADDRESS'
};

Available Scripts

Install

npm install && npm install --prefix client

Run in development mode

In the project top level 'server' directory, the following script will run the app in development mode by initiating both the client and backend server: To start the app, run the following command.

npm run dev

Documentation

JSON Objects returned by API:

Make sure the right content type like Content-Type: application/json; charset=utf-8 is correctly returned.

Users (for authentication)

{
  "user": {
    "googleId": "iefbeiveievbjbevjklmwnn"
  }
}

User (Object Model)

{
  "user": {
    "googleId": "iefbeiveievbjbevjklmwnn",
    "credits": 2
  }
}

Survey

  {
    "title": "customer feedback request",
    "body": "Thank you for the purchase of our service, we would love to get a review from you. ",
    "subject": "Do you love our service and will you recommend it to your friends?",
    "recipients": [{"email": "[email protected]", "responded": true}, {"email": "[email protected]", "responded": false}],
    "yes": 3,
    "no": 1,
    "_user": "huweffioiq7yufweghokqdwgfuiw",
    "dateSent": "22-10-2020",
    "lastResponded": "22-10-2020"
}

Recepient

{
	"recipients": [
		{
			"email": "[email protected]",
			"responded": true
		}, 
		{
			"email": "[email protected]",
			"responded": false
		}
	],
}

Errors and Status Codes

If a request fails any validations, expect a 422 and errors in the following format:

{
  "errors":{
    "body": [
      "can't be empty"
    ]
  }
}
Other status codes:

401 for Unauthorized requests, when a request requires authentication but it isn't provided

403 for Forbidden requests, when a request may be valid but the user doesn't have permissions to perform the action e.g "Insufficient credits. Please add credits."

404 for Not found requests, when a resource can't be found to fulfill the request

Endpoints:

Authentication:

GET "/auth/google",

No authentication required

Logout:

GET "/api/logout",

Authentication required

View all surveys:

GET "/api/surveys",

Authentication required, returns the credits and list surveys of logged in user.

Create a new survey:

POST "/api/surveys",

Example request body:

{
    "title": "customer feedback request",
    "body": "Thank you for the purchase of our service, we would love to get a review from you. ",
    "subject": "Do you love our service and will you recommend it to your friends?",
    "recipients": [{"email": "[email protected]", "responded": true}, {"email": "[email protected]", "responded": false}],
    "_user": "huweffioiq7yufweghokqdwgfuiw",
    "dateSent": "22-10-2020",
}

Authentication required, 1 credit required.

Required fields: title, body, subject, recepient, user.

Recepient gives feedback from email:

POST "/api/surveys/:surveyId/:choice"

Example request body:

          {
            "_id": "surveyId",
            "recipients": {
              "$elemMatch": { "email": "[email protected]", "responded": false },
            },
          },
          {
            "$inc": { "choice": 1 },
            "$set": { "recipients.$.responded": true },
            "lastResponded": "20-10-2020",
          }

No authentication required.

Payment Endpoint For Buying Credits

POST "/api/stripe"

Example request body:

		{
            "amount": 500,
            "currency": "usd",
            "source": "tok_visa", //prev req.body.id
            "description": "5 survey credits for $5"
        }

Authentication required.

Required fields: amount, currency, source, description

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.