This bash script automates the setup process for the FlexNet GX application, a modern, serverless application with a Yew-based web frontend (WebAssembly), a mobile app structure, AWS serverless backend, and blockchain-based key management, all implemented in Rust.
The script performs the following main tasks:
- Checks and installs necessary dependencies (Rust and wasm-pack)
- Creates the required directory structure
- Sets up the web frontend (Yew-based WebAssembly)
- Prepares the mobile app structure
- Configures the AWS Lambda backend
- Initializes the Solana-based blockchain component
- Bash shell (Linux or macOS)
- Internet connection (for downloading dependencies)
- Sufficient permissions to create directories and install software
- Save the script to a file, e.g.,
setup_flexnet_gx.sh - Make the script executable:
chmod +x setup_flexnet_gx.sh - Run the script:
./setup_flexnet_gx.sh
command_exists: Checks if a command is available in the system.check_rust: Ensures Rust is installed and up-to-date.check_wasm_pack: Verifies wasm-pack is installed.check_and_create_dir: Creates directories if they don't exist.setup_flexnet_gx: The main function that orchestrates the entire setup process.
- Dependency Check: Verifies and installs Rust and wasm-pack.
- Main Directory Creation: Creates the
FlexNetGXdirectory and adds a README.md file. - Web Frontend Setup:
- Creates the
flexnet-gx-webdirectory - Initializes a Rust library project
- Configures Cargo.toml with necessary dependencies
- Creates source files (lib.rs) and HTML template
- Adds a build script
- Creates the
- Mobile App Setup:
- Creates the
flexnet-gx-mobiledirectory - Initializes a Rust binary project
- Configures Cargo.toml for mobile development
- Creates the main application file
- Adds build scripts for Android and iOS
- Creates the
- AWS Lambda Setup:
- Creates the
flexnet-gx-lambdadirectory - Initializes a Rust binary project
- Configures Cargo.toml for AWS Lambda
- Creates the Lambda function source file
- Adds a build script for the Lambda function
- Creates the
- Blockchain Setup:
- Creates the
flexnet-gx-blockchaindirectory - Initializes a Rust library project
- Configures Cargo.toml for Solana development
- Creates the initial Solana program file
- Creates the
The script includes error checking and will exit immediately if any command fails (set -e). It also provides informative messages throughout the setup process.
After running the script, you'll have a directory structure ready for FlexNet GX development:
FlexNetGX/
├── README.md
├── flexnet-gx-web/
│ ├── Cargo.toml
│ ├── src/
│ │ └── lib.rs
│ ├── index.html
│ └── build.sh
├── flexnet-gx-mobile/
│ ├── Cargo.toml
│ ├── src/
│ │ └── main.rs
│ ├── build-android.sh
│ └── build-ios.sh
├── flexnet-gx-lambda/
│ ├── Cargo.toml
│ ├── src/
│ │ └── main.rs
│ └── build-lambda.sh
└── flexnet-gx-blockchain/
├── Cargo.toml
└── src/
└── lib.rs
After running the setup script:
- Navigate into each directory to start developing the respective components.
- Use the provided build scripts to compile and package each component.
- Refer to the individual README files in each directory for more specific instructions on developing and deploying each component.
If you encounter any issues during the setup:
- Ensure you have a stable internet connection.
- Check that you have the necessary permissions to create directories and install software.
- If a specific step fails, try running that part of the script manually to see more detailed error messages.
- For dependency-related issues, try installing Rust and wasm-pack manually following their official documentation.
Feel free to fork this script and submit pull requests for any improvements or bug fixes. Ensure you test any changes thoroughly before submitting.
This script is provided as-is under the MIT License. See the LICENSE file for more details.