• Stars
    star
    374
  • Rank 114,346 (Top 3 %)
  • Language
    TypeScript
  • Created over 6 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ›πŸ›’ Full-stack React/Prisma/TS/GraphQL E-Commerce Example

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

More Repositories

1

envsafe

πŸ”’ Makes sure you don't accidentally deploy apps with missing or invalid environment variables.
TypeScript
786
star
2

zart

🀯 zART-stack β€” Zero-API, React [Native], & TypeScript
TypeScript
303
star
3

typescript.careers

TypeScript
39
star
4

next-router-query

πŸ‘¨β€πŸ”§ Drop-in alternative of `useRouter().query` that tries it's best to get the query params on the first mount.
TypeScript
38
star
5

graphql-workshop

πŸ•ΈοΈ GraphQL Node.js Workshop: Create an API Gateway
JavaScript
21
star
6

next-with-apollo-airbnb-auth0-graphcool

Server-side rendered & authed requests with GraphQL
JavaScript
13
star
7

next-ssr-form

next-ssr-form
TypeScript
12
star
8

options-curry

πŸ› TypeScript Options-object Currying
TypeScript
11
star
9

use-is-typing

… React Hook for typing indicator
TypeScript
9
star
10

toggl-iCal

πŸ“…β³ Calendar Toggl Entries
TypeScript
9
star
11

resident-advisor-resale-checker

🎟 Resident Advisor Resale checker
TypeScript
9
star
12

useSuspense-next-prisma-starter

TypeScript
9
star
13

next-use-query-params

TypeScript
9
star
14

gitkatt

πŸ‘¨β€πŸŽ€ create art in your github commit history
JavaScript
8
star
15

app-dir-play

TypeScript
6
star
16

Magento-CustomerLogin

Login as any customer easily from customer grid in admin. Not actually working, see stackoverflow-link.
PHP
6
star
17

brunch-jade-stylus-coffee

Bare-bones brunch skeleton using Stylus, Jade and CoffeeScript
CSS
5
star
18

500cats

😻 Pointless TypeScript/nextjs/s3/imgix project
TypeScript
5
star
19

create-react-app-docz-test

Example of create-react-app with absolute imports + docz
JavaScript
4
star
20

typed-form

typesafe formik example
TypeScript
3
star
21

nextjs-13-use-client

CSS
2
star
22

next-trpc-form-proc

TypeScript
2
star
23

awilix-typescript-dependency-injection

TypeScript
2
star
24

mfn

TypeScript
2
star
25

sanitize-object-deep-by-regex

TypeScript
1
star
26

trpc-declaration

TypeScript
1
star
27

forked-versions

TypeScript
1
star
28

unidici-fetch-reserved-header-crap

TypeScript
1
star
29

my-vite-bling-react-app

play around with vite + bling
TypeScript
1
star
30

goaskamt

JavaScript
1
star
31

AJFormViewController

Objective-C
1
star
32

boilerplate-heroku-static-nodejs-express-basic-auth

Boilerplate static web app Heroku + Basic auth setup
JavaScript
1
star
33

clubmate

nodejs fest
JavaScript
1
star
34

trpc-rsc

TypeScript
1
star
35

lectr

JavaScript
1
star
36

promise-click

JavaScript
1
star
37

trpc-ssr-form

TypeScript
1
star
38

iOSBase

future base of my ios applications
Objective-C
1
star
39

AJScrollableView

Objective-C
1
star
40

react-server-action-useformstate-issues

Just a repo showcasing some issues with the design of Server Actions / `useActionState` /`useFormState()`
TypeScript
1
star
41

yarn-workspaces-lerna-mono-server-client

JavaScript
1
star
42

wizzy

TypeScript
1
star