Overview:
The React/Prisma/TS/GraphQL E-Commerce Example is a reference project that aims to tackle common challenges faced by developers working with React, Prisma, and GraphQL. It provides a monorepo setup with different projects and APIs, offering features like a GraphQL API Gateway in front of Prisma, a Next.js React App with Apollo Client, and E2E testing using Nightwatch.js. With a strong focus on developer experience, the project includes tools like Travis CI for cross-browser testing, GraphQL with Apollo for optimistic updates, and Pessimisticâ„¢ updates to ensure smooth functionality even with JavaScript disabled in the browser.
Features:
- Tech Stack: TypeScript is the primary language used, with a monorepo setup encompassing various projects and APIs.
- GraphQL Integration: The project utilizes GraphQL with Apollo for handling data loading and rendering with render prop components.
- E-Commerce Functionality: Includes features like creating a shopping cart, adding/editing products, product listing from GraphQL, and support for discount codes.
- Server-Side Rendering: The React app is server-side rendered for improved performance and SEO.
- Testing Capabilities: E2E testing using Nightwatch.js is provided, along with instructions for running tests in different environments.
- Development Workflow: Offers seamless installation and setup process using Yarn, Docker, and other essential tools like Node 9 and Homebrew.
Installation:
- Install Node 9, Homebrew, and Docker.
- Install Yarn globally with
npm install -g yarn
. - Start Docker and run
yarn install
to install dependencies for the API, web, and E2E projects. - Start Prisma and seed the database with
yarn setup:prisma
. - Start the API Gateway, Next.js web app, and TypeScript watcher for E2E testing in parallel with
yarn dev
.
Summary:
The React/Prisma/TS/GraphQL E-Commerce Example is a comprehensive project that provides a solid foundation for developers working with React, Prisma, and GraphQL in an e-commerce context. With a focus on best practices, developer experience, and testing, the project aims to address common challenges and serve as a valuable reference point for those looking to build similar applications. The detailed installation guide and feature-rich setup make it an ideal starting point for developers interested in exploring these technologies further.