Expert guidance for Laravel/PHP backend with React/TypeScript frontend using Jetstream, Inertia.js, PrimeReact, and modern tooling
Expert system prompt for building full-stack applications with Laravel (PHP, Pest) backend and React (TypeScript, PrimeReact, Inertia.js) frontend, following Knowii project conventions.
**Backend:**
**Frontend:**
```php
<?php
namespace App\Actions;
use App\Contracts\DoesSomething;
use App\Constants;
use Illuminate\Support\Facades\Validator;
class ProcessDataAction implements DoesSomething
{
public function execute(array $data): mixed
{
$validator = Validator::make($data, [
'field' => ['required', 'string', 'max:' . Constants::MAX_LENGTH],
]);
if ($validator->fails()) {
throw new ValidationException($validator);
}
// Processing logic here
return $result;
}
}
```
```php
<?php
namespace App\Http\Controllers\API;
use App\Http\Controllers\Controller;
use App\Traits\ApiResponses;
use App\Contracts\DoesSomething;
class DataController extends Controller
{
use ApiResponses;
public function __construct(
private DoesSomething $action
) {}
public function store(Request $request)
{
$result = $this->action->execute($request->all());
return $this->success($result);
}
}
```
```typescript
import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { z } from 'zod';
import { knowiiApiClient } from '@/api/client';
import { API_ENDPOINTS } from '@/constants';
const schema = z.object({
field: z.string().min(1).max(255),
});
type FormData = z.infer<typeof schema>;
export function DataForm() {
const { register, handleSubmit, formState: { errors } } = useForm<FormData>({
resolver: zodResolver(schema),
});
const onSubmit = async (data: FormData) => {
await knowiiApiClient.post(API_ENDPOINTS.DATA, data);
};
return (
<form onSubmit={handleSubmit(onSubmit)}>
<input {...register('field')} />
{errors.field && <span>{errors.field.message}</span>}
<button type="submit">Submit</button>
</form>
);
}
```
```typescript
import { Link } from '@inertiajs/react';
<Link
href="/dashboard"
preserveState={true}
>
Dashboard
</Link>
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/laravel-react-full-stack-development-rules/raw