The Astrify Starter Kit
diff --git a/resources/js/docs/json-table.mdx b/resources/js/docs/json-table.mdx
index 8904b1e..2001300 100644
--- a/resources/js/docs/json-table.mdx
+++ b/resources/js/docs/json-table.mdx
@@ -50,7 +50,7 @@ This usage example loads data via JSON fetch requests. To load data via Inertia
JSON Table Example
- This table uses JSON requests for it's data instead of Inertia requests. Useful when you need multiple tables on a single page
+ This table uses JSON requests for its data instead of Inertia requests. Useful when you need multiple tables on a single page
or don't want to tie the pagination to the rest of the page.
@@ -78,17 +78,19 @@ This usage example loads data via JSON fetch requests. To load data via Inertia
-{`Route::get('/json-table-data-example', function () {
- $users = \\App\\Models\\User::select('id', 'name', 'email', 'created_at')
- ->orderBy('id', 'desc')
- ->paginate(10);
-
- return response()->json($users);
- });
-
- Route::get('/json-table-example', function () {
- return Inertia::render('json-table-example');
- });`}
+{`Route::middleware(['auth'])->group(function () {
+ Route::get('/json-table-data-example', function () {
+ $users = \\App\\Models\\User::select('id', 'name', 'email', 'created_at')
+ ->orderBy('id', 'desc')
+ ->paginate(10);
+
+ return response()->json($users);
+ });
+
+ Route::get('/json-table-example', function () {
+ return Inertia::render('json-table-example');
+ });
+});`}
Optionally seed your database with test data to see the pagination in action:
diff --git a/resources/js/docs/paginated-table.mdx b/resources/js/docs/paginated-table.mdx
index 9e39e40..1145810 100644
--- a/resources/js/docs/paginated-table.mdx
+++ b/resources/js/docs/paginated-table.mdx
@@ -76,7 +76,7 @@ This usage example loads data via Inertia requests. As you paginate this table t
Inertia Table
- This table loads it's data via Inertia requests. As you paginate this table the page number is reflected in the address bar.
+ This table loads its data via Inertia requests. As you paginate this table the page number is reflected in the address bar.
-{`Route::get('inertia-table-example', function () {
- $users = \\App\\Models\\User::select('id', 'name', 'email', 'created_at')
- ->orderBy('id', 'desc')
- ->paginate(10)
- ->onEachSide(1);
-
- return Inertia::render('inertia-table-example', [
- 'users' => $users,
- ]);
-})->name('table.index');`}
+{`Route::middleware(['auth'])->group(function () {
+ Route::get('inertia-table-example', function () {
+ $users = \\App\\Models\\User::select('id', 'name', 'email', 'created_at')
+ ->orderBy('id', 'desc')
+ ->paginate(10)
+ ->onEachSide(1);
+
+ return Inertia::render('inertia-table-example', [
+ 'users' => $users,
+ ]);
+ })->name('table.index');
+});`}
diff --git a/resources/js/docs/upload.mdx b/resources/js/docs/upload.mdx
index 805c4fa..7d2f586 100644
--- a/resources/js/docs/upload.mdx
+++ b/resources/js/docs/upload.mdx
@@ -15,6 +15,8 @@ import { Separator } from '@/components/ui/separator';
import { Upload, FileText, Cloud, Shield, Zap } from 'lucide-react';
import { UploadPreview, UploadPreviewSource, ImageUploadDemo, ImageUploadDemoSource } from '@/components/previews/upload-preview';
+A complete file upload module for S3-compatible storage (Amazon S3, MinIO, DigitalOcean Spaces, etc.) with Laravel backend integration. Features drag & drop upload, real-time progress tracking, client-side file validation, and secure signed URL uploads.
+
## Multi-file Upload
Upload multiple files with drag & drop support, progress tracking, and error handling.
@@ -44,12 +46,11 @@ This command will install the necessary JavaScript dependencies, shadcn/ui compo
Reference the SignedUrlController in your routes file
```php
-Route::post('/upload/signed-url',
- \App\Http\Controllers\Astrify\SignedUrlController::class
-)
-// if the environment is public be sure to require auth
-//->middleware(['auth'])
-->name('upload.signed-url');
+Route::middleware(['auth'])->group(function () {
+ Route::post('/upload/signed-url',
+ \App\Http\Controllers\Astrify\SignedUrlController::class
+ )->name('upload.signed-url');
+});
```
### 3: Install Laravel Dependencies
@@ -234,34 +235,36 @@ This usage example provides a full page Inertia component. It integrates the upl
-{`Route::get('/upload', function () {
- return Inertia::render('inertia-upload-example');
-})->name('upload.index');
-
-Route::post('/upload', function (\\Illuminate\\Http\\Request $request) {
- // Validate the incoming request
- $validated = $request->validate([
- 'name' => 'required|string|max:255',
- 'uploadedFiles' => 'required|array|min:1',
- 'uploadedFiles.*.id' => 'required|string',
- 'uploadedFiles.*.name' => 'required|string',
- 'uploadedFiles.*.sha256' => 'required|string',
- 'uploadedFiles.*.size' => 'required|integer|min:0',
- 'uploadedFiles.*.type' => 'required|string',
- ]);
-
- \\Illuminate\\Support\\Facades\\Log::info('Document creation request received', [
- 'name' => $validated['name'],
- 'uploaded_files' => $validated['uploadedFiles'],
- ]);
-
- return back()->with('success', 'Files uploaded successfully');
-})->name('upload.store');`}
+{`Route::middleware(['auth'])->group(function () {
+ Route::get('/upload', function () {
+ return Inertia::render('inertia-upload-example');
+ })->name('upload.index');
+
+ Route::post('/upload', function (\\Illuminate\\Http\\Request $request) {
+ // Validate the incoming request
+ $validated = $request->validate([
+ 'name' => 'required|string|max:255',
+ 'uploadedFiles' => 'required|array|min:1',
+ 'uploadedFiles.*.id' => 'required|string',
+ 'uploadedFiles.*.name' => 'required|string',
+ 'uploadedFiles.*.sha256' => 'required|string',
+ 'uploadedFiles.*.size' => 'required|integer|min:0',
+ 'uploadedFiles.*.type' => 'required|string',
+ ]);
+
+ \\Illuminate\\Support\\Facades\\Log::info('Document creation request received', [
+ 'name' => $validated['name'],
+ 'uploaded_files' => $validated['uploadedFiles'],
+ ]);
+
+ return back()->with('success', 'Files uploaded successfully');
+ })->name('upload.store');
+});`}
## Security Notes
-This module is designed to ensure secure file uploads to your S3 bucket. Here’s an overview of the process:
+This module is designed to ensure secure file uploads to your S3 bucket. Here's an overview of the process:
1. **Private bucket configuration:**
Your S3 bucket should be configured as **private**. This prevents users from uploading or accessing files directly and ensures all access goes through temporary signed URLs issued by your Laravel application.
@@ -284,4 +287,14 @@ This module is designed to ensure secure file uploads to your S3 bucket. Here’
6. **Tamper protection:**
If the client modifies any claims in the signed URL, the signature becomes invalid and the S3 storage will reject the upload.
-> **Next Steps:** Try implementing the upload component in your application and customize it to match your specific requirements.
+
+
+ Secure Context Required
+
+ This module uses the Web Crypto API for SHA256 hashing, which requires a **secure context**. The upload module will work on:
+ - ✅ `https://` (production with HTTPS)
+ - ✅ `http://localhost` or `http://127.0.0.1` (local development)
+ - ❌ `http://192.168.x.x` (local network over HTTP)
+ - ❌ Any non-HTTPS remote access
+
+
diff --git a/resources/js/layouts/docs-layout.tsx b/resources/js/layouts/docs-layout.tsx
index 08f0838..598494b 100644
--- a/resources/js/layouts/docs-layout.tsx
+++ b/resources/js/layouts/docs-layout.tsx
@@ -32,7 +32,7 @@ export default function DocsLayout({ slug, meta = {}, toc, manifest, children }:
-
+
diff --git a/resources/js/pages/astrify-examples/inertia-table-example.tsx b/resources/js/pages/astrify-examples/inertia-table-example.tsx
index 37055ad..88e8e47 100644
--- a/resources/js/pages/astrify-examples/inertia-table-example.tsx
+++ b/resources/js/pages/astrify-examples/inertia-table-example.tsx
@@ -44,7 +44,7 @@ export default function InertiaTableExample({ users }: Props) {
Inertia Table
- This table loads it's data via Inertia requests. As you paginate this table the page number is reflected in the address bar.
+ This table loads its data via Inertia requests. As you paginate this table the page number is reflected in the address bar.
JSON Table Example
- This table uses JSON requests for it's data instead of Inertia requests. Useful when you need multiple tables on a single page
+ This table uses JSON requests for its data instead of Inertia requests. Useful when you need multiple tables on a single page
or don't want to tie the pagination to the rest of the page.