Giter VIP home page Giter VIP logo

shopify-app-printify-order-automation-node's Introduction

Shopify App for a custom Printify integration

This is a Node.js application that automates the process of sending orders from Shopify to Printify and then uploading the tracking info to Shopify when the order is fulfilled. A Postgres database is used along with scheduled crons and email notifications are sent to the store owner. The client had specific needs for how the orders should be processed that weren't possible with Printify's own Shopify integration. It also provides a password protected endpoint for the customer to view the database as html.

Features

  • Syncs Shopify orders to a PostgreSQL database.
  • Sends orders from the database to Printify after a user-defined delay where they are able to edit shipping details etc. on Shopify.
  • Fetches tracking info from Printify and uploads it to the order on Shopify.
  • Provides a user interface for viewing orders.
  • Email notifications are sent to the store owner if there are any issues.

How it Works

The application is initiated by a GET request to the /syncShopifyOrdersToDB endpoint. This request fetches orders from Shopify and syncs them to a PostgreSQL database. The orders are processed and any necessary notifications are sent via email using SendGrid.

The application also provides a GET request to the /viewOrders endpoint, which returns a user interface for viewing orders. The orders are fetched from the database and displayed in a table format.

Cron jobs are set up in the cronJobs.js file and are initiated when the server starts. These cron jobs perform various tasks such as syncing the database with Shopify, sending orders to Printify, deleting old orders, getting tracking info, and posting tracking info to Shopify.

Running the App

The application is started by running the server.js file, which sets up the server and starts listening on a specified port. The server setup includes setting up the database and initiating the cron jobs.

Dependencies

The application uses the following dependencies:

  • express: For setting up the server and handling HTTP requests.
  • axios: For making HTTP requests to the Shopify and Printify APIs.
  • dotenv: For managing environment variables.
  • pg-promise: For interacting with the PostgreSQL database.
  • node-cron: For scheduling cron jobs.
  • @sendgrid/mail: For sending email notifications.

Note

API keys and other sensitive information are stored in a .env file which is ignored by Git. This includes keys for Shopify, Printify, and SendGrid, as well as the database connection string.

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.