All Projects β†’ jamstack-cms β†’ Jamstack Ecommerce

jamstack-cms / Jamstack Ecommerce

Licence: mit
A starter project for building performant ECommerce applications with Next.js and React

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Jamstack Ecommerce

Commercejs Nextjs Demo Store
Commerce demo store built for the Jamstack. Built with Commerce.js, Next.js, and can be one-click deployed to Netlify. Includes product catalog, categories, variants, cart, checkout, payments (Stripe) order confirmation, and printable receipts.
Stars: ✭ 737 (-46.75%)
Mutual labels:  ecommerce, serverless, nextjs
Actions Gh Pages
GitHub Actions for GitHub Pages πŸš€ Deploy static files and publish your site easily. Static-Site-Generators-friendly.
Stars: ✭ 2,576 (+86.13%)
Mutual labels:  static-site-generator, gatsby, nextjs
Post Scheduler
Schedule posts & content updates for static websites (Jekyll, Hugo, Gatsby, Phenomic etc)
Stars: ✭ 184 (-86.71%)
Mutual labels:  serverless, static-site-generator, gatsby
Awesome Gatsby
βš›οΈ πŸ“„ πŸš€ Awesome list for the mighty Gatsby.js, a blazing fast React static site generator.
Stars: ✭ 928 (-32.95%)
Mutual labels:  static-site-generator, gatsby
Next On Netlify
Build and deploy Next.js applications with Server-Side Rendering on Netlify!
Stars: ✭ 719 (-48.05%)
Mutual labels:  serverless, nextjs
Gatsby Starter Ghost
A starter template to build lightning fast websites with Ghost & Gatsby
Stars: ✭ 752 (-45.66%)
Mutual labels:  static-site-generator, gatsby
Ram
βš›οΈ React Application Manager: create and run React (and other) applications – no command line or build setup required
Stars: ✭ 585 (-57.73%)
Mutual labels:  gatsby, nextjs
Serverless Next
How to use Serverless to provide the frontend with a full API with minimal effort and max. scalability
Stars: ✭ 41 (-97.04%)
Mutual labels:  serverless, nextjs
Moveit
πŸš€ NLW #4 | React+ TypeScript + NextJS + StyledComponents + Firebase + MongoDb +Axios
Stars: ✭ 39 (-97.18%)
Mutual labels:  serverless, nextjs
Awesome Docs With Static Site Generators
Pointers to all templates and implementations based on static site generators
Stars: ✭ 44 (-96.82%)
Mutual labels:  static-site-generator, gatsby
Gatsby Advanced Starter
A high performance skeleton starter for GatsbyJS that focuses on SEO/Social features/development environment.
Stars: ✭ 1,224 (-11.56%)
Mutual labels:  static-site-generator, gatsby
Jamstack Cms
Modern full stack CMS. Built with Gatsby, GraphQL, AWS Amplify, and Serverless technologies.
Stars: ✭ 702 (-49.28%)
Mutual labels:  serverless, gatsby
Reactime
Chrome extension for improving and optimizing performance in React applications (Gatsby and Next.js compatible).
Stars: ✭ 1,219 (-11.92%)
Mutual labels:  gatsby, nextjs
Nextra
The Next.js Static Site Generator
Stars: ✭ 1,271 (-8.16%)
Mutual labels:  static-site-generator, nextjs
Nextein
A static site generator with markdown + react for Next.js
Stars: ✭ 825 (-40.39%)
Mutual labels:  static-site-generator, nextjs
Tinacms
Open source editor that brings visual editing into React websites. A developer-centric CMS to build contextual and intuitive editing experience without sacrificing code quality.
Stars: ✭ 6,804 (+391.62%)
Mutual labels:  gatsby, nextjs
Terraform Nextjs Plugin
A plugin to generate terraform configuration for Nextjs 8 and 9
Stars: ✭ 41 (-97.04%)
Mutual labels:  serverless, nextjs
Next Starter
Next.js Starter using GraphQL, MobX (Next.js, TypeScript, Babel, Express.js, Apollo Client, React Apollo, React Apollo Hooks, GraphQL Codegen, MobX, mobx-state-tree, styled-components, next-optimized-images, Serverless Framework, AWS Lambda, Dotenv)
Stars: ✭ 90 (-93.5%)
Mutual labels:  serverless, nextjs
Example Storefront
Example Storefront is Reaction Commerce’s headless ecommerce storefront - Next.js, GraphQL, React. Built using Apollo Client and the commerce-focused React UI components provided in the Storefront Component Library (reactioncommerce/reaction-component-library). It connects with Reaction backend with the GraphQL API.
Stars: ✭ 471 (-65.97%)
Mutual labels:  ecommerce, nextjs
Reflexjs
Starter kits, themes and blocks to help you build Gatsby and Next.js sites faster. Built on top of a best-in-class styling library.
Stars: ✭ 571 (-58.74%)
Mutual labels:  gatsby, nextjs

