---
title: "React Kit Development Workflow"
description: "Daily commands for the React kit and step-by-step guides to adding a page and a form, plus type checking with tsc and linting with ESLint and Prettier."
---
# Development
## Daily workflow
Run `composer dev` to start everything, then work in `resources/js` and `Modules/`. While you edit, Vite reloads the browser and keeps the Wayfinder files up to date.
| Command | What it does |
| --- | --- |
| `composer dev` | Runs `php artisan serve`, `queue:listen`, `pail` and `npm run dev` together |
| `npm run dev` | Vite dev server with HMR (also regenerates Wayfinder files) |
| `npm run build` | Production build to `public/build` |
| `npm run build:ssr` | Client + SSR bundle (`vite build && vite build --ssr`) |
| `php artisan erag:generate-lang` | Export `lang/*` to `resources/js/lang/*.json` |
| `php artisan wayfinder:generate --with-form` | Regenerate Wayfinder files without Vite running |
The full list is on the [Commands](/docs/reference/commands) page.
::: tip
Change not showing up in the browser? Make sure `npm run dev` (or `composer dev`) is running, or run `npm run build`.
:::
## Adding a page
Let's walk through adding a Reports page to the Dashboard module, served at `/reports`.
```text
routes/web.php → ReportController@index → Inertia::render('reports/index') → pages/reports/index.tsx
```
1. Add the route to `Modules/Dashboard/routes/web.php` inside the `auth` + `verified` group. Give it the `permission:View Reports|View Tenant Reports` middleware and the name `reports.index`.
2. Create the controller at `Modules/Dashboard/Http/Controllers/ReportController.php`. It should stay thin: call a service in `Modules//Services` and return `Inertia::render('reports/index', [...])`.
3. Create the page at `resources/js/pages/reports/index.tsx`. It needs a default-exported component and a static `layout` that sets the breadcrumbs.
4. Once Wayfinder has run, you can import `@/routes/reports`. If `npm run dev` is running, that happens on its own.
5. Add the translation keys to `lang/en/modules/dashboard.php` and to the same file in each of the other locales, then run `php artisan erag:generate-lang`.
6. Add the permissions: `View Reports` goes in `config/permissions/dashboard.php` and `View Tenant Reports` in `config/permissions/tenant/dashboard.php`. Seed them afterwards.
7. If you want a menu entry (optional), add one to `database/seeders/MenuSeeder.php` and `database/seeders/tenant/MenuSeeder.php` with `'route_name' => 'reports.index'` and the permission.
8. Write a test that checks the route renders the `reports/index` component.
The page itself doesn't need much:
```tsx
export default function ReportsIndex({ reports }: Props) {
const { __ } = reactLang();
return (
<>
{reports.map((report) => - {report.name}
)}
>
);
}
```
::: details View route and controller
```php
// Modules/Dashboard/routes/web.php
use Modules\Dashboard\Http\Controllers\ReportController;
Route::middleware(['auth', 'verified'])->group(function () {
Route::get('reports', [ReportController::class, 'index'])
->middleware('permission:View Reports|View Tenant Reports')
->name('reports.index');
});
```
```php
namespace Modules\Dashboard\Http\Controllers;
use App\Http\Controllers\Controller;
use Inertia\Inertia;
use Inertia\Response;
class ReportController extends Controller
{
public function index(): Response
{
return Inertia::render('reports/index', [
'reports' => [],
]);
}
}
```
:::
::: details View full page file
```tsx
import { reactLang } from '@erag/lang-sync-inertia/react';
import { Head } from '@inertiajs/react';
import Heading from '@/components/heading';
import { dashboard } from '@/routes';
import { index } from '@/routes/reports';
type Props = {
reports: { id: number; name: string }[];
};
export default function ReportsIndex({ reports }: Props) {
const { __ } = reactLang();
return (
<>