How graziabaiamonte/inertia-blog works
1. Overall shape
- This is a Laravel application with an Inertia.js + React + TypeScript frontend.
- The backend owns routing, auth, persistence, authorization, and server-side page composition.
- The frontend is a SPA-like UI rendered through Inertia pages, not a separate API-only client.
2. Core request flow
- HTTP requests enter Laravel through public/index.php, then route definitions in routes/web.php and routes/auth.php.
- Controllers in app/Http/Controllers handle domain actions and return Inertia responses or redirects.
- app/Http/Middleware/HandleInertiaRequests.php and SetLocale.php are key cross-cutting layers that shape every request.
3. Primary domain model
- The main business entities are Post, Category, Tag, Comment, and User.
- Database migrations show a blog/content model with many-to-many post-tag relations and comment storage.
- app/Enums/PostStatus.php indicates posts have a status lifecycle rather than being simple draft/published records.
4. Content and publishing subsystem
- BlogController serves the public blog listing and post detail pages.
- Admin-side PostController, CategoryController, and TagController manage content creation and taxonomy maintenance.
- CommentController exists both for public comment submission and admin moderation, so comments are a first-class content stream.
5. Administration boundary
- Admin controllers live under app/Http/Controllers/Admin, separating back-office workflows from public browsing.
- Frontend admin pages are grouped under resources/js/Pages/Admin/*.
- This boundary is reinforced by role/permission infrastructure and dedicated tests for authorization and admin login.
6. Authentication and account management
- Standard Laravel auth controllers handle registration, login, password reset, password confirmation, and email verification.
- ProfileController plus resources/js/Pages/Profile/* support user self-service profile and password updates.
- EmailVerification tests and controllers show that verified-email gating is part of the access model.
7. Authorization model
- Authorization is not just route-level auth; it is role/permission-based.
- config/permission.php, database/migrations/*permission_tables.php, and enums like RoleName / PermissionName indicate a structured RBAC layer.
- Seeders (RolePermissionSeeder) establish the default access model, likely including admin/editor-style distinctions.
8. Frontend architecture
- The frontend is organized around Inertia pages in resources/js/Pages, shared layouts in resources/js/Layouts, and reusable UI controls in resources/js/Components.
- resources/js/app.tsx and resources/js/bootstrap.ts bootstrap the client-side runtime.
- The UI stack includes React, TypeScript, Vite, Tailwind CSS, and likely axios for client requests.
9. Key reusable UI and interaction widgets
- Notable shared components include markdown editing, image upload, comment form/list, locale switching, pagination, and taxonomy selectors.
- These components reflect the app’s main interaction patterns: content editing, media handling, multilingual UI, and comment-driven engagement.
- resources/views/app.blade.php is the Inertia entry shell that mounts the React app.
10. Localization
- The application is bilingual, with English and Italian translation files in lang/en* and lang/it*.
- SetLocale middleware and LocaleController manage user-facing language selection.
- The presence of translation-sync tooling and locale-switch tests suggests translation consistency is part of the app’s architecture, not an afterthought.
11. Media and content formatting
- MediaController, StoreMediaRequest, MediaCollection enum, and config/filesystems.php show a dedicated media upload subsystem.
- app/Support/Markdown.php plus a Markdown editor component indicate post/comment content uses markdown rendering or preprocessing.
- Storage is split across Laravel’s filesystem abstractions, with public and private storage areas present in storage/app.
12. Persistence and runtime infrastructure
- Data lives in a relational database via Eloquent models and migrations; factories and seeders support test and bootstrap data.
- Standard Laravel infrastructure is present for cache, queues, sessions, logging, and mail, even if not all are central to the current feature set.
- compose.yaml suggests containerized local development, likely including the app plus database and related services.
13. Test architecture
- The tests are organized by “phase,” which maps to system capability areas: auth, model relationships, authorization, blog pages, comments, media, locale, and Inertia page rendering.
- This structure suggests the repo’s architecture has been validated incrementally by subsystem, not only by unit tests.
- The tests are a good guide to the boundaries between public blog, admin operations, localization, and access control.
14. Important diagram boundaries
- A useful architecture diagram should separate: public blog, authenticated user/account flows, admin content management, and shared platform services.
- Cross-cutting layers to show explicitly are locale handling, Inertia page assembly, RBAC, markdown/media support, and database-backed persistence.
Main entry points: web.php Routes · Admin Content admin · tests Tests · Controllers Auth & account
Components 19
Laravel backend
HTTP entry, controllers, middleware, auth, and domain logic.
- HTTP entry · Public web entry that boots the Laravel application.
public/index.php - Routes · Main web and auth route definitions that dispatch requests into controllers.
routes/web.php - Auth routes · Authentication and verification route definitions.
routes/auth.php - Middleware · Request shaping layers for Inertia responses and locale selection.
app/Http/Middleware - Blog · Public listing and post detail pages for the blog.
app/Http/Controllers/BlogController.php - Content admin · Back-office controllers for posts, categories, tags, comments, and media.
app/Http/Controllers/Admin - Auth & account · Registration, login, reset, verification, dashboard, profile, and locale actions.
app/Http/Controllers - Markdown · Shared markdown parsing/rendering support used by posts and comments.
app/Support/Markdown.php
Inertia frontend
React/TypeScript pages, layouts, and shared UI used by the app shell.
- App shell · Client bootstrap and the Blade mount point for the Inertia application.
resources/js/app.tsx - Layouts · Shared authenticated, guest, and public page shells.
resources/js/Layouts - Pages · Public, auth, profile, dashboard, and admin screens rendered by Inertia.
resources/js/Pages - UI components · Reusable controls for comments, markdown, media upload, pagination, locale switching, and navigation.
resources/js/Components
Data & storage
Persistent models, migrations, seeders, filesystem, and translations.
- RBAC · Role and permission enums, config, migrations, and seeders that define access control.
config/permission.php - Domain models · Core content and account entities: posts, categories, tags, comments, and users.
app/Models - Schema · Database schema for users, RBAC tables, media, taxonomy, posts, and comments.
database/migrations - Seed data · Bootstrap data for roles, permissions, and initial database state.
database/seeders - Filesystems · Public/private storage and media persistence through Laravel filesystem abstractions.
config/filesystems.php - Locale files · English and Italian translation catalogs plus locale-aware strings.
lang
Tests
Feature and unit coverage organized by subsystem.
- Tests · Subsystem-oriented feature and unit tests that validate auth, blog, admin, locale, media, and RBAC flows.
tests
Connections 25
- HTTP entry → Routes: boots web · Incoming HTTP requests are routed through the Laravel web routes.
- HTTP entry → Auth routes: boots auth · Authentication and verification routes are registered during app startup.
- Routes → Middleware: passes through · Web requests are shaped by request middleware before reaching controllers.
- Auth routes → Auth & account: dispatches to · Auth-related routes invoke account and verification controllers.
- Routes → Blog: serves blog · Public content routes resolve to the blog controller.
- Routes → Content admin: serves admin · Content management routes resolve to admin controllers.
- Routes → Auth & account: serves account · Profile, dashboard, locale, and other user flows resolve here.
- Content admin → Domain models: mutates · Admin workflows create, update, and moderate content entities.
- Blog → Domain models: reads · Public blog pages query posts, tags, categories, and comments.
- Auth & account → Domain models: uses · Authentication, profile, and locale flows depend on the user model.
- Content admin → Markdown: formats content · Editor and content workflows use markdown handling for rich text.
- Content admin → Filesystems: uploads media · Admin media actions persist files through the filesystem layer.
- Auth & account → RBAC: checks access · Role and permission rules gate authenticated and administrative actions.
- RBAC → Seed data: bootstraps · Seeders establish the default role/permission model.
- Domain models → Schema: persisted by · Models are backed by relational schema definitions.
- Seed data → Schema: fills schema · Seed data assumes the RBAC and content tables created by migrations.
- Middleware → Locale files: sets locale · Locale middleware and language selection rely on translation resources.
- App shell → Pages: mounts · The Inertia shell loads page components into the browser runtime.
- App shell → Layouts: wraps · Layouts provide the shared page chrome for Inertia screens.
- Pages → UI components: composes · Pages reuse shared UI controls for forms, lists, uploads, and navigation.
- Routes → App shell: returns inertia · Controllers and routes render React pages through the Inertia entry shell.
- Tests → Routes: verifies · Feature tests cover route behavior and request flow.
- Tests → Content admin: verifies · Tests exercise admin content management and moderation boundaries.
- Tests → RBAC: verifies · Tests validate the role and permission model.
- Tests → App shell: verifies · Inertia page tests confirm client/server page composition.