Jamstack ECommerce Next

Jamstack ECommerce Next provides a way to quickly get up and running with a fully configurable ECommerce site using Next.js.

Out of the box, the site uses completely static data coming from a provider at providers/inventoryProvider.js. You can update this provider to fetch data from any real API by changing the call in the getInventory function.

Home

Live preview

Click here to see a live preview.

Other Jamstack ECommerce pages

Category view

Category view

Item view

Item view

Cart view

Cart view

Admin panel

Admin panel

Getting started

  1. Clone the project
$ git clone https://github.com/jamstack-cms/jamstack-ecommerce.git
  1. Install the dependencies:
$ yarn

# or

$ npm install
  1. Run the project
$ npm run dev

# or to build

$ npm run build

Deploy to Vercel

Use the Vercel CLI

vercel

Deploy to AWS

npx serverless

About the project

Tailwind

This project is styled using Tailwind. To learn more how this works, check out the Tailwind documentation here.

Components

The main files, components, and images you may want to change / modify are:

Logo - public/logo.png
Button, ListItem, etc.. - components
Form components - components/formComponents
Context (state) - context/mainContext.js
Pages (admin, cart, checkout, index) - pages
Templates (category view, single item view, inventory views) - templates

How it works

As it is set up, inventory is fetched from a local hard coded array of inventory items. This can easily be configured to instead be fetched from a remote source like Shopify or another CMS or data source by changing the inventory provider.

Configuring inventory provider

Update utils/inventoryProvider.js with your own inventory provider.

Download images at build time

If you change the provider to fetch images from a remote source, you may choose to also download the images locally at build time to improve performance. Here is an example of some code that should work for this use case:

import fs from 'fs'
import axios from 'axios'
import path from 'path'

function getImageKey(url) {
  const split = url.split('/')
  const key = split[split.length - 1]
  const keyItems = key.split('?')
  const imageKey = keyItems[0]
  return imageKey
}

function getPathName(url, pathName = 'downloads') {
  let reqPath = path.join(__dirname, '..')
  let key = getImageKey(url)
  key = key.replace(/%/g, "")
  const rawPath = `${reqPath}/public/${pathName}/${key}`
  return rawPath
}

async function downloadImage (url) {
  return new Promise(async (resolve, reject) => {
    const path = getPathName(url)
    const writer = fs.createWriteStream(path)
    const response = await axios({
      url,
      method: 'GET',
      responseType: 'stream'
    })
    response.data.pipe(writer)
    writer.on('finish', resolve)
    writer.on('error', reject)
  })
}

export default downloadImage

You can use this function to map over the inventory data after fetching and replace the image paths with a reference to the location of the downloaded images, probably would look something like this:

await Promise.all(
  inventory.map(async (item, index) => {
    try {
      const relativeUrl = `../downloads/${item.image}`
      if (!fs.existsSync(`${__dirname}/public/downloads/${item.image}`)) {
        await downloadImage(image)
      }
      inventory[index].image = relativeUrl
    } catch (err) {
      console.log('error downloading image: ', err)
    }
  })
)

Updating with Auth / Admin panel

  1. Update pages/admin.js with sign up, sign, in, sign out, and confirm sign in methods.

  2. Update components/ViewInventory.js with methods to interact with the actual inventory API.

  3. Update components/formComponents/AddInventory.js with methods to add item to actual inventory API.

Roadmap

  • Full product and category search
  • Auto dropdown navigation for large number of categories
  • Ability to add more / more configurable metadata to item details
  • Themeing + dark mode
  • Optional user account / profiles out of the box
  • Make Admin Panel responsive
  • Have an idea or a request? Submit an issue or a pull request!

Other considerations

Server-side processing of payments

To see an example of how to process payments server-side with stripe, check out the Lambda function in the snippets folder.

Also, consider verifying totals by passing in an array of IDs into the function, calculating the total on the server, then comparing the totals to check and make sure they match.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].