Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
00d8fbb
feat: add turborepo
viniarruda Dec 7, 2022
640222d
feat: packages at turborepo
viniarruda Dec 7, 2022
55e5901
feat(DS): create initial config for theme
viniarruda Dec 7, 2022
9c99dde
feat: migrate design system to pandacss
viniarruda Dec 31, 2025
64553f4
feat: add design system components
viniarruda Dec 31, 2025
221332b
feat: add sdk package with react query hooks
viniarruda Dec 31, 2025
d301790
feat: add prisma schema and backend modules
viniarruda Dec 31, 2025
18d5a56
docs: add comprehensive project documentation
viniarruda Dec 31, 2025
30af98a
chore: add project rules and commit guidelines
viniarruda Dec 31, 2025
08aa942
fix: update tsconfig extends path
viniarruda Dec 31, 2025
ab5f3c3
docs: update backend readme with setup instructions
viniarruda Dec 31, 2025
1a6f0e1
chore: migrate from yarn to pnpm
viniarruda Dec 31, 2025
5686857
fix: use workspace protocol for local dependencies
viniarruda Dec 31, 2025
aa1f6d0
chore: update deprecated dependencies
viniarruda Dec 31, 2025
3bc4465
fix: make husky hook executable
viniarruda Dec 31, 2025
42989a3
docs: add dependency update migration guide
viniarruda Dec 31, 2025
b8a55d0
feat: add database seeding with sample data
viniarruda Dec 31, 2025
3f0def0
fix: correct seed file to match prisma schema
viniarruda Dec 31, 2025
ec44f9d
fix: handle cart item creation with null variantId
viniarruda Dec 31, 2025
4c65ae0
feat: implement comprehensive ecommerce database schema
viniarruda Dec 31, 2025
b26af6d
docs: add seed file update guide
viniarruda Dec 31, 2025
a6a6ffb
feat: update seed file for comprehensive schema
viniarruda Dec 31, 2025
0541d08
chore: remove seed todo file
viniarruda Dec 31, 2025
fad06a5
feat: update prisma service and graphql schema for comprehensive schema
viniarruda Dec 31, 2025
3138f75
docs: add comprehensive next steps guide
viniarruda Dec 31, 2025
4894233
refactor: remove typeorm and migrate to prisma
viniarruda Dec 31, 2025
392cdd7
refactor: update services to use prisma
viniarruda Dec 31, 2025
14aa593
docs: add typeorm to prisma migration guide
viniarruda Dec 31, 2025
aa2d681
refactor: update cart service for comprehensive schema
viniarruda Dec 31, 2025
61869c2
refactor: enhance review service with new fields
viniarruda Dec 31, 2025
48e2b6c
refactor: enhance order service with payments and discounts
viniarruda Dec 31, 2025
5e95ad0
feat: add tag, discount, payment, and shipment modules
viniarruda Dec 31, 2025
eab4cf3
docs: add backend completion status
viniarruda Dec 31, 2025
9b0d9e9
test: add cart service unit and resolver tests
viniarruda Dec 31, 2025
303a24d
docs: add testing guide and postman collection
viniarruda Dec 31, 2025
17c1c20
fix: attempt jest configuration fix and document known issues
viniarruda Dec 31, 2025
451b83c
feat: add postman collection auto-generation tools
viniarruda Dec 31, 2025
6880f11
fix: implement register mutation and fix auth token field names
viniarruda Dec 31, 2025
8c0ebcd
fix: align user fields with prisma schema (firstName/lastName)
viniarruda Dec 31, 2025
10e766c
fix: regenerate prisma client to correct location
viniarruda Dec 31, 2025
1cc425c
docs: add compilation errors documentation and fix plan
viniarruda Dec 31, 2025
33729a2
fix: implement mvp fixes for core modules
viniarruda Dec 31, 2025
40f52fc
feat: migrate from GraphQL to REST API
viniarruda Dec 31, 2025
d5e6437
fix: add path aliases and fix controller arguments
viniarruda Dec 31, 2025
9e8a257
docs: add REST migration success documentation
viniarruda Dec 31, 2025
6cfdb17
feat: update postman scripts for REST API
viniarruda Dec 31, 2025
01e3b17
fix: correct Postman collection URL format
viniarruda Dec 31, 2025
bee42c9
chore: update Postman collection to use port 5001
viniarruda Dec 31, 2025
c7874b2
fix: update tsconfig to exclude dist and avoid compilation errors
viniarruda Dec 31, 2025
fb995d7
feat: migrate SDK from GraphQL to REST API
viniarruda Dec 31, 2025
b214366
feat: enhance Design System with Storybook and new components
viniarruda Dec 31, 2025
c2444f0
refactor: reorganize Design System with Atomic Design and extract tokens
viniarruda Dec 31, 2025
a57c733
refactor: reorganize SDK auth hooks with granular structure
viniarruda Dec 31, 2025
d9bae97
feat: configure absolute paths and centralize API routes
viniarruda Dec 31, 2025
275b6c9
refactor: simplify route constants following REST principles
viniarruda Dec 31, 2025
eb05f02
feat: setup web app with Next.js 14+ and React 19
viniarruda Dec 31, 2025
d943288
fix: correct Next.js 14 folder structure
viniarruda Dec 31, 2025
4da6ee4
chore: add .gitignore for web app
viniarruda Dec 31, 2025
ceb93f1
fix: configure PandaCSS properly in Design System
viniarruda Dec 31, 2025
d4fbceb
fix: update all DS components to use @styled-system imports
viniarruda Dec 31, 2025
4f5c51a
feat: migrate from PandaCSS to TailwindCSS
viniarruda Dec 31, 2025
c34f3aa
feat: complete TailwindCSS migration
viniarruda Dec 31, 2025
03c3d4d
fix: replace @lib/utils alias with relative paths in components
viniarruda Dec 31, 2025
983b2f2
feat: configure absolute paths with webpack aliases
viniarruda Dec 31, 2025
70f7ede
docs: add absolute paths configuration guide
viniarruda Dec 31, 2025
5c11f0c
fix: replace @/ with @sdk in SDK package
viniarruda Dec 31, 2025
f24b0fd
docs: update absolute paths guide with @sdk alias
viniarruda Dec 31, 2025
6f5261e
fix: correct SdkProvider usage and ApiProvider config handling
viniarruda Dec 31, 2025
790d41c
feat: add token refresh mechanism and Poppins font
viniarruda Dec 31, 2025
462e841
docs: add comprehensive authentication flow documentation
viniarruda Dec 31, 2025
2915643
docs: add implementation summary for token refresh and font
viniarruda Dec 31, 2025
3606af7
refactor: remove unnecessary refresh token validation
viniarruda Dec 31, 2025
4f1d593
docs: add comprehensive feature lists and architecture guide
viniarruda Dec 31, 2025
23b6ca6
docs: add quick start guide with commands and examples
viniarruda Dec 31, 2025
b5fd245
docs: add PR description for authentication and infrastructure work
viniarruda Dec 31, 2025
c60611a
fix: remove lock
viniarruda Dec 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
301 changes: 301 additions & 0 deletions .cursorrules
Original file line number Diff line number Diff line change
@@ -0,0 +1,301 @@
# React Ecommerce Boilerplate - Cursor Rules

