This is a comprehensive, production-ready ecommerce boilerplate built with modern technologies. It's designed as a monorepo using Turborepo, making it easy to share code between web, mobile (React Native), and admin applications.
/apps
/web → Customer-facing ecommerce (Next.js 14+ App Router)
/admin → Admin dashboard (Next.js 14+ App Router)
/server → Backend API (NestJS + Prisma + GraphQL)
/packages
/design-system → Shared UI components (PandaCSS + Themes)
/services → React Query hooks (queries, mutations, types)
/eslint-config-custom → Shared ESLint config
/tsconfig → Shared TypeScript config
Frontend:
- Next.js 14+ (App Router with RSC)
- PandaCSS (Zero-runtime CSS-in-JS)
- React Query (Data fetching & caching)
- GraphQL (with graphql-request)
- React Hook Form + Zod (Forms & validation)
- TypeScript
Backend:
- NestJS (Node.js framework)
- Prisma ORM (Database toolkit)
- PostgreSQL (Database)
- GraphQL (Apollo Server)
- Passport.js (OAuth authentication)
- JWT (Authentication tokens)
- Nodemailer (Email service)
- TypeScript
DevOps:
- Turborepo (Monorepo management)
- Docker (Containerization)
- GitHub Actions (CI/CD)
- ESLint + Prettier (Code quality)
A comprehensive, themeable design system built with PandaCSS.
Features:
- Token-based design (colors, typography, spacing, shadows, borders)
- Multi-theme support (light/dark mode)
- Semantic tokens for context-specific styling
- Responsive design utilities
- Zero-runtime CSS generation
Components:
- Layout: Container, Grid, Stack, Flex, Box
- Typography: Heading, Text
- Display: Button, Badge, Card
- Forms: Input (more components can be added)
- Ecommerce: ProductCard, PriceDisplay, Rating
Usage:
import { Button, ProductCard, PriceDisplay } from '@react-shop/design-system';
<Button variant="solid" size="md">Add to Cart</Button>
<PriceDisplay price={99.99} originalPrice={129.99} />Type-safe GraphQL client with React Query hooks.
Features:
- Automatic TypeScript type generation from GraphQL schema
- React Query integration for caching & optimistic updates
- Centralized API client configuration
- Error handling utilities
Available Hooks:
useAuth: login, register, logout, resetPassworduseProducts: getProducts, getProduct, searchProductsuseCategories: getCategories, getCategoryTreeuseCart: getCart, addToCart, updateCartItem, removeFromCartuseOrders: getOrders, getOrder, createOrder, cancelOrderuseReviews: getReviews, createReview, updateReviewuseWishlist: getWishlist, addToWishlist, removeFromWishlistuseUser: getProfile, updateProfile, getAddresses
Usage:
import { useProducts, useAddToCart } from '@react-shop/services';
const { data: products, isLoading } = useProducts({ take: 10 });
const { mutate: addToCart } = useAddToCart();NestJS GraphQL API with Prisma ORM.
Database Models:
- User (with OAuth support)
- Address
- Product
- ProductVariant
- Category (hierarchical)
- Attribute
- Cart & CartItem
- Order & OrderItem
- Review
- Wishlist
- StoreSetting
GraphQL API Features:
- Full CRUD operations for all models
- Authentication & authorization (JWT + OAuth)
- Role-based access control (Customer, Admin, Super Admin)
- Product search & filtering
- Cart management with database persistence
- Order management & tracking
- Review system with moderation
- Wishlist functionality
Authentication:
- Email/password registration & login
- OAuth (Google, GitHub)
- Password reset via email
- JWT access & refresh tokens
- Role-based guards
Customer-facing ecommerce application (to be implemented).
Planned Pages:
- Homepage with featured products
- Product listing with filters
- Product detail with variants & reviews
- Shopping cart
- Multi-step checkout
- User dashboard (orders, addresses, wishlist, reviews)
- Authentication pages
Features:
- Server-side rendering for SEO
- Optimistic UI updates
- Real-time cart synchronization
- Product image galleries
- Variant selection (size, color, etc.)
- Product reviews & ratings
- Wishlist functionality
- Mobile-responsive design
Admin dashboard for managing the store (to be implemented).
Planned Features:
- Dashboard with analytics
- Product management (CRUD, variants, inventory)
- Category management (tree structure)
- Order management (status updates, tracking)
- User management (roles, activity)
- Review moderation
- Store settings
- Bulk operations
- CSV import/export
- Node.js 18+ and pnpm 8+
- PostgreSQL 14+
- Redis (optional, for caching)
- Clone the repository:
git clone <repository-url>
cd react-ecommerce- Install dependencies:
pnpm install- Set up environment variables:
cd apps/server
cp .env.example .env
# Edit .env with your configuration- Set up the database:
# Create PostgreSQL database
createdb ecommerce
# Run Prisma migrations
cd apps/server
pnpm prisma migrate dev- Generate Prisma Client:
cd apps/server
pnpm prisma generate- Generate GraphQL types:
cd packages/services
pnpm codegen- Generate PandaCSS:
cd packages/design-system
pnpm prepareStart all apps in development mode:
pnpm devThis will start:
- Backend API: http://localhost:3001
- Web app: http://localhost:3000 (when implemented)
- Admin app: http://localhost:3002 (when implemented)
Build all apps:
pnpm build- User → has many Orders, Reviews, Addresses, one Cart, one Wishlist
- Product → belongs to Category, has many Variants, Reviews, CartItems, OrderItems
- Cart → belongs to User, has many CartItems
- Order → belongs to User, has many OrderItems, references Addresses
- Review → belongs to User and Product
- UserRole: CUSTOMER, ADMIN, SUPER_ADMIN
- ProductStatus: DRAFT, ACTIVE, ARCHIVED
- OrderStatus: PENDING, PROCESSING, SHIPPED, DELIVERED, CANCELLED, REFUNDED
- ReviewStatus: PENDING, APPROVED, REJECTED
- AttributeType: COLOR, SIZE, MATERIAL, CUSTOM
When the server is running, access the GraphQL Playground at:
http://localhost:3001/graphql
Get Products:
query {
products(take: 10, where: { status: ACTIVE }) {
id
name
slug
price
images
averageRating
reviewCount
}
}Get Cart:
query {
cart {
id
items {
id
product {
name
price
}
quantity
}
total
}
}Create Order:
mutation {
createOrder(input: {
shippingAddressId: "address-id"
billingAddressId: "address-id"
paymentMethod: "credit_card"
}) {
id
status
total
}
}- Create component file:
// packages/design-system/src/components/NewComponent/NewComponent.tsx
import * as React from 'react';
import { styled } from '../../../styled-system/jsx';
export const NewComponent = styled('div', {
base: {
// Your styles
},
});- Export from index:
// packages/design-system/src/components/index.ts
export * from './NewComponent';- Add query to services package:
# packages/services/src/graphql/custom.graphql
query GetCustomData {
customData {
id
name
}
}- Run codegen:
cd packages/services
pnpm codegen- Use the generated hook:
import { useGetCustomDataQuery } from '@react-shop/services';
const { data } = useGetCustomDataQuery();- Update Prisma schema:
// apps/server/prisma/schema.prisma
model NewModel {
id String @id @default(uuid())
name String
// ... fields
}- Create and run migration:
cd apps/server
pnpm prisma migrate dev --name add_new_model- Update GraphQL schema and resolvers accordingly.
# Run all tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Run tests with coverage
pnpm test:cov- Build Docker images:
docker-compose build- Start services:
docker-compose up -dRequired environment variables for production:
DATABASE_URL: PostgreSQL connection stringJWT_SECRET: Secret for JWT tokensJWT_REFRESH_SECRET: Secret for refresh tokensGOOGLE_CLIENT_ID&GOOGLE_CLIENT_SECRET: OAuth credentialsGITHUB_CLIENT_ID&GITHUB_CLIENT_SECRET: OAuth credentialsSMTP_*: Email service configuration
The architecture is designed for easy React Native integration:
- Create a new app:
mkdir apps/mobile
cd apps/mobile
npx react-native init Mobile- Install shared packages:
pnpm add @react-shop/services- Use the same GraphQL hooks:
import { useProducts, useAddToCart } from '@react-shop/services';
// Works the same as in web!- Adapt design system components to React Native equivalents.
- Create a feature branch
- Make your changes
- Run linting and tests
- Submit a pull request
MIT
For issues and questions, please open an issue on GitHub.