Frontend

Table of contents

Getting started

The frontend of the Junqo-platform is a Flutter application.
Its main goal is to provide a user interface to interact with the backend.

Prerequisites

Installation

  1. Clone the repository:

     git clone https://github.com/Junqo-org/junqo-platform.git
    
  2. Navigate to the project directory:

     cd junqo-platform
    
  3. Update the schemas:

     python3 tools/update_schemas.py
    
  4. Navigate to the frontend directory:

     cd junqo_front
    
  5. Get the Flutter dependencies:

     flutter pub get
    

Configuration

To configure the frontend, you can use flutter build environment variables when building the app or .env files in the junqo_front/config/ directory. If an environment variable is not found, the default value will be used.

Here is the list of environment variables used by the frontend:

  • API_URL: The URL of the backend API. Default: http://localhost:4200/graphql

Create a .env file in the junqo_front/config/ directory and add the following environment variables:

# Url of the junqo-platform backend
API_URL=http://localhost:4200/graphql

If you want to use the flutter build environment variables, you can use the following command:

flutter run --dart-define=API_URL=http://localhost:4200/graphql

Local Development Setup

  1. Ensure you have an emulator or a physical device connected.
  2. Run the application:
  flutter run

Running the Application

  • To run the application in debug mode:

    flutter run
    
  • To build the application for release:

    flutter build apk
    

Development Environment Configuration

  • VS Code: Install the Flutter and Dart extensions.
  • Android Studio: Install the Flutter and Dart plugins.

Hot Reload/Restart

  • Hot Reload: Press r in the terminal or use the hot reload button in your IDE.
  • Hot Restart: Press R in the terminal or use the hot restart button in your IDE.

Common Development Commands

  • Clean the project:

    flutter clean
    
  • Upgrade dependencies:

    flutter pub upgrade
    
  • Upgrade dependencies versions:

    flutter pub outdated
    flutter pub upgrade --major-versions
    
  • Run tests:

    flutter test
    
  • Run lint checks:

    flutter analyze
    
  • Generate GraphQL code:

    flutter pub run build_runner build
    

Platform-Specific Build Instructions

  • iOS: Ensure you have Xcode installed. Run:

    flutter build ios
    
  • Web: Ensure you have Chrome installed. Run:

    flutter build web
    
  • Desktop: Ensure you have the necessary dependencies installed. Run:

    flutter build windows
    flutter build macos
    flutter build linux
    

Technologies

  • Flutter
    • It is an open source framework for building beautiful, natively compiled, multi-platform applications from a single codebase.
  • Ferry Graphql
    • It is a simple, powerful GraphQL Client for Flutter and Dart.