## Project Overview

This is a comprehensive ecommerce boilerplate built with:
- **Monorepo**: Turborepo for managing multiple packages
- **Frontend**: Next.js 14+ with App Router, PandaCSS for styling
- **Backend**: NestJS + Prisma + GraphQL (Apollo Server)
- **Database**: PostgreSQL
- **SDK**: React context providers with Axios client and React Query hooks
- **Design System**: PandaCSS-based component library with theming

## Working with This Project

### Architecture Overview

```
/apps
/web β†’ Customer-facing ecommerce (Next.js 14+)
/admin β†’ Admin dashboard (Next.js 14+)
/server β†’ Backend API (NestJS + Prisma + GraphQL)
/docs β†’ Developer documentation (Markdown)

/packages
/design-system β†’ PandaCSS components with theming
/sdk β†’ React providers, API client, and hooks
/eslint-config-custom β†’ Shared ESLint config
/tsconfig β†’ Shared TypeScript config
```

### Key Technologies

1. **Backend (NestJS + Prisma)**
- Database: PostgreSQL with Prisma ORM
- API: GraphQL with Apollo Server
- Auth: JWT + OAuth (Google, GitHub)
- All resolvers use Prisma for database access

2. **SDK Package**
- Name: `@react-shop/sdk`
- Provides: `SdkProvider`, `ApiProvider`, `QueryProvider`
- Services organized by domain: `services/auth/`, `services/products/`, etc.
- Each service has `queries.ts` and `mutations.ts`
- Uses Axios client with automatic token management

3. **Design System**
- Name: `@react-shop/design-system`
- Styling: PandaCSS (zero-runtime)
- Themes: Light/dark mode with semantic tokens
- Components: Layout, Typography, Forms, Ecommerce-specific

### Development Workflow

1. **Starting Development**
```bash
yarn install
yarn dev # Starts all apps in parallel
```

2. **Database Migrations**
```bash
cd apps/server
yarn prisma migrate dev --name migration_name
yarn prisma generate
```

3. **Adding New Components to Design System**
- Create component in `packages/design-system/src/components/`
- Use PandaCSS styling with `css()` or `styled()`
- Export from `packages/design-system/src/components/index.ts`

4. **Adding New Services to SDK**
- Create folder in `packages/sdk/src/services/`
- Add `queries.ts` with React Query hooks using `useQuery`
- Add `mutations.ts` with React Query hooks using `useMutation`
- Use `useApiClient()` hook to access Axios instance
- Export from service `index.ts` and main `services/index.ts`

5. **Backend Development**
- Create modules in `apps/server/src/`
- Each module has: service, resolver, DTOs
- Use PrismaService for database operations
- GraphQL schema in `apps/server/src/graphql/schemas/schema.gql`

### Code Patterns

1. **SDK Service Pattern**
```typescript
// queries.ts
import { useQuery } from '@tanstack/react-query';
import { useApiClient } from '../../providers/ApiProvider';

export const useListItems = () => {
const { client } = useApiClient();
return useQuery({
queryKey: ['items'],
queryFn: async () => {
const { data } = await client.post('', {
query: `query { items { id name } }`,
});
return data.data.items;
},
});
};
```

2. **NestJS Resolver Pattern**
```typescript
@Resolver('Item')
export class ItemResolver {
constructor(private itemService: ItemService) {}

@Query('items')
@UseGuards(JwtAuthGuard)
async getItems(@CurrentUser() user: any) {
return this.itemService.getItems();
}
}
```

3. **PandaCSS Component Pattern**
```typescript
import { styled } from '../../../styled-system/jsx';

export const Component = styled('div', {
base: {
p: '4',
borderRadius: 'md',
},
});
```

### Important Notes

- **Always use the SDK providers** - Wrap apps with `<SdkProvider>`
- **Use semantic tokens** - Prefer `bg.surface` over `white`
- **Follow feature structure** - Organize by domain, not by type
- **Update documentation** - Add docs for new features in `apps/docs/`
- **Type safety** - Always use TypeScript, no `any` types
- **Prisma first** - Use Prisma for all database operations

## Commit Convention Rule

### When Finishing a New Feature

**ALWAYS create a commit using Conventional Commits with simple, concise messages.**

### Format

```
<type>: <simple description>
```

### Types

- `feat` - New feature
- `fix` - Bug fix
- `docs` - Documentation changes
- `style` - Code style changes (formatting, no logic change)
- `refactor` - Code refactoring
- `perf` - Performance improvements
- `test` - Adding or updating tests
- `chore` - Maintenance tasks (dependencies, config)

### Rules

1. **Keep it simple** - No need for long explanations
2. **Use imperative mood** - "add" not "added", "fix" not "fixed"
3. **No period at the end** - Keep it clean
4. **Max 50 characters** for the subject line
5. **One feature per commit** - Don't bundle multiple features

### Examples

βœ… **Good:**
```
feat: add product search functionality
fix: cart total calculation
docs: update SDK usage examples
refactor: extract auth logic to service
chore: update dependencies
```

❌ **Bad:**
```
feat: Added a new product search functionality with filters and sorting options that allows users to...
fixed the bug
update
WIP
changes
```

### When to Commit

- βœ… After completing a feature
- βœ… After fixing a bug
- βœ… After updating documentation
- βœ… After refactoring code
- ❌ Don't commit incomplete work with "WIP"
- ❌ Don't commit debugging code or console.logs

### Multi-Part Features

For features spanning multiple commits, use scope:

```
feat(products): add list endpoint
feat(products): add detail endpoint
feat(products): add search functionality
```

### Breaking Changes

If introducing breaking changes, add `!` after type:

```
feat!: migrate from services to sdk package
refactor!: change API response format
```

Or add BREAKING CHANGE in body:

```
feat: migrate to new SDK architecture

BREAKING CHANGE: Package renamed from @react-shop/services to @react-shop/sdk
```

## Additional Rules

### Code Quality

1. **Always run linter** before committing
2. **Fix linter errors** - Don't ignore them
3. **Write meaningful variable names** - No `x`, `y`, `temp`
4. **Add JSDoc comments** for complex functions
5. **Extract magic numbers** to named constants

### Testing

1. **Write tests** for new features (when applicable)
2. **Run tests** before committing
3. **Mock SDK** in component tests

### Documentation

1. **Update README** when adding major features
2. **Add examples** in `apps/docs/` for new APIs
3. **Document breaking changes** clearly
4. **Update IMPLEMENTATION_STATUS.md** when completing todos

### Don't Do

- ❌ Don't commit directly to `main` without review
- ❌ Don't commit with failing tests
- ❌ Don't commit with linter errors
- ❌ Don't commit `console.log` statements
- ❌ Don't commit commented-out code
- ❌ Don't commit TODO comments without context
- ❌ Don't use `any` type in TypeScript
- ❌ Don't skip error handling

## Quick Reference

### Start Development
```bash
pnpm install
pnpm dev
```

### Database Commands
```bash
cd apps/server
pnpm prisma migrate dev
pnpm prisma studio
pnpm prisma generate
```

### Add New Package
```bash
pnpm add <package> --filter <workspace-name>
```

### Build for Production
```bash
pnpm build
```

### Run Linter
```bash
pnpm lint
```

## Resources

- [Documentation](./apps/docs/README.md)
- [Features Overview](./FEATURES.md)
- [Implementation Status](./IMPLEMENTATION_STATUS.md)
- [SDK Documentation](./packages/sdk/README.md)
- [Design System](./packages/design-system/README.md)

Loading
Loading