Getting Started as a developer

1. Overview with Documentation/repository

Begin by reading the project documentation to get a high-level understanding:

2. Understand the Architecture

GrowERP consists of:

  • Frontend: Flutter-based applications (admin, hotel, freelance, support)
  • Backend: Moqui framework with custom components
  • Deployment: Docker containers orchestrated with docker-compose

3. Explore the Backend (Moqui)

  1. Examine Service Definitions:

    • Look at moqui/runtime/component/growerp/service/growerp/100/*.xml files
    • These XML files define the backend services that the frontend calls
  2. Understand the REST API:

    • The REST interface is documented at https://backend.growerp.com/toolstatic/lib/swagger-ui/index.html?url=https://backend.growerp.com/rest/service.swagger/growerp#/100
    • This API provides the communication layer between frontend and backend
  3. Explore Data Model:

    • The data model is in the mantle-udm component
    • It's based on the "Data Model Resource Book" and provides a flexible business model
  4. Service-Oriented Architecture:

    • All functions are implemented as services
    • Services are stored in components in the runtime/component directory

4. Explore the Frontend (Flutter)

  1. Understand Package Structure:

    • The Flutter code is organized into packages in flutter/packages/
    • Core packages like growerp_core, growerp_models provide the foundation
    • Application packages like admin, hotel, freelance build on these
  2. Examine Main Entry Points:

    • Look at main.dart in each application package
    • These files initialize the app and set up the BLoC providers
  3. Understand Menu Structure:

    • menu_options.dart defines the application's menu structure
    • This shows the main screens and functionality available
  4. REST Client:

  5. Configuration:

5. Run the System Locally

  1. Backend Setup:

    cd moqui
    ./gradlew build
    java -jar moqui.war load types=seed,seed-initial,install no-run-es
    java -jar moqui.war no-run-es
    
  2. Frontend Setup:

    cd flutter
    dart pub global activate melos 3.4.0
    export PATH="$PATH":"$HOME/.pub-cache/bin"
    melos bootstrap
    melos l10n --no-select
    melos build --no-select
    cd packages/admin  # or hotel, freelance, etc.
    flutter run
    
  3. Docker Setup (Alternative):

    • Use docker-compose.yaml in the docker directory to run the complete system

6. Explore the Code Structure

  1. BLoC Pattern:

    • The frontend uses the BLoC pattern for state management
    • Look at the BLoC providers in each package
  2. Model Classes:

    • Examine the model classes in growerp_models to understand the data structures
  3. Screen Templates:

    • The UI follows a 3-layer approach as described in the documentation
    • Templates handle layout, navigation, and screen definitions

7. Test the System

  1. Login to Backend:

    • Access http://localhost:8080/vapps with user: SystemSupport, password: moqui
  2. Test Frontend Applications:

    • Run the admin, hotel, or other applications
    • Create a test company and explore the functionality

8. Daily Startup Routine

To efficiently get up to speed each time you start working on the project, establish this routine:

  1. Check System Status:

    # Check if backend is running
    curl http://localhost:8080/status
    
    # Check running Docker containers if using Docker
    docker ps
    
  2. Update Code:

    # Pull latest changes
    git pull
    
    # Update dependencies
    cd flutter
    melos bootstrap
    
  3. Review Recent Changes:

    # View recent commits
    git log --oneline -10
    
    # Check for changes in key files
    git diff HEAD~5 -- flutter/packages/growerp_models/lib/src/rest_client.dart
    git diff HEAD~5 -- moqui/runtime/component/growerp/service/
    
  4. Start Development Environment:

    • Start backend in one terminal:

      cd moqui
      java -jar moqui.war no-run-es
      
    • Start frontend in another terminal:

      cd flutter/packages/admin  # or other app
      flutter run
      
  5. Check API Documentation:

    • Review the REST API at http://localhost:8080/toolstatic/lib/swagger-ui/index.html?url=http://localhost:8080/rest/service.swagger/growerp#/100
    • This helps understand available endpoints for any new features
  6. Monitor Logs:

    • Keep an eye on backend logs for errors:

      tail -f moqui/runtime/log/moqui.log
      
    • Watch Flutter console output for frontend issues

  7. Test Key Functionality:

    • Log in to the application
    • Navigate through main menu items
    • Verify that data is loading correctly

This daily startup routine ensures you're always working with the latest code, aware of recent changes, and have a functioning development environment before diving into new tasks.

This approach provides a systematic way to understand both the frontend and backend components of the GrowERP project, their interactions, and how to run and test the system locally.