Skip to content

kevsaj/nextShop

Repository files navigation

πŸ›οΈ Next.js Shopify App

This project is a Next.js application that integrates with the Shopify GraphQL API and the Collectr API. It allows users to fetch products from a Shopify store, match them with Collectr options, update product prices, and manage product data efficiently.


πŸš€ Features

  • Fetch Products: Retrieve products from your Shopify store and display them in a table.
  • Update Prices: Update the price of a product and reflect the changes in real-time.
  • Match Products: Match Shopify products with Collectr options and save the matches.
  • Check API Limits: View the remaining credits for the Collectr API.
  • Pagination: Navigate through products with "Next" and "Previous" buttons.
  • SKU Cleanup: Automatically remove trailing "A" from SKUs before processing.

πŸ› οΈ Technologies Used

Languages & Frameworks

  • TypeScript TypeScript
  • Next.js Next.js
  • React React

Libraries & Tools

  • Shopify API Shopify GraphQL API
  • Collectr API Collectr API
  • Supabase Supabase (for database operations)
  • CSS CSS (for styling)

πŸ“‚ Project Structure

nextjs-shopify-app
β”œβ”€β”€ pages
β”‚   β”œβ”€β”€ index.tsx          # Main entry point of the application
β”‚   β”œβ”€β”€ api
β”‚   β”‚   β”œβ”€β”€ collectrLimits.ts  # API route to fetch Collectr API limits
β”œβ”€β”€ components
β”‚   β”œβ”€β”€ ProductTable.tsx   # Component to display product information in a table
β”‚   β”œβ”€β”€ ReadProductsTable.tsx # Component to display Shopify products
β”œβ”€β”€ utils
β”‚   β”œβ”€β”€ fetchCollectrProducts.ts # Utility to fetch Collectr products
β”‚   β”œβ”€β”€ supabaseClient.ts  # Utility for Supabase database operations
β”œβ”€β”€ public                 # Static assets
β”œβ”€β”€ styles
β”‚   β”œβ”€β”€ globals.css        # Global CSS styles
β”œβ”€β”€ package.json           # npm configuration file
β”œβ”€β”€ tsconfig.json          # TypeScript configuration file
β”œβ”€β”€ next.config.js         # Next.js configuration file
└── README.md              # Project documentation

βš™οΈ Setup Instructions

Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn
  • Shopify API credentials
  • Collectr API credentials

Steps

  1. Clone the repository:

    git clone <repository-url>
    cd nextjs-shopify-app
  2. Install dependencies:

    npm install
  3. Set up environment variables: Create a .env.local file in the root directory and add the following:

    SHOPIFY_API_URL=<your-shopify-api-url>
    SHOPIFY_ACCESS_TOKEN=<your-shopify-access-token>
    COLLECTR_API_BASE_URL=<your-collectr-api-base-url>
    COLLECTR_API_KEY=<your-collectr-api-key>
  4. Run the development server:

    npm run dev
  5. Open the application: Navigate to http://localhost:3000 in your browser.


πŸ“ Usage

Main Features

  1. Fetch Products:

    • Click the "Read Products" button to fetch products from your Shopify store.
    • Products will be displayed in a table.
  2. Update Product Prices:

    • Use the "Update Product" button to update the price of a product.
    • The updated price will be reflected in the table.
  3. Match Products:

    • Click the "Match Products" button to match Shopify products with Collectr options.
    • Save the matches to the database.
  4. Check API Limits:

    • Click the "Check Limit" button to view the remaining credits for the Collectr API.
  5. Pagination:

    • Use the "Next" and "Previous" buttons to navigate through the product list.

πŸ› Known Issues

  • Caching Issue: Ensure that API responses are not cached by adding appropriate headers.
  • SKU Cleanup: SKUs ending with "A" are automatically cleaned before processing.

πŸ“œ License

This project is licensed under the MIT License.


πŸ“§ Contact

For questions or support, please contact kisstudios98@gmail.com.


Β© 2025 Kisstudios Production