Skip to content

mathamel/laravel-test-sd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Product Feedback Tool β€” Laravel API + React SPA

A comprehensive product feedback management system built with Laravel 12 and React 18, featuring user authentication, feedback submission, comments with @mentions, file uploads, and database notifications.

πŸš€ Features

Backend (Laravel 12 + PHP 8.2 + MySQL 8)

  • User Authentication with Sanctum (session-based SPA auth)
  • Feedback Management with CRUD operations and file uploads
  • Category System with admin-manageable categories
  • Comment System with markdown support and file attachments
  • @Mention System with real-time user search and notifications
  • Database Notifications for mention alerts
  • File Upload Support (images, PDFs, documents)
  • Authorization Policies for user ownership
  • Comprehensive Validation with Form Requests

Frontend (React 18 + TypeScript + Vite)

  • Modern React Architecture with TypeScript
  • Zustand for auth state management
  • React Query for server state & caching
  • React Hook Form + Zod for forms & validation
  • Tailwind CSS for responsive design
  • Markdown Rendering with syntax highlighting
  • File Upload UI with progress indicators
  • @Mention Autocomplete with user search
  • Real-time Updates via React Query

πŸ“ Project Structure

β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ Http/Controllers/Api/
β”‚   β”‚   β”œβ”€β”€ AuthController.php
β”‚   β”‚   β”œβ”€β”€ FeedbackController.php
β”‚   β”‚   β”œβ”€β”€ CommentController.php
β”‚   β”‚   └── UserSearchController.php
β”‚   β”œβ”€β”€ Http/Requests/
β”‚   β”‚   β”œβ”€β”€ LoginRequest.php
β”‚   β”‚   β”œβ”€β”€ RegisterRequest.php
β”‚   β”‚   β”œβ”€β”€ StoreFeedbackRequest.php
β”‚   β”‚   └── StoreCommentRequest.php
β”‚   β”œβ”€β”€ Models/
β”‚   β”‚   β”œβ”€β”€ User.php (with username)
β”‚   β”‚   β”œβ”€β”€ Category.php
β”‚   β”‚   β”œβ”€β”€ Feedback.php
β”‚   β”‚   └── Comment.php
β”‚   β”œβ”€β”€ Notifications/
β”‚   β”‚   └── UserMentioned.php
β”‚   └── Policies/
β”‚       β”œβ”€β”€ FeedbackPolicy.php
β”‚       └── CommentPolicy.php
β”œβ”€β”€ database/
β”‚   β”œβ”€β”€ migrations/
β”‚   β”‚   β”œβ”€β”€ create_users_table.php (with username)
β”‚   β”‚   β”œβ”€β”€ create_categories_table.php
β”‚   β”‚   β”œβ”€β”€ create_feedback_table.php
β”‚   β”‚   β”œβ”€β”€ create_comments_table.php
β”‚   β”‚   β”œβ”€β”€ create_comment_user_mentions_table.php
β”‚   β”‚   └── create_notifications_table.php
β”‚   └── seeders/
β”‚       β”œβ”€β”€ CategorySeeder.php
β”‚       β”œβ”€β”€ UserSeeder.php
β”‚       └── FeedbackSeeder.php
β”œβ”€β”€ resources/js/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ Layout.tsx
β”‚   β”‚   β”œβ”€β”€ Markdown.tsx
β”‚   β”‚   β”œβ”€β”€ CommentForm.tsx
β”‚   β”‚   └── CommentList.tsx
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ Login.tsx
β”‚   β”‚   β”œβ”€β”€ Register.tsx
β”‚   β”‚   β”œβ”€β”€ FeedbackList.tsx
β”‚   β”‚   β”œβ”€β”€ FeedbackNew.tsx
β”‚   β”‚   └── FeedbackShow.tsx
β”‚   β”œβ”€β”€ stores/
β”‚   β”‚   └── authStore.ts
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   └── api.ts
β”‚   β”œβ”€β”€ App.tsx
β”‚   └── app.tsx
└── routes/
    β”œβ”€β”€ api.php
    └── web.php

πŸ›  Installation & Setup

Prerequisites

  • Docker & Docker Compose
  • Node.js 18+ and npm

1. Clone and Setup

git clone <repository-url>
cd splicedigital-laravel

2. Environment Configuration

