GithubHelp home page GithubHelp logo

gavinmgrant / omitplastic Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 2.0 1.11 MB

A full-stack e-commerce affiliate app focusing on reducing plastic consumption that uses Next.js and Prisma.

Home Page: https://www.omitplastic.com/

TypeScript 97.72% JavaScript 2.28%
ecommerce nextjs plastic-pollution react cherrio scraping prisma typescript

omitplastic's Introduction

OmitPlastic

This full-stack app is designed to help people reduce plastic consumption by purchasing products with less plastic content. However, this full-stack e-commerce affiliate app that uses Next.js, Prisma, and MySQL can be adapted for other types of products. The affiliate marketing program used is Amazon Associates.

Technology

  • TypeScript - strongly typed programming language
  • ReactJS - user interface library
  • NextJS - React framework for production
  • Tailwind CSS - CSS framework
  • MySQL - relational database management system
  • Prisma - Node.js and TypeScript Object Relational Mapper
  • PlanetScale - database platform
  • SWR - React hooks for data fetching
  • Vercel - platform for deploying and hosting
  • React Spring - component animations
  • Cheerio - library for parsing and manipulating HTML and XML

Setup

  • Clone this repository to your local computer.
  • Install the dependencies for the project: npm install or yarn install
  • Create a free account and MySQL database on PlanetScale.
  • Bootstrap a basic Prisma setup: npx prisma init
  • Create the tables in the database using Prisma: npx prisma db push
  • Open the example.env file and replace the dummy connection URL DATABASE_URL with 'mysql://[email protected]:3309/<DATABASE_NAME>'
  • Run the application locally: npm run dev or yarn dev
  • Open http://localhost:3000/ in your browser.
  • To deploy to Vercel read this.

Data Model Definition - Product

model Product {
  id          Int     
  asin        String  
  price       String  
  category    String
  type        String
  name        String 
  slug        String  
  imageUrl    String 
  url         String
  description String? 
  features    String
}

Edit Database Schema

  • Open the schema.prisma file.
  • After you have made your changes, run npx prisma db push to update the database.
  • Go here for more information about the Prisma schema file.

Edit Prisma Tables

Scraping Amazon Web Page For Pricing

  • This app checks for and updates the prices for all products by scraping its corresponding Amazon web page.
  • To view the Node.js code for this, go to the pages/api/price page.
  • The Cheerio library is used to parse and traverse markup data to get pricing and availability.

omitplastic's People

Contributors

gavinmgrant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.