# 📁 GIT REPOSITORY STRUCTURE

## 🎯 Unified Git Repository

Project ini menggunakan **single git repository** untuk hybrid project (backend PHP + frontend Vue.js) sesuai dengan best practices modern development.

## 📂 Project Structure

```
api.samatortrack.id/                 # Root git repository
├── .git/                           # Git repository
├── .gitignore                      # Unified gitignore for hybrid project
├── .env.example                    # Environment template
├── README.md                       # Main documentation
├── 
├── app/                            # Backend PHP API
│   ├── api/                        # API endpoints
│   ├── auth/                       # Authentication
│   ├── crud/                       # CRUD operations
│   ├── helpers/                    # Helper classes
│   └── models/                     # Database models
├── 
├── config/                         # Backend configuration
├── public/                         # Web server entry point
│   ├── .htaccess                   # Apache configuration
│   └── index.php                   # Main router + SPA fallback
├── 
├── frontend/                       # Frontend Vue.js/Quasar
│   ├── src/                        # Vue.js source code
│   ├── dist/                       # Production build (ignored)
│   ├── node_modules/               # Dependencies (ignored)
│   ├── package.json                # Frontend dependencies
│   └── quasar.config.js            # Build configuration
├── 
└── vendor/                         # PHP dependencies (ignored)
```

## 🚫 .gitignore Strategy

### Backend (PHP) Files Ignored:
- `.env` - Environment variables
- `vendor/` - Composer dependencies
- `*.log` - Log files
- `*.cache` - Cache files

### Frontend (Vue.js) Files Ignored:
- `node_modules/` - NPM dependencies
- `frontend/dist/` - Build output
- `*.local` - Local development files
- NPM logs and cache files

### Development Files Ignored:
- Editor configurations (except essential VSCode settings)
- OS generated files (Thumbs.db, .DS_Store)
- Temporary and cache files
- Test data and database dumps

## 🔄 Git Workflow

### Development Workflow:
```bash
# Clone repository
git clone <repository-url>
cd api.samatortrack.id

# Install backend dependencies
composer install

# Install frontend dependencies
cd frontend
npm install

# Start development servers
npm run dev                    # Frontend: http://localhost:5173
cd ..
php -S localhost:8000 -t public  # Backend: http://localhost:8000
```

### Production Deployment:
```bash
# Build frontend for production
cd frontend
npm run build

# Deploy to server
# Files in frontend/dist/ will be served by public/index.php
```

## 📋 Git Best Practices Applied

### ✅ Single Repository Benefits:
- **Unified versioning** - Frontend dan backend selalu sync
- **Atomic commits** - Perubahan frontend+backend dalam satu commit
- **Simplified CI/CD** - Satu pipeline untuk keseluruhan project
- **Easier collaboration** - Developer tidak perlu clone multiple repos
- **Consistent branching** - Feature branches untuk keseluruhan fitur

### ✅ Proper .gitignore:
- **Environment separation** - .env files tidak ter-commit
- **Dependency management** - node_modules dan vendor di-ignore
- **Build artifacts** - dist/ dan cache files di-ignore
- **Development files** - Editor configs dan OS files di-ignore

### ✅ Commit Structure:
```
feat: Add new vehicle tracking feature
fix: Resolve login authentication issue
docs: Update API documentation
refactor: Optimize database queries
test: Add integration tests for fuel API
```

## 🔧 Migration Completed

### What Was Done:
1. ✅ **Merged .gitignore files** - Frontend .gitignore merged to root
2. ✅ **Removed duplicate .gitignore** - Deleted frontend/.gitignore
3. ✅ **Updated git tracking** - All files properly tracked/ignored
4. ✅ **Committed changes** - Clean commit with migration details

### Verification:
```bash
# Check ignored files
git check-ignore frontend/node_modules frontend/dist .env vendor
# Output: All files properly ignored ✅

# Check repository status
git status
# Output: working tree clean ✅
```

## 🎯 Next Steps

1. **Continue development** with unified repository
2. **Setup CI/CD pipeline** for hybrid project
3. **Configure deployment** scripts
4. **Setup branch protection** rules
5. **Add pre-commit hooks** for code quality

---

**AUTHOR**: Rodhi  
**DATE**: 2026-01-19  
**STATUS**: ✅ Git Migration Complete

🎉 **UNIFIED GIT REPOSITORY READY!**