This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
react-adonisjs is a monorepo that combines React Router with AdonisJS 6+, providing a full-stack framework with database ORM, authentication, middleware, mailer, and dependency injection capabilities. It consists of two main packages:
packages/adapter- The core @matstack/react-adonisjs adapter package that bridges React Router and AdonisJSpackages/reference-app- A sample application used for integration testing and development
pnpm dev- Start development servers for all packages in parallelpnpm dev:adapter- Start only the adapter package in watch modepnpm dev:app- Start only the reference app dev serverpnpm build- Build all packagespnpm test- Run tests for all packages
pnpm run dev- TypeScript watch mode compilationpnpm run test- Run adapter tests with NODE_DEBUG enabledpnpm run quick:test- Run tests without debug outputpnpm run lint- ESLint checkingpnpm run typecheck- TypeScript type checkingpnpm run build- Clean, compile, and prepare for publishing
pnpm run dev- Start AdonisJS development server with React Routerpnpm run build- Build the application (includes React Router typegen)pnpm run test- Run integration testspnpm run lint- ESLint checkingpnpm run typecheck- TypeScript type checking
The adapter bridges React Router 7 (formerly Remix) with AdonisJS:
src/react_router_adapter.ts- Core adapter implementation for handling requests/responses between frameworksproviders/react_router_provider.ts- AdonisJS service provider for registering React Router functionalitysrc/hooks/- Build hooks for integrationsrc/types/- TypeScript type definitionscommands/- Ace commands for scaffolding (e.g.,node ace react:route)
Standard AdonisJS 6 application structure with React Router integration:
app/- AdonisJS controllers, middleware, models, etc.resources/react_app/- React Router application code (routes, components)config/- AdonisJS configuration filesdatabase/- Migrations and database setupadonisrc.ts- AdonisJS configuration with react-adonisjs provider
The reference app uses path imports (e.g., #controllers/*, #models/*) for clean module resolution.
The reference app serves as the primary integration test suite. Tests are located in:
packages/adapter/tests/- Unit tests for adapter functionalitypackages/reference-app/tests/- Integration tests using Japa test runner
Both packages use Japa for testing with different configurations appropriate to their scope.
This project uses pnpm workspaces. The adapter package depends on React Router 7 as peer dependencies, allowing flexibility in the consuming application's React Router version.
Use the custom Ace command to generate new React Router routes:
node ace react:route my-route
node ace react:route --action my-route # Include server action