Skip to main content

Project Structure

Panduan lengkap struktur folder dan file untuk memahami organisasi codebase.

📁 Root Structure


🔧 Backend Structure (Go)

Backend File Examples


🧩 7-Domain Route Architecture

MStore Backend menggunakan 7-Domain Driven Architecture untuk route organization:

Domain Hierarchy

V1 Routes (Backward Compatible)

V2 Routes (Enhanced)

Total: 82 endpoints

Adding New Routes

  1. Create domain folder: internal/route/v1/your-domain/
  2. Create route file: your_domain_route.go
  3. Update route_registry.go with import and call
  4. Build and test
See: 7-Domain Route Architecture

📱 Frontend Structure (Flutter)

Flutter File Examples


🐳 Docker & DevOps


📚 Documentation


🔑 Key Files

Environment Files


📊 Naming Conventions

Backend (Go)

  • Packages: lowercase, single word (handler, service, repository)
  • Files: snake_case (user_handler.go, auth_service.go)
  • Types: PascalCase (UserHandler, AuthService)
  • Functions: camelCase (exported: NewUserHandler, private: validateInput)
  • Constants: UPPER_SNAKE_CASE atau PascalCase
  • Interfaces: PascalCase dengan suffix (e.g., UserRepository, AuthService)

Frontend (Flutter)

  • Files: snake_case (login_page.dart, user_model.dart)
  • Classes: PascalCase (LoginPage, UserModel)
  • Variables: camelCase (userName, isLoading)
  • Constants: lowerCamelCase atau UPPER_SNAKE_CASE
  • Private: prefix underscore (_privateMethod, _PrivateClass)

🎯 Best Practices

  • Gunakan Clean Architecture (handler → service → repository)
  • Pisahkan domain logic dari infrastructure
  • Setiap service punya folder sendiri di internal/
  • Shared code di internal/shared/ atau pkg/
  • Test files sejajar dengan source files (*_test.go)
  • Gunakan Feature-First structure
  • Setiap feature punya layer: data, domain, presentation
  • Shared widgets di shared/widgets/
  • State management dengan Riverpod
  • Dependency injection di core/di/
  • Naming: {version}_{description}.{up|down}.sql
  • Selalu buat up & down migration
  • Test migration sebelum commit
  • Jangan edit migration yang sudah di-deploy
  • Environment variables untuk secrets
  • YAML files untuk app config
  • Jangan commit .env file
  • Provide .env.example sebagai template

📚 Next Steps

Architecture Overview

Pahami arsitektur sistem secara keseluruhan

Backend Development

Mulai develop backend service

Frontend Development

Mulai develop Flutter app

DevOps Workflow

Setup development workflow

Pro Tip: Gunakan VS Code workspace atau GoLand multi-project untuk membuka backend dan frontend secara bersamaan!