A modern Laravel + Vue.js application for transforming JSON data into customizable CSV exports with advanced field mapping and data transformation capabilities.
- JSON File Upload: Drag & drop or browse to upload JSON files
- Advanced Field Mapping: Map JSON fields to CSV columns with dot notation support
- Data Transformation: Custom JavaScript callbacks for complex data processing
- Multiple Export Formats: Generate single CSV files or bulk ZIP archives
- Real-time Preview: Preview CSV output before export
- Configuration Management: Save and reuse CSV configurations
- User Authentication: Secure user accounts with Laravel Fortify
- Backend: Laravel 12 with PHP 8.4
- Frontend: Vue 3 with TypeScript
- UI Framework: Tailwind CSS v4 + reka-ui components
- Database: MySQL 8.0
- Authentication: Laravel Fortify
- Testing: Pest PHP
- Build Tools: Vite
- Containerization: Docker & Docker Compose
- Docker & Docker Compose
- Or alternatively: PHP 8.4+, Node.js 20+, MySQL 8.0+
-
Clone the repository
git clone <repository-url> cd json-to-csv
-
Start the application
docker-compose up -d
-
Access the application
- Application: http://localhost:8000
- Vite Dev Server: http://localhost:5173
The Docker setup includes:
- Laravel application with PHP 8.4-FPM
- MySQL 8.0 database
- Node.js for Vite development server
- Auto-installation of dependencies
-
Install PHP dependencies
composer install
-
Install Node.js dependencies
npm install
-
Environment setup
cp .env.example .env php artisan key:generate
-
Database setup
php artisan migrate php artisan db:seed
-
Start development servers
# Start all development services composer run dev # Or start individually php artisan serve npm run dev
- Navigate to the upload page
- Drag & drop or select a JSON file
- The system will parse and validate the structure
- Define field mappings using simple names or dot notation
- Example mappings:
{ "name": "name", "email": "email", "age": "profile.age", "city": "profile.city", "street": "profile.address.street" }
- Use JavaScript callbacks for complex data processing:
{ "formatted_date": (data) => new Date(data.created_at).toLocaleDateString(), "status": (data) => data.is_active ? 'Active' : 'Inactive', "full_address": (data) => `${data.profile.address.street}, ${data.profile.city}` }
- Preview the CSV output
- Download single CSV file
- Generate bulk ZIP archive for multiple configurations
βββ app/
β βββ Http/Controllers/
β β βββ JsonProcessorController.php # JSON upload & parsing
β β βββ CsvConfigController.php # CSV configuration
β β βββ CsvExportController.php # Export functionality
β βββ Models/
β βββ JsonData.php # JSON data storage
β βββ CsvConfiguration.php # CSV config persistence
βββ resources/js/
β βββ pages/
β β βββ Dashboard.vue # Main dashboard
β β βββ JsonUpload.vue # File upload
β β βββ CsvConfiguration.vue # CSV setup
β β βββ Export.vue # Export management
β βββ components/ # Reusable Vue components
βββ examples/
β βββ users.json # Sample data
βββ docker-compose.yaml # Docker configuration
POST /api/json
- Upload JSON fileGET /api/json
- List user's JSON filesGET /api/json/{id}
- Retrieve JSON dataDELETE /api/json/{id}
- Delete JSON file
GET /api/csv-config
- List configurationsPOST /api/csv-config
- Save CSV configurationGET /api/csv-config/{id}
- Load configurationPUT /api/csv-config/{id}
- Update configurationDELETE /api/csv-config/{id}
- Delete configuration
GET /api/export/single/{configId}
- Download single CSVPOST /api/export/multiple
- Generate bulk ZIPGET /download/{filename}
- Download export file
# Run all tests
composer run test
# Run specific test suite
php artisan test --filter=JsonProcessorTest
# Frontend linting
npm run lint
# Type checking
npm run format:check
# Start development environment
docker-compose up -d
# View logs
docker-compose logs -f app
# Execute commands in container
docker-compose exec app php artisan migrate
docker-compose exec app composer install
# Stop environment
docker-compose down
The examples/users.json
file contains sample data demonstrating:
- Nested objects (
profile.age
,profile.city
) - Deeply nested objects (
profile.address.street
) - Arrays (
tags
) - Various data types (strings, numbers, booleans, dates)
- File upload validation and sanitization
- JSON parsing limits and timeout protection
- User authentication for saved configurations
- Rate limiting on API endpoints
- Secure file storage with Laravel filesystem
- Chunked processing for large JSON files
- Database indexing for fast configuration lookup
- Frontend asset optimization with Vite
- Lazy loading of configuration options
- Efficient CSV generation with League CSV
league/csv
- CSV generation and manipulationlaravel/fortify
- Authentication scaffoldinginertiajs/inertia-laravel
- Frontend integration
@inertiajs/vue3
- Laravel-Vue integrationreka-ui
- UI component librarytailwindcss
- CSS frameworklucide-vue-next
- Icon library@vueuse/core
- Vue composition utilities
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run the test suite
- Submit a pull request
This project is open-sourced software licensed under the MIT license.
For issues and questions:
- Create an issue on GitHub
- Review the example data and configurations
Built with β€οΈ using Laravel and Vue.js