Skip to content

48Web/trello-clone

Repository files navigation

Trello Clone - Symfony 8

A fully functional Trello clone built with Symfony 8, featuring MySQL, Redis, and Cloudflare R2 integration for Laravel Cloud deployment testing.

🚀 Features

  • Boards: Create and manage work boards with automatic default lists
  • Lists: Organize cards into columns/lists with drag & drop reordering
  • Cards: Add tasks with titles, descriptions, and image attachments
  • Attachments: Upload images to cards (Cloudflare R2 storage)
  • Drag & Drop: Full kanban functionality with SortableJS
  • Real-time Updates: Polling-based updates every 10 seconds
  • REST API: Complete JSON API with comprehensive logging
  • Background Jobs: Automated maintenance with Symfony Scheduler
  • System Monitoring: Health checks and performance tracking
  • Laravel Cloud Logging: JSON-formatted logs for cloud aggregation
  • Default Lists: New boards automatically get "My First List"

🛠️ Tech Stack

  • Framework: Symfony 8.0 (MicroKernel)
  • Database: SQLite (dev) / MySQL 8.0 (production) with Doctrine ORM
  • Cache/Storage: Redis (phpredis) + Cloudflare R2
  • Frontend: Twig templates + Bootstrap + Vanilla JavaScript
  • Background Jobs: Symfony Scheduler for automated tasks
  • Logging: Monolog with Laravel Cloud JSON formatting
  • File Storage: AWS S3-compatible (Cloudflare R2)
  • Development: Symfony CLI, Composer, Doctrine Migrations

🚀 Quick Start

Prerequisites

  • PHP 8.4+
  • Composer
  • Symfony CLI (optional)

1. Install Dependencies

composer install

2. Environment Setup

⚠️ IMPORTANT: Never commit .env files with real secrets!

Copy the example environment files and configure your secrets:

# Copy example files (these are safe to commit)
cp .env.example .env
cp .env.dev.example .env.dev

# Edit with your actual values (never commit these!)
nano .env
nano .env.dev

Required Environment Variables:

# Application
APP_ENV=dev
APP_SECRET=your-unique-secret-here

# Database (SQLite for dev, MySQL for production)
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"

# Redis (for caching and sessions)
REDIS_URL="redis://127.0.0.1:6379"

# Cloudflare R2 (for file storage - required for uploads)
CLOUDFLARE_R2_ENDPOINT="https://your-account-id.r2.cloudflarestorage.com"
CLOUDFLARE_R2_ACCESS_KEY="your-r2-access-key"
CLOUDFLARE_R2_SECRET_KEY="your-r2-secret-key"
CLOUDFLARE_R2_BUCKET="trello-attachments"

3. Database Setup

# Run existing migrations
php bin/console doctrine:migrations:migrate --no-interaction

# Load sample data
php bin/console doctrine:fixtures:load --no-interaction

4. Start Development Server

# Clear cache
php bin/console cache:clear

# Start server
symfony serve
# or
php bin/console cache:clear && symfony serve --daemon

Visit https://symfonytest.test to access the application! 🎉

🔒 Security Notes

  • .env files contain sensitive information and are never committed to git
  • Use .env.example files to document required environment variables
  • Rotate secrets if they were ever accidentally committed
  • Laravel Cloud manages environment variables securely in production

🔐 Security Best Practices

Environment Variables

  • Use .env.example files for documentation
  • Never commit .env files with real values
  • 🔄 Rotate secrets if accidentally exposed
  • 🌐 Laravel Cloud handles secrets securely

Sensitive Data in This Repo

This repository contains only placeholder values. Real secrets are:

  • Managed by Laravel Cloud environment variables
  • Stored locally in untracked .env files
  • Never committed to version control

Checking for Exposed Secrets

# Check if secrets were ever committed (run this periodically)
git log --oneline -p | grep -E "(SECRET|KEY|PASSWORD|TOKEN)" | head -5

# Verify .env files are ignored
git status --ignored | grep "\.env"

🎮 Usage

Dashboard (/)

  • View all your boards
  • Create new boards (automatically get "My First List")
  • Click on any board to enter kanban view

Board View (/boards/{id})

  • Lists: Add new lists, drag to reorder
  • Cards: Create, edit, move between lists with drag & drop
  • Real-time: Updates every 10 seconds
  • Attachments: Upload images to cards (R2 ready)

Sample Data

The application includes sample data:

  • Welcome Board: Complete with To Do, In Progress, Done lists
  • Demo Cards: Sample tasks to demonstrate functionality
  • Default Lists: New boards automatically get "My First List"

