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
- Flutter: Version 3.22.2 or higher. Install Flutter
- Dart: Comes with Flutter, but ensure it’s up to date.
- GraphQL CLI: For managing GraphQL documents. Install GraphQL CLI
- Python 3: For updating the GraphQL schemas. Install Python 3
Installation
-
Clone the repository:
git clone https://github.com/Junqo-org/junqo-platform.git
-
Navigate to the project directory:
cd junqo-platform
-
Update the schemas:
python3 tools/update_schemas.py
-
Navigate to the frontend directory:
cd junqo_front
-
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
- Ensure you have an emulator or a physical device connected.
- 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.