|
| 1 | +# SurfManager v2.0 - Go + Wails Migration |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Migrasi SurfManager dari Python/PyQt6 ke Go + Wails untuk performa lebih baik, single binary, dan UI modern. |
| 6 | + |
| 7 | +### Why Migrate? |
| 8 | + |
| 9 | +| Python (Old) | Go + Wails (New) | |
| 10 | +|--------------|------------------| |
| 11 | +| ~40MB binary + Python runtime | ~15-20MB single binary | |
| 12 | +| Startup ~1-2s | Startup <500ms | |
| 13 | +| PyQt6 dependency hell | Zero dependencies | |
| 14 | +| Complex build process | Simple `wails build` | |
| 15 | +| Limited UI customization | Full web UI (HTML/CSS/JS) | |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## Tech Stack |
| 20 | + |
| 21 | +``` |
| 22 | +Backend: Go 1.21+ |
| 23 | +Frontend: Svelte + TailwindCSS (lightweight & fast) |
| 24 | +Build: Wails v2 |
| 25 | +Icons: Lucide Icons (modern, lightweight) |
| 26 | +``` |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## Project Structure (Minimal & Powerful) |
| 31 | + |
| 32 | +``` |
| 33 | +SurfManager/ |
| 34 | +├── main.go # Entry point |
| 35 | +├── app.go # Wails app struct & methods |
| 36 | +├── wails.json # Wails config |
| 37 | +├── go.mod |
| 38 | +│ |
| 39 | +├── internal/ |
| 40 | +│ ├── config/ |
| 41 | +│ │ └── config.go # Config manager + platform paths |
| 42 | +│ ├── process/ |
| 43 | +│ │ └── killer.go # Process management |
| 44 | +│ ├── backup/ |
| 45 | +│ │ └── backup.go # Backup/restore logic |
| 46 | +│ └── apps/ |
| 47 | +│ └── loader.go # App config loader (JSON) |
| 48 | +│ |
| 49 | +├── frontend/ |
| 50 | +│ ├── src/ |
| 51 | +│ │ ├── App.svelte # Main app |
| 52 | +│ │ ├── main.js |
| 53 | +│ │ ├── app.css # TailwindCSS |
| 54 | +│ │ └── lib/ |
| 55 | +│ │ ├── Sidebar.svelte |
| 56 | +│ │ ├── ResetTab.svelte |
| 57 | +│ │ ├── SessionsTab.svelte |
| 58 | +│ │ ├── ConfigTab.svelte |
| 59 | +│ │ └── NotesTab.svelte |
| 60 | +│ ├── index.html |
| 61 | +│ ├── package.json |
| 62 | +│ └── tailwind.config.js |
| 63 | +│ |
| 64 | +└── .old_python/ # Reference (keep for now) |
| 65 | +``` |
| 66 | + |
| 67 | +**Total: ~15 files** (vs Python's 20+ files) |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +## Feature Mapping |
| 72 | + |
| 73 | +### Core Features (Must Have) |
| 74 | + |
| 75 | +| Feature | Python | Go Implementation | |
| 76 | +|---------|--------|-------------------| |
| 77 | +| Reset Data | ✅ | `internal/backup/reset.go` | |
| 78 | +| Session Backup | ✅ | `internal/backup/backup.go` | |
| 79 | +| Session Restore | ✅ | `internal/backup/restore.go` | |
| 80 | +| Auto-Backup | ✅ | Built into reset flow | |
| 81 | +| Process Kill | ✅ | `internal/process/killer.go` | |
| 82 | +| App Config | ✅ | `internal/apps/loader.go` | |
| 83 | +| Platform Paths | ✅ | `internal/config/paths.go` | |
| 84 | +| Notepad | ✅ | Simple JSON storage | |
| 85 | + |
| 86 | +### UI Features |
| 87 | + |
| 88 | +| Feature | Python | Wails Implementation | |
| 89 | +|---------|--------|----------------------| |
| 90 | +| Dark Theme | PyQt6 CSS | TailwindCSS dark mode | |
| 91 | +| Tab Navigation | QTabWidget | Svelte components | |
| 92 | +| Progress Bar | QProgressBar | HTML progress + events | |
| 93 | +| Context Menu | QMenu | Custom dropdown | |
| 94 | +| Search/Filter | QLineEdit | Svelte reactive | |
| 95 | +| Multi-select | QTableWidget | Checkbox list | |
| 96 | + |
| 97 | +--- |
| 98 | + |
| 99 | +## Migration Phases |
| 100 | + |
| 101 | +### Phase 1: Foundation (Week 1) |
| 102 | +- [x] Setup Git repo |
| 103 | +- [ ] Initialize Wails project |
| 104 | +- [ ] Create Go backend structure |
| 105 | +- [ ] Implement platform paths |
| 106 | +- [ ] Basic frontend shell |
| 107 | + |
| 108 | +### Phase 2: Core Features (Week 2) |
| 109 | +- [ ] Process killer |
| 110 | +- [ ] App config loader |
| 111 | +- [ ] Backup/restore logic |
| 112 | +- [ ] Reset functionality |
| 113 | + |
| 114 | +### Phase 3: UI (Week 3) |
| 115 | +- [ ] Reset Data tab |
| 116 | +- [ ] Sessions tab |
| 117 | +- [ ] App Config tab |
| 118 | +- [ ] Notes tab |
| 119 | + |
| 120 | +### Phase 4: Polish (Week 4) |
| 121 | +- [ ] Progress events |
| 122 | +- [ ] Error handling |
| 123 | +- [ ] Testing |
| 124 | +- [ ] Build & release |
| 125 | + |
| 126 | +--- |
| 127 | + |
| 128 | +## Go Backend API |
| 129 | + |
| 130 | +```go |
| 131 | +// app.go - Wails bindings |
| 132 | + |
| 133 | +type App struct { |
| 134 | + ctx context.Context |
| 135 | + config *config.Manager |
| 136 | + process *process.Killer |
| 137 | + backup *backup.Manager |
| 138 | + apps *apps.Loader |
| 139 | +} |
| 140 | + |
| 141 | +// Reset Data |
| 142 | +func (a *App) ResetApp(appKey string) error |
| 143 | +func (a *App) GenerateNewID(appKey string) (int, error) |
| 144 | +func (a *App) LaunchApp(appKey string) error |
| 145 | +func (a *App) OpenFolder(appKey string) error |
| 146 | + |
| 147 | +// Sessions |
| 148 | +func (a *App) GetSessions(appKey string) ([]Session, error) |
| 149 | +func (a *App) CreateBackup(appKey, name string) error |
| 150 | +func (a *App) RestoreBackup(appKey, name string) error |
| 151 | +func (a *App) DeleteSession(appKey, name string) error |
| 152 | +func (a *App) SetActiveSession(appKey, name string) error |
| 153 | + |
| 154 | +// App Config |
| 155 | +func (a *App) GetApps() ([]AppConfig, error) |
| 156 | +func (a *App) AddApp(config AppConfig) error |
| 157 | +func (a *App) RemoveApp(appKey string) error |
| 158 | +func (a *App) ToggleApp(appKey string) error |
| 159 | + |
| 160 | +// Notes |
| 161 | +func (a *App) GetNotes() ([]Note, error) |
| 162 | +func (a *App) SaveNote(note Note) error |
| 163 | +func (a *App) DeleteNote(id string) error |
| 164 | + |
| 165 | +// Utils |
| 166 | +func (a *App) GetPlatformInfo() PlatformInfo |
| 167 | +func (a *App) KillProcess(names []string) error |
| 168 | +``` |
| 169 | + |
| 170 | +--- |
| 171 | + |
| 172 | +## Data Compatibility |
| 173 | + |
| 174 | +**100% compatible** dengan data Python version: |
| 175 | +- Same folder structure: `Documents/SurfManager/` |
| 176 | +- Same JSON format untuk app configs |
| 177 | +- Same session storage format |
| 178 | +- Same notes format |
| 179 | + |
| 180 | +User bisa langsung upgrade tanpa kehilangan data! |
| 181 | + |
| 182 | +--- |
| 183 | + |
| 184 | +## Performance Targets |
| 185 | + |
| 186 | +| Metric | Python | Go Target | |
| 187 | +|--------|--------|-----------| |
| 188 | +| Startup | ~1.5s | <500ms | |
| 189 | +| Memory | ~80MB | <30MB | |
| 190 | +| Binary | ~40MB | <20MB | |
| 191 | +| Backup 100MB | ~5s | <2s | |
| 192 | + |
| 193 | +--- |
| 194 | + |
| 195 | +## Next Steps |
| 196 | + |
| 197 | +1. **Run**: `wails init -n SurfManager -t svelte` |
| 198 | +2. **Setup**: TailwindCSS + Lucide icons |
| 199 | +3. **Implement**: Backend Go modules |
| 200 | +4. **Build**: Frontend components |
| 201 | +5. **Test**: Cross-platform |
| 202 | +6. **Release**: Single binary |
| 203 | + |
| 204 | +--- |
| 205 | + |
| 206 | +*Light as fuck, powerful as hell* 🚀 |
0 commit comments