⏰ Scheduled Jobs

The application includes automated background jobs for maintenance and Laravel Cloud testing:

Available Commands

# Health monitoring (checks database, Redis, R2, disk, memory)
php bin/console app:health:check

# Clean up orphaned attachments (removes unused files)
php bin/console app:cleanup:attachments --dry-run

# Update board statistics cache (metrics for performance)
php bin/console app:stats:cache

# Database maintenance (optimize tables, health checks)
php bin/console app:maintenance:database --optimize-tables

# Cache warmup (pre-load frequently accessed data)
php bin/console app:cache:warmup

Laravel Cloud Integration

For production deployment, add this cron job:

* * * * * /path/to/symfony console scheduler:run >> /dev/null 2>&1

All commands include proper error handling, logging, and progress reporting.

📊 Logging System

The application implements comprehensive logging for Laravel Cloud monitoring:

Log Files

  • var/log/app.log - General application logs
  • var/log/laravel-cloud.log - JSON formatted logs for Laravel Cloud
  • var/log/error.log - Error-only logs

Log Types

  • API Requests/Responses - All API calls with performance metrics
  • User Actions - Board creation, updates, deletions
  • Scheduled Jobs - Job execution, success/failure, duration
  • Health Checks - System component monitoring
  • Performance - Operation timing and bottlenecks
  • Security Events - Access patterns and anomalies

Laravel Cloud Compatible

JSON-formatted logs include:

{
  "message": "API Response: POST /api/boards - 201",
  "context": {
    "board_id": 6,
    "lists_count": 1,
    "api_method": "POST",
    "api_endpoint": "/api/boards",
    "status_code": 201,
    "timestamp": "2026-01-07T19:31:36+00:00",
    "request_id": "req_695eb498c74735.96906820",
    "user_agent": "curl/8.7.1",
    "url": "/api/boards",
    "method": "POST"
  },
  "level": 200,
  "level_name": "INFO",
  "channel": "app",
  "datetime": "2026-01-07T19:31:36.816246+00:00"
}

Log Analysis

Use these commands to analyze logs:

# View recent API requests
tail -f var/log/app.log | grep "API"

# Monitor health checks
tail -f var/log/app.log | grep "Health Check"

# Check performance bottlenecks
grep "Performance:" var/log/app.log | sort -k 10 -n

📡 API Endpoints

Boards

  • GET /api/boards - List all boards
  • POST /api/boards - Create board (includes automatic "My First List")
  • GET /api/boards/{id} - Get board details with lists and cards
  • PUT /api/boards/{id} - Update board
  • DELETE /api/boards/{id} - Delete board

Lists

  • POST /api/boards/{boardId}/lists - Create list in board
  • PUT /api/lists/{id} - Update list
  • PUT /api/lists/{id}/position - Reorder list (drag & drop)
  • DELETE /api/lists/{id} - Delete list

Cards

  • GET /api/lists/{listId}/cards - Get cards in list
  • POST /api/lists/{listId}/cards - Create card
  • PUT /api/cards/{id} - Update card (title/description)
  • PUT /api/cards/{id}/position - Move card between lists (drag & drop)
  • DELETE /api/cards/{id} - Delete card

Attachments

  • POST /api/cards/{cardId}/attachments - Upload image to card
  • GET /api/attachments/{id}/download - Download attachment
  • DELETE /api/attachments/{id} - Delete attachment

Example API Usage

# Create a new board (automatically gets "My First List")
curl -X POST -H "Content-Type: application/json" \
  -d '{"title":"My Project","description":"Project management board"}' \
  http://localhost:8000/api/boards

# Add a card to a list
curl -X POST -H "Content-Type: application/json" \
  -d '{"title":"Implement feature","description":"Add new functionality"}' \
  http://localhost:8000/api/lists/1/cards

☁️ Laravel Cloud Deployment

This application is production-ready and designed to thoroughly test Laravel Cloud deployments with all three services:

🗄️ Database Testing (MySQL)

  • ✅ Full CRUD operations across all entities
  • ✅ Complex relationships (Board → Lists → Cards → Attachments)
  • ✅ Doctrine migrations for schema management
  • ✅ Fixtures for sample data

⚡ Redis Testing (phpredis)

  • ✅ Cache configuration ready
  • ✅ Session storage configured
  • ✅ Doctrine result/query caching enabled
  • ✅ Rate limiting capability prepared

📁 File Storage Testing (Cloudflare R2)

  • ✅ AWS S3-compatible adapter configured
  • ✅ File upload infrastructure ready
  • ✅ Image attachment support
  • ✅ CDN-ready for global delivery