# Copy environment file
cp .env.example .env

# Update .env with your settings:
# - Database credentials for MySQL
# - APP_URL=http://localhost
# - SESSION_DOMAIN=localhost
# - SANCTUM_STATEFUL_DOMAINS=localhost:5173

3. Start Services

# Start Docker containers
docker-compose up -d

# Install backend dependencies
docker-compose exec app composer install

# Generate application key
docker-compose exec app php artisan key:generate

# Run migrations and seed data
docker-compose exec app php artisan migrate --seed

# Create storage symlink
docker-compose exec app php artisan storage:link

4. Frontend Setup

# Install dependencies
npm install

# Start development server
npm run dev

🌐 API Endpoints

Authentication

  • POST /api/register - User registration
  • POST /api/login - User login
  • POST /api/logout - User logout
  • GET /api/user - Get current user

Public Routes

  • GET /api/categories - List all categories
  • GET /api/feedback - List feedback (with filters)
  • GET /api/feedback/{id} - Get feedback details
  • GET /api/feedback/{id}/comments - Get feedback comments

Protected Routes (Require Auth)

  • POST /api/feedback - Create feedback
  • PUT /api/feedback/{id} - Update feedback
  • DELETE /api/feedback/{id} - Delete feedback
  • POST /api/feedback/{id}/comments - Create comment
  • PUT /api/comments/{id} - Update comment
  • DELETE /api/comments/{id} - Delete comment
  • GET /api/users?search=term - Search users for mentions

🎯 Key Features in Detail

User Authentication

  • Session-based authentication with Sanctum
  • CSRF protection for SPA
  • User registration with username field
  • Secure logout with session invalidation

Feedback System

  • Create, read, update, delete feedback
  • File uploads (images, PDFs, documents)
  • Category filtering and search
  • Status tracking (open, in_progress, completed, closed)
  • Ownership-based authorization

Comment System

  • Markdown support with syntax highlighting
  • File attachments
  • Edit/delete own comments
  • Real-time @mention autocomplete
  • Database notifications for mentions

File Uploads

  • Multiple file support
  • Type validation (images, PDFs, docs)
  • Size limits (10MB per file)
  • Secure storage with public access links

@Mention System

  • Type @ + username for autocomplete
  • Real-time user search
  • Database notifications
  • Mention highlighting in comments

πŸ”§ Development

Backend Development

# Run artisan commands
docker-compose exec app php artisan <command>

# Access database
docker-compose exec mysql mysql -u root -p

# View logs
docker-compose logs -f app

Frontend Development

# Start dev server with hot reload
npm run dev

# Build for production
npm run build

# Type checking
npx tsc --noEmit

Testing

# Run PHP tests
docker-compose exec app php artisan test

# Run JavaScript tests
npm test

πŸ“Š Default Data

The application seeds with:

Users

Categories

  • Bug Report (red)
  • Feature Request (green)
  • Improvement (blue)
  • UX/UI (purple)
  • Other (gray)

Sample Feedback

  • Various feedback items with comments
  • Demonstrates markdown formatting
  • Shows @mention functionality
  • Includes different status types

πŸ” Security Features

  • CSRF Protection via Sanctum
  • Input Validation on all forms
  • File Upload Security with type/size restrictions
  • Authorization Policies for resource access
  • Output Escaping for XSS prevention
  • CORS Configuration for SPA security

🎨 UI/UX Features

  • Responsive Design for mobile/desktop
  • Dark Mode Ready (Tailwind configuration)
  • Loading States and error handling
  • File Upload Progress indicators
  • Markdown Preview in comment form
  • Auto-complete @Mentions with dropdown
  • Real-time Updates via React Query

πŸ“± Browser Support

  • Chrome 90+
  • Firefox 88+
  • Safari 14+
  • Edge 90+

πŸš€ Deployment

For production deployment:

  1. Environment: Set APP_ENV=production
  2. Database: Configure production MySQL
  3. Storage: Set up file storage (S3, etc.)
  4. CORS: Update allowed origins
  5. Build: Run npm run build
  6. Queue: Configure queue workers for notifications
  7. Cache: Set up Redis for caching

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make changes with tests
  4. Submit a pull request

πŸ“ License

This project is open-sourced under the MIT license.

About

Minimal Product Feedback App in Laravel / React

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published