• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

KATT/shop:

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

KATT/shop

开源软件地址(OpenSource Url):

https://github.com/KATT/shop

开源编程语言(OpenSource Language):

TypeScript 99.7%

开源软件介绍(OpenSource Introduction):

Archived: This is using Prisma 1 which has been discontinued.

React/Prisma/TS/GraphQL E-Commerce Example

Build Status Maintainability

Attempt to create a great reference project with an amazing developer experience wherein a lot of common React/Prisma/GraphQL challenges are addressed.

Tech

/web features

  • Server-side rendered React app.
  • GraphQL using Apollo with optmistic updates.
  • Pessimistic™ updates - app works completely without JS enabled in the browser (and there's E2E tests for it).
  • Creates a shopping cart (Order) before page load, reference id saved to cookies
  • Add/edit products to/in cart
  • Product list from GraphQL
  • Open checkout route in modal
  • Discount code support (try code "first")

Setup

  1. Install node 9
  2. Install Homebrew
  3. Install Docker - brew cask install docker
  4. Install yarn - npm install -g yarn
  5. Start Docker
  6. yarn install
    • Installs deps for
      • /
      • /api
      • /web
      • /e2e
  7. Start Prisma + seed DB yarn setup:prisma

Development

yarn dev

Starts the /api Gateway, the Next.js /web, and a TypeScript watcher for /e2e in parallell.

If you prefer separate output, navigate to /api, etc in separate shells and run yarn dev

If everything goes smoothly you should be able to access the below:

Tests

API Gateway

Uses Jest.

yarn test:api

Web

/web has no tests (yet).

E2E

Install dependencies

brew install selenium-server-standalone
brew install chromedriver
brew install geckodriver
brew cask install java

Run

  1. Run selenium: yarn selenium
  2. Setup + start apps: yarn setup && yarn build && yarn dev
  3. Run tests: yarn start:e2e
    • Will run E2E in Chrome with JS enabled
    • To run without js: yarn start:e2e -- --env chrome:nojs
    • See nightwatch.ts for all envs

Conventions, how to write etc

/web

  • /mutations and /queries exposes render prop components for easy handling of data loading / rendering
  • .. TBC

What's next / questions

This is a bit of a playground for web tech for me. I'm still developing it & I gather a list of things I'd like to do in issues.

If you have problems running it, ideas of things to add, things you want me to explain / elaborate on, or need help to build a product - open an issue or reach out to me on Twitter.

Feel free to fork it and make a pull request of something cool!


             / )
 / )__/ )___/ /
( @ . @ )     )
 (           )
 //"//""//"//

 KATTCORP LTD.

by kattcorp.com




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap