react-ecommerce/
├── apps/
│ ├── web/ → Customer store (localhost:3000)
│ ├── admin/ → Admin dashboard (localhost:3002)
│ └── server/ → Backend API (localhost:5001)
├── packages/
│ ├── sdk/ → API client + React Query hooks
│ └── design-system/→ TailwindCSS components
pnpm installcd apps/server
cp .env.example .env
# Edit .env with your database credentials
# Start PostgreSQL (via Docker)
docker-compose up -d
# Run migrations
pnpm prisma migrate dev
# Seed database
pnpm prisma:seed# From root - starts all apps
pnpm dev
# Or start individually:
cd apps/web && pnpm dev # Customer store
cd apps/admin && pnpm dev # Admin dashboard
cd apps/server && pnpm dev # Backend API- Customer Store: http://localhost:3000
- Admin Dashboard: http://localhost:3002
- Backend API: http://localhost:5001
- Prisma Studio:
cd apps/server && pnpm prisma studio - API Docs: http://localhost:5001/api
Email: customer@example.com
Password: customer123
Email: admin@example.com
Password: admin123
- Web Features:
apps/web/FEATURES.md - Admin Features:
apps/admin/FEATURES.md - Architecture:
apps/APPS_ARCHITECTURE.md - Auth Flow:
packages/sdk/AUTH_FLOW.md - Absolute Paths:
ABSOLUTE_PATHS_GUIDE.md - Backend Setup:
apps/server/README.md - SDK Usage:
packages/sdk/README.md - Design System:
packages/design-system/README.md
pnpm dev # Start all apps
pnpm build # Build all apps
pnpm lint # Lint all apps
pnpm clean # Clean all build artifactscd apps/server
pnpm prisma migrate dev # Create & apply migration
pnpm prisma:seed # Seed database
pnpm prisma studio # Open Prisma Studio
pnpm prisma generate # Regenerate Prisma Clientgit commit -m "feat: add new feature" # Conventional commit
git commit -m "fix: fix bug" # Bug fix
git commit -m "docs: update docs" # Documentationimport {
Button,
Input,
ProductCard,
Container
} from '@react-shop/design-system';
function MyComponent() {
return (
<Container>
<Button variant="primary">Click me</Button>
<Input placeholder="Search..." />
</Container>
);
}'use client';
import {
useProductList,
useAddToCart,
useLogin
} from '@react-shop/sdk';
function ProductList() {
const { data: products, isLoading } = useProductList();
const addToCart = useAddToCart();
const login = useLogin();
if (isLoading) return <div>Loading...</div>;
return (
<div>
{products?.map(product => (
<div key={product.id}>
<h3>{product.title}</h3>
<button onClick={() => addToCart.mutate({
productId: product.id,
quantity: 1
})}>
Add to Cart
</button>
</div>
))}
</div>
);
}NEXT_PUBLIC_API_URL=http://localhost:5001NEXT_PUBLIC_API_URL=http://localhost:5001DATABASE_URL=postgresql://user:password@localhost:5432/ecommerce
SECRET=your-jwt-secret-key
PORT=5001# Add to specific app
pnpm add <package> --filter web
pnpm add <package> --filter admin
pnpm add <package> --filter server
# Add to specific package
pnpm add <package> --filter @react-shop/sdk
pnpm add <package> --filter @react-shop/design-system# Kill process on port 3000
kill -9 $(lsof -t -i:3000)
# Kill process on port 5001
kill -9 $(lsof -t -i:5001)# Check if PostgreSQL is running
docker ps
# Restart PostgreSQL
docker-compose restart# Reinstall dependencies
rm -rf node_modules
pnpm install
# Clear Next.js cache
cd apps/web && rm -rf .nextcd apps/server
pnpm prisma generate- ✅ Read
apps/APPS_ARCHITECTURE.mdto understand the project structure - ✅ Review
apps/web/FEATURES.mdfor customer store features - ✅ Review
apps/admin/FEATURES.mdfor admin dashboard features - Start building features following the priority order
- Create components in Design System as needed
- Add API endpoints in server as needed
- Test everything thoroughly
- Use absolute imports:
@components/Buttoninstead of../../../components/Button - Follow Atomic Design: Atoms → Molecules → Organisms
- Write semantic commits: Use conventional commits format
- Test auth flow: Login, token refresh, logout
- Mobile-first: Start with mobile design, then desktop
- Accessibility: Use semantic HTML and ARIA labels
- Type safety: Always use TypeScript, avoid
any
- Create a feature branch:
git checkout -b feat/my-feature - Make changes and commit:
git commit -m "feat: add my feature" - Push to branch:
git push origin feat/my-feature - Create Pull Request
- Wait for review and merge
- Documentation: Check
/docsfolder and README files - Issues: Create GitHub issue
- Questions: Ask in team chat
Happy coding! 🚀