How hmhhbi/blogcms works
BlogCMS is a Laravel REST API paired with a Next.js interface. Visitors browse posts and categories; registered users can manage content and comment, while admins have dashboard and moderation features. Laravel routes requests to authentication, post, category, and comment controllers, which use Eloquent models and resources to operate on blog data. The README documents the API-driven frontend and Sanctum authentication; sampled source confirms route dispatch and several controller-to-model/resource calls. Some frontend-to-API links are documented at a high level rather than shown in sampled frontend source.
Main entry points: api.php API route dispatch · Post.php Post model · PostController.php Post operations · CommentController.php Comment moderation
Components 24
Next.js experience
- Public pages
frontend/src/app/(public) - Blog listing
frontend/src/app/(public)/blogs/page.js - Post cards
frontend/src/app/(public)/components/PostCard.js - Post detail
frontend/src/app/(public)/components/PostContent.js - Comment interface
frontend/src/app/(public)/components/CommentSection.js - Login and registration
frontend/src/app/(auth) - Admin dashboard
frontend/src/app/(admin) - Route guard
frontend/src/app/components/AuthGuard.js
Laravel API
- API route dispatch
backend/routes/api.php - Authentication
backend/app/Http/Controllers/Api/AuthController.php - Post operations
backend/app/Http/Controllers/Api/PostController.php - Category operations
backend/app/Http/Controllers/Api/CategoryController.php - Comment moderation
backend/app/Http/Controllers/Api/CommentController.php - Post responses
backend/app/Http/Resources/PostResource.php - Category responses
backend/app/Http/Resources/CategoryResource.php - Comment responses
backend/app/Http/Resources/CommentResource.php
Blog domain
- Post model
backend/app/Models/Post.php - Category model
backend/app/Models/Category.php - Comment model
backend/app/Models/Comment.php - User model
backend/app/Models/User.php
External services
- MySQL database
- Cloudinary media
Other components
- Visitor
- Signed-in member
Connections 34
- Visitor → Public pages: browses
README.md - Public pages → Blog listing: includes
frontend/src/app/(public)/blogs/page.js - Blog listing → Post cards: renders
frontend/src/app/(public)/blogs/page.js - Visitor → Login and registration: signs up
README.md - Signed-in member → Admin dashboard: manages content
README.md - Admin dashboard → Route guard: protects routes
frontend/src/app/(admin)/layout.js - Signed-in member → Post detail: reads posts
README.md - Post detail → Comment interface: renders
frontend/src/app/(public)/components/PostContent.js - Public pages → API route dispatch: requests API data
README.md - Login and registration → API route dispatch: authenticates via API
README.md - Admin dashboard → API route dispatch: manages via API
README.md - API route dispatch → Authentication: routes auth
backend/routes/api.php - API route dispatch → Post operations: routes posts
backend/routes/api.php - API route dispatch → Category operations: routes categories
backend/routes/api.php - API route dispatch → Comment moderation: routes comments
backend/routes/api.php - Authentication → User model: creates tokens
backend/app/Http/Controllers/Api/AuthController.php - Post operations → Post model: queries and saves
backend/app/Http/Controllers/Api/PostController.php - Post operations → Post responses: formats responses
backend/app/Http/Controllers/Api/PostController.php - Category operations → Category model: queries and saves
backend/app/Http/Controllers/Api/CategoryController.php - Category operations → Category responses: formats responses
backend/app/Http/Controllers/Api/CategoryController.php - Comment moderation → Comment model: queries and saves
backend/app/Http/Controllers/Api/CommentController.php - Comment moderation → Post model: attaches comments
backend/app/Http/Controllers/Api/CommentController.php - Comment moderation → Comment responses: formats responses
backend/app/Http/Controllers/Api/CommentController.php - Post responses → Category responses: embeds category
backend/app/Http/Resources/PostResource.php - Post responses → Comment responses: embeds comments
backend/app/Http/Resources/PostResource.php - Post operations → Cloudinary media: uploads and deletes
backend/app/Http/Controllers/Api/PostController.php - Post model → Category model: belongs to
backend/app/Models/Post.php - Post model → User model: has author
backend/app/Models/Post.php - Post model → Comment model: has comments
backend/app/Models/Post.php - Comment model → User model: belongs to
backend/app/Models/Comment.php - Post model → MySQL database: persists records
README.md - Category model → MySQL database: persists records
README.md - Comment model → MySQL database: persists records
README.md - User model → MySQL database: persists accounts
README.md