Giter Club home page Giter Club logo

merch's Introduction

Deno Merch

The Deno shop! Built with Deno and Fresh, powered by Shopify, and deployed to the edge with Deno Deploy.

Using SSR, islands architecture, and being deployed close to users, this shop has a perfect Lighthouse score of 100. Learn how you can build an e-commerce site with a perfect Lighthouse score.

Screen Shot

Screen Shot

Develop locally

  • Clone the repository
  • Set up Shopify credentials in the .env, follows .env.example.
  • Start the project in local mode:
    deno task start

Shopify Configuration Guide

  • Create a new account or use an existing one. https://accounts.shopify.com/store-login
  • Create a new app. https://<yourshopname>.myshopify.com/admin/settings/apps
  • Once your app has been created, select use it. Then select "Storefront API integration" link
  • Next, check Storefront API access scopes
    • unauthenticated_read_product_listings access should be fine to get you started.
    • Add more scopes if you require additional permissions.

Shopify Troubleshooting

  • If you encounter an error like error code 401 you likely didn't set this up correctly. Revisit your scopes and be sure add at least one test product. Also make sure you are using the Storefront API and not the Admin API as the endpoints and scopes are different.
  • If you do not see a checkout sidebar, or if it is empty after adding a product, you need to add an image to your test product.

Deploy to global

Sign in to dash.deno.com, create a new project, and then link to your clone version of the repository. Please ensure add shopify secret before link:

Screen Shot 2

Perfect Lighthouse score

Perfect lighthouse score

Today’s consumers are more demanding than ever, especially when it comes to shopping online. These experiences must feel intuitive and snappy. Even a 100-millisecond delay in load time can hurt conversion rates by 7%.

Our merch store, built with Fresh and Shopify’s storefront API, is server-side rendered (SSR) with some islands of interactivity and deployed close to users on the edge. Sending only what the client needs keeps the site lean and fast, earning it a perfect Lighthouse score.

Check out our tutorial that teaches you how to build an e-commerce site with a perfect Lighthouse score.

merch's People

Contributors

aarono avatar cjihrig avatar erictherobot avatar felix-schindler avatar hashrock avatar ije avatar kt3k avatar lambtron avatar lucacasonato avatar ry avatar vikiival avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

merch's Issues

Site not working

The website is currently not working, I'm getting 500 errors on all javascript files. Checked on my phone and other browsers as well.

image

favicon?

would be excellent to have a favicon. we could reuse denolands for now.

Preact error when using useSwr

Steps to reproduce

  1. Clone repo
  2. Configure env vars
  3. Run deno task start
  4. Access home page

The following issue is happening with me when rendering the home page of the merch store:
image

An error occured during route handling or page rendering. TypeError: Cannot read properties of undefined (reading 'context')
    at j (https://esm.sh/v91/[email protected]/deno/hooks.js:2:1028)
    at br (https://esm.sh/v91/[email protected]/X-YS9yZWFjdDpwcmVhY3QvY29tcGF0CmUvcHJlYWN0L2NvbXBhdA/deno/swr.js:2:6259)
    at https://esm.sh/v91/[email protected]/X-YS9yZWFjdDpwcmVhY3QvY29tcGF0CmUvcHJlYWN0L2NvbXBhdA/deno/swr.js:2:6365
    at useCart (file:///Users/lucis/personal/merch/utils/data.ts:102:10)
    at Object.Cart (file:///Users/lucis/personal/merch/islands/Cart.tsx:47:27)
    at h (https://esm.sh/v91/[email protected]/X-ZS9wcmVhY3Q/deno/preact-render-to-string.js:4:1003)
    at h (https://esm.sh/v91/[email protected]/X-ZS9wcmVhY3Q/deno/preact-render-to-string.js:9:66)
    at h (https://esm.sh/v91/[email protected]/X-ZS9wcmVhY3Q/deno/preact-render-to-string.js:4:1103)
    at h (https://esm.sh/v91/[email protected]/X-ZS9wcmVhY3Q/deno/preact-render-to-string.js:9:66)
    at h (https://esm.sh/v91/[email protected]/X-ZS9wcmVhY3Q/deno/preact-render-to-string.js:9:66)

I suppose it's something related to the import_map.json, but I couldn't pinpoint the problem:

import_map.json

{
  "imports": {
    "@/": "./",
    "@twind": "./utils/twind.ts",
    "@twind/aspect-ratio": "https://esm.sh/@twind/[email protected]",

    "$fresh/": "https://deno.land/x/[email protected]/",
    "preact": "https://esm.sh/[email protected]",
    "preact/": "https://esm.sh/[email protected]/",
    "preact-render-to-string": "https://esm.sh/[email protected]?external=preact",

    "twind": "https://esm.sh/[email protected]",
    "twind/": "https://esm.sh/[email protected]/",
    "$std/": "https://deno.land/[email protected]/",
    "swr": "https://esm.sh/[email protected]?alias=react:preact/compat&external=preact/compat"
  }
}

Safari errors

Good day guys! Thank you for the awesome product. Noticed some bugs in Safari.

Safari Monterey(15.3) error related to incorrect usage of dialog polyfill.
https://github.com/GoogleChrome/dialog-polyfill
Haven't done:

  1. Include the CSS in the of your document, and the JS anywhere before referencing dialogPolyfill.
  2. Register the elements using dialogPolyfill.registerDialog(), passing it one node at a time. This polyfill won't replace native support.

Safari Big Sur(14.1) and lower error: 'unexpected keyword import'

<hgroup> being used?

I was wondering why <hgroup> was used here

It has an h2 & h3 element which following the docs is not a valid use case.
( Valid : 0 / 1 <p> + 1 <h1-6> + 0 / 1 <p> )

The MDN Docs also mention the following:

Note: The <hgroup> element is not recommended as it does not work 
properly with assistive technologies. It was removed from the W3C 
HTML specification but is still part of the WHATWG specification 
and is at least partially supported by most browsers.

Can not start the project in local mode

Task start deno run -A --watch=static/,routes, dev.ts
Watcher Process started.
The manifest has been generated for 4 routes and 3 islands.
error: Uncaught (in promise) SyntaxError: The requested module '/v99/[email protected]/deno/twind.js' does not provide an export named 'directive'
  await import(entrypoint);
  ^
    at async dev (https://deno.land/x/[email protected]/src/dev/mod.ts:187:3)
    at async file:///Users/homerh/Deno/denoland-merch/dev.ts:6:1
Watcher Process finished. Restarting on file change...

License?

Am I blind or does the repo not have a license?

Btw the perfect lighthouse score badge seems to be broken ..

Update readme

  • should have screenshot
  • should say what this is
  • should say how to clone and get started

Not compatible with deno-deploy

Change the order of how items appear on the site

Right now it looks like we order products by created by date desc.

whenever we add new products, they end up at the bottom of the collection.

would be nice to either reverse the order or have another ordering mechanism, since we want to promote the newest items at the top.

Missing countries at Shopify Checkout?

It seems like there might be a problem, as I couldn't find Albania listed among the selectable countries on the Shopify checkout page. I'm wondering if this omission was intentional. What raised my concern is that even countries that are generally considered less accessible than Albania and the Western Balkans, like Somalia, are included.

I'm interested in purchasing some items from your store, so I believe the solution probably lies in adjusting the Shopify configurations.

PS: If you do decide to add the Western Balkans, please remember to include Kosova/Kosovo as well.

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.