🚀 Deployment Checklist

  • Environment Variables: Configure DATABASE_URL, REDIS_URL, R2 credentials
  • Database: MySQL instance with migration support
  • Redis: Instance for caching and sessions
  • Cloudflare R2: Bucket and API credentials
  • Migrations: Run doctrine:migrations:migrate
  • Fixtures: Load sample data with doctrine:fixtures:load
  • API Testing: All endpoints functional
  • Frontend: Dashboard and kanban board working
  • File Uploads: Attachment system operational

📊 Current Status: READY FOR DEPLOYMENT

The application successfully tests the complete Laravel Cloud stack and is ready for production deployment!

Development

Code Quality

# PHPStan (install first)
composer require --dev phpstan/phpstan
php vendor/bin/phpstan analyse src/

# PHP CS Fixer (install first)
composer require --dev friendsofphp/php-cs-fixer
php vendor/bin/php-cs-fixer fix

Testing

# Install PHPUnit
composer require --dev phpunit/phpunit

# Run tests
php bin/phpunit

📁 Project Structure

├── .product/plans/          # Project planning and changelog
├── config/                  # Symfony configuration files
│   ├── packages/           # Bundle configurations
│   └── routes.yaml         # Route definitions
├── migrations/             # Doctrine database migrations
├── public/                 # Web assets and entry point
├── src/                    # Application source code
│   ├── Controller/         # API and frontend controllers
│   ├── DataFixtures/       # Sample data fixtures
│   ├── Entity/            # Doctrine entities (User, Board, List, Card, Attachment)
│   ├── Repository/        # Doctrine repositories with custom methods
│   └── Service/           # Business logic services (R2 client)
├── templates/             # Twig templates (dashboard, board view)
├── tests/                 # Test directory (ready for expansion)
├── var/                   # Cache, logs, database files
├── vendor/                # Composer dependencies
├── .env                   # Environment configuration
├── AGENTS.md             # AI coding agent guidelines
├── composer.json         # PHP dependencies
├── README.md             # This file
└── symfony.lock          # Symfony version lock

🔄 Development Roadmap

✅ Completed

  • Full Trello clone with boards, lists, cards
  • MySQL/SQLite database integration
  • Redis caching configuration
  • Cloudflare R2 file storage setup
  • Drag & drop kanban interface
  • REST API with JSON responses
  • Automatic default lists for new boards
  • Laravel Cloud deployment ready

🚀 Future Enhancements

  • User authentication and collaboration
  • WebSocket real-time updates (Laravel Reverb)
  • Advanced file management (thumbnails, multiple formats)
  • Team management and permissions
  • Advanced search and filtering
  • Mobile-responsive design improvements
  • Comprehensive test suite

🤝 Contributing

  1. Follow Symfony 8 coding standards
  2. Use PHP 8.4+ features and attributes
  3. Add comprehensive tests for new features
  4. Update documentation and changelog
  5. Ensure Laravel Cloud compatibility

📄 License

This project is for educational and Laravel Cloud deployment testing purposes.

🎯 Laravel Cloud Testing Capabilities

This Trello clone is specifically designed to thoroughly test Laravel Cloud's infrastructure:

Database Testing

  • ✅ Full CRUD operations with complex entity relationships
  • ✅ Doctrine migrations and schema management
  • ✅ Connection pooling and query optimization
  • ✅ Foreign key constraints and data integrity

Redis Testing

  • ✅ Session storage and management
  • ✅ Cache operations (get/set/delete)
  • ✅ Performance optimization through caching
  • ✅ Connection pooling and error handling

Cloudflare R2 Testing

  • ✅ File upload and download operations
  • ✅ CDN integration and global delivery
  • ✅ AWS S3-compatible API usage
  • ✅ Secure file storage and access control

Scheduled Jobs Testing

  • ✅ Cron job execution in cloud environment
  • ✅ Background task processing and monitoring
  • ✅ Error handling and retry logic
  • ✅ Job scheduling and queue management

Logging & Monitoring Testing

  • ✅ Structured JSON logging for aggregation
  • ✅ Performance metrics and request tracking
  • ✅ Error logging and alerting
  • ✅ Health check automation

Production Deployment Ready

  • ✅ Environment-based configuration
  • ✅ Proper error handling and recovery
  • ✅ Scalable architecture patterns
  • ✅ Security best practices

🎉 Complete Trello Clone - Production Ready for Laravel Cloud!

About

a trello clone built on symfony php

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published