Skip to content

E-commerce monorepo application using NextJs, React, React-native, Design-System and Graphql with Typescript

License

Notifications You must be signed in to change notification settings

react-shop/react-ecommerce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

React Ecommerce Boilerplate

A comprehensive, production-ready ecommerce boilerplate built with React, Next.js, NestJS, Prisma, and GraphQL. Designed as a Turborepo monorepo for easy code sharing between web, mobile, and admin applications.

Features

  • 🎨 Design System - PandaCSS-based component library with theming
  • πŸ”„ GraphQL API - Type-safe API with React Query hooks
  • πŸ›’ Full Ecommerce - Products, cart, checkout, orders, reviews
  • πŸ” Authentication - JWT + OAuth (Google, GitHub)
  • πŸ“± Mobile Ready - Architecture supports React Native
  • 🎯 Admin Dashboard - Product, order, and user management
  • πŸš€ Modern Stack - Next.js 14, NestJS, Prisma, TypeScript

Quick Start

Prerequisites

  • Node.js 18+
  • pnpm 8+
  • PostgreSQL 14+

Installation

# Clone and install
git clone <repository-url>
cd react-ecommerce
pnpm install

# Setup database
cd apps/server
cp .env.example .env
# Edit .env with your database credentials

# Run migrations
pnpm prisma migrate dev

# Generate types
pnpm prisma generate
cd ../../packages/services
pnpm codegen

# Start development
cd ../..
pnpm dev

The backend API will be available at http://localhost:3001/graphql

Project Structure

/apps
  /web          β†’ Customer-facing Next.js app
  /admin        β†’ Admin dashboard Next.js app
  /server       β†’ NestJS GraphQL API

/packages
  /design-system β†’ PandaCSS component library
  /services      β†’ React Query + GraphQL hooks
  /eslint-config-custom β†’ Shared ESLint config
  /tsconfig      β†’ Shared TypeScript config

Tech Stack

Frontend:

  • Next.js 14 (App Router)
  • PandaCSS (Styling)
  • React Query (Data fetching)
  • GraphQL (API layer)
  • TypeScript

Backend:

  • NestJS (Framework)
  • Prisma (ORM)
  • PostgreSQL (Database)
  • GraphQL (API)
  • JWT + OAuth (Auth)

Documentation

Available Scripts

# Development
pnpm dev          # Start all apps in development mode
pnpm dev:server   # Start only the backend
pnpm dev:web      # Start only the web app

# Building
pnpm build        # Build all apps
pnpm lint         # Lint all packages

# Database
pnpm prisma:migrate  # Run database migrations
pnpm prisma:studio   # Open Prisma Studio
pnpm prisma:generate # Generate Prisma Client

# Code Generation
pnpm codegen      # Generate GraphQL types

Key Features

Design System

  • Token-based theming (light/dark mode)
  • Responsive components
  • Ecommerce-specific components (ProductCard, PriceDisplay, Rating)
  • Zero-runtime CSS with PandaCSS

Backend API

  • Full CRUD for products, categories, orders, reviews
  • Cart management with database persistence
  • Order tracking and management
  • Review system with moderation
  • Role-based access control
  • OAuth integration (Google, GitHub)

Services Package

  • Type-safe GraphQL hooks
  • Automatic type generation
  • React Query integration
  • Optimistic updates
  • Error handling

Customization

Adding Components

// packages/design-system/src/components/MyComponent/MyComponent.tsx
import { styled } from '../../../styled-system/jsx';

export const MyComponent = styled('div', {
  base: {
    padding: '4',
    borderRadius: 'md',
  },
});

Adding GraphQL Queries

# packages/services/src/graphql/custom.graphql
query GetCustomData {
  customData {
    id
    name
  }
}

Then run pnpm codegen to generate TypeScript types.

Extending Database

// apps/server/prisma/schema.prisma
model NewModel {
  id   String @id @default(uuid())
  name String
}

Then run pnpm prisma migrate dev --name add_new_model.

React Native Support

The architecture is designed for React Native integration:

  1. Create a mobile app
  2. Install @react-shop/services
  3. Use the same GraphQL hooks
  4. Adapt UI components to React Native

Deployment

Docker

docker-compose up -d

Environment Variables

Required for production:

  • DATABASE_URL
  • JWT_SECRET & JWT_REFRESH_SECRET
  • GOOGLE_CLIENT_ID & GOOGLE_CLIENT_SECRET
  • GITHUB_CLIENT_ID & GITHUB_CLIENT_SECRET
  • SMTP configuration for emails

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

MIT

Links

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •