Skip to content

Commit 6c510d6

Browse files
committed
Move to correct location
1 parent f341d4f commit 6c510d6

File tree

1 file changed

+46
-12
lines changed

1 file changed

+46
-12
lines changed

.claude/Agents.md renamed to Agents.md

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,44 @@ React-admin is a comprehensive frontend framework for building B2B and admin app
1717

1818
### Provider Pattern
1919

20-
React-admin uses adapters called "providers" for external integrations.
20+
React-admin uses adapters called "providers" for external integrations:
21+
22+
```typescript
23+
// Data Provider - abstracts API calls
24+
dataProvider.getList('posts', {
25+
pagination: { page: 1, perPage: 5 },
26+
sort: { field: 'title', order: 'ASC' },
27+
filter: { author_id: 12 }
28+
})
29+
30+
// Auth Provider - handles authentication
31+
authProvider.checkAuth()
32+
authProvider.login({ username, password })
33+
authProvider.getPermissions()
34+
35+
// i18n Provider - manages translations
36+
i18nProvider.translate('ra.action.save')
37+
```
2138

2239
### Hook-Based API
2340

2441
All functionality exposed through hooks following React patterns:
2542

43+
```typescript
44+
// Data hooks
45+
const { data, isLoading } = useGetList('posts', {
46+
pagination: { page: 1, perPage: 10 }
47+
});
48+
49+
// State management hooks
50+
const [filters, setFilters] = useFilterState();
51+
const [page, setPage] = usePaginationState();
52+
53+
// Auth hooks
54+
const { permissions } = usePermissions();
55+
const canAccess = useCanAccess({ resource: 'posts', action: 'edit' });
56+
```
57+
2658
### Headless Core
2759

2860
The `ra-core` package contains all logic without UI. UI components are in separate packages like `ra-ui-materialui`. This allows:
@@ -65,6 +97,15 @@ react-admin/
6597
└── scripts/ # Build scripts
6698
```
6799

100+
### Key ra-core Directories
101+
102+
- `src/auth/` - Authentication and authorization (54 files)
103+
- `src/controller/` - CRUD controllers and state management
104+
- `src/dataProvider/` - Data fetching and caching logic (70 files)
105+
- `src/form/` - Form handling (31 files)
106+
- `src/routing/` - Navigation and routing (26 files)
107+
- `src/i18n/` - Internationalization (30 files)
108+
68109
### Package Dependencies
69110

70111
- **Core**: React 18.3+, TypeScript 5.8+, lodash 4.17+, inflection 3.0+
@@ -76,13 +117,12 @@ react-admin/
76117

77118
## Development Practices
78119

79-
**Search for similar functions** before creating a new one. React-admin is a rich framework that already has many building blocks.
80-
81120
### TypeScript Requirements
82121

83122
- **Strict mode enabled** - no implicit any
84123
- **Complete type exports** - all public APIs must be typed
85124
- **Generic types** for flexibility in data providers and resources
125+
- **JSDoc comments** for better IDE support
86126

87127
```typescript
88128
// GOOD - Properly typed with generics
@@ -116,17 +156,11 @@ export const MyField = ({ source, ...props }) => {
116156
```
117157
118158
### File Organization
119-
120159
- **Feature-based structure** within packages (not type-based)
121-
- **One file per component** except for components that can't be used in standalone (e.g. `DataTable.Col`)
122160
- **Co-location** - Tests (`.spec.tsx`) and stories (`.stories.tsx`) next to components
123161
- **Index exports** - Each directory has an index.ts exporting public API
124162
- **Flat structure** within features - avoid unnecessary nesting
125163
126-
### JSDoc
127-
128-
Every hook or component must have basic usage described in JSDoc, including a non-trivial example. No need to document all options - IDEs display TypeScript types for that.
129-
130164
### Documentation
131165
132166
Every new feature or API change must be documented. The documentation consists of Markdown files located in the `/docs/` directory and built with Jekyll, one file per component or hook.
@@ -176,7 +210,8 @@ make prettier # Format code
176210
feat: Add support for custom row actions in Datagrid
177211
docs: Clarify dataProvider response format
178212
```
179-
4. Use Pull Request Description Template
213+
214+
4. **Documentation**: Update relevant docs for API changes
180215
181216
### Common Make Commands
182217
```bash
@@ -206,7 +241,6 @@ make run-demo # Run demo application
206241
- Test with screen readers
207242
208243
### Browser Support
209-
210244
- Modern browsers only (Chrome, Firefox, Safari, Edge)
211245
- No IE11 support
212246
- ES5 compilation target for compatibility
@@ -264,4 +298,4 @@ Kept minimal to critical user paths due to maintenance overhead.
264298
make lint # ESLint checks
265299
make prettier # Prettier formatting
266300
make build # TypeScript type checking
267-
```
301+
```

0 commit comments

Comments
 (0)