███████╗██╗ ███████╗██╗ ██╗███╗ ██╗███████╗████████╗ ███████╗████████╗ █████╗ ██████╗██╗ ██╗
██╔════╝██║ ██╔════╝╚██╗██╔╝████╗ ██║██╔════╝╚══██╔══╝ ██╔════╝╚══██╔══╝██╔══██╗██╔════╝██║ ██╔╝
█████╗ ██║ █████╗ ╚███╔╝ ██╔██╗ ██║█████╗ ██║ ███████╗ ██║ ███████║██║ █████╔╝
██╔══╝ ██║ ██╔══╝ ██╔██╗ ██║╚██╗██║██╔══╝ ██║ ╚════██║ ██║ ██╔══██║██║ ██╔═██╗
██║ ███████╗███████╗██╔╝ ██╗██║ ╚████║███████╗ ██║ ███████║ ██║ ██║ ██║╚██████╗██║ ██╗
╚═╝ ╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝
README.md
git clone --recurse-submodules [email protected]:cryptoversus-io/Stack-Config.git
==========
Dapp Application is a robust web application leveraging Kotlin with Javalin for serving web content and handling backend logic, integrated with Rust for data processing and shell scripts for automation. The project's core lies in its ability to efficiently process data while offering a user-friendly interface.
- This Dapp Application is a simple Kotlin-based web project using Javalin to serve a web page and handle backend logic.
- The project includes a
Dapp.kt
Kotlin file as the main class and ahome.html
file for the frontend.
- JDK (Java Development Kit) 1.8 or higher https://hg.openjdk.java.net/ 'sudo apt install openjdk-17-jdk'
- Kotlin 1.7.10 or higher https://kotlinlang.org/download/ (1.9.21)
- Gradle Build Tool (preferably the latest version) https://javalin.io/tutorials/gradle-setup
- An IDE that supports Kotlin https://github.com/VSCodium/vscodium/releases (1.82.2)
- Maven https://javalin.io/tutorials/maven-setup (3.6.3)
- Javalin https://github.com/javalin/javalin (5.6.3)
- Rust 1.77.0 or higher
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Cargo (Rust's build tool & package manager)
- if you don't have permissions for cargo bin
chmod +x $HOME/.cargo/bin/cargo
- if you don't have permissions for cargo bin
- ToolChain Manager Stable
rustup install stable
rustup default stable
- Cargo (Rust's build tool & package manager)
Development/src/main/kotlin/com/base/
: Contains Kotlin source files.Development/src/main/resources/static
: Houses static resources like HTML files for the frontend.Development/src/main/rust/
: Contains Rust source files for file processing tasks.Development/scripts/indexing.sh
: Bash script to automate file processing and deduplication tasks.target/
: Rust build artifacts are placed here by Cargo.Cargo.toml
: Configuration file for Rust project management.
=============
cosmverseflex.git
|
├── Development (cosmverse.git)
│ |
| src/
│ ├── main/
│ │ ├── kotlin/
│ │ │ └── com/
│ │ │ └── base/
│ │ │ └── DappKt.kt # Main Kotlin server file
│ │ │
│ │ ├── resources/
│ │ │ └── static/
│ │ │ └── home.html # Main entry point for the frontend
│ │ │
│ │ └── rust/
│ │ ├── preprocess_file.rs # Rust script for preprocessing data
│ │ └── deduplicate_file.rs # Rust script for deduplicating data
│ │
│ └── scripts/
│ | └── indexing.sh # Shell script for managing tasks
│ │
│ │
│ └──
│
├── build.gradle.kts # Gradle build configuration file
├── settings.gradle.kts # Gradle settings file
└── gradlew # Gradle wrapper executable
-
File Preprocessing:
- Rust code in
preprocess_file.rs
cleans files inSOURCE_DIR
. Processed files are stored inPROCESSED_DIR
.
- Rust code in
-
File Deduplication:
- Rust code in deduplicate.rs removes duplicates from files in
PROCESSED_DIR
. - Deduplicated files are stored in
DEDUP_DIR
.
- Rust code in deduplicate.rs removes duplicates from files in
-
Script Automation:
indexing.sh
shell script automates preprocessing and deduplication, triggerable manually or via cron job. Database Indexing (if applicable):
-
Include logic in Rust code or additional scripts to update databases using data from
DEDUP_DIR
.
- FORK then Clone your own forked repo.
- Open the project in your IDE aka VSCodium
- Ensure that the JDK is properly set up in your IDE.
- Go to Dapp directory in terminal
# If you Don't have Docker
mkdir -p ~/.docker/cli-plugins/
curl -L "https://github.com/docker/buildx/releases/download/v0.13.1/buildx-v0.13.1.linux-amd64" -o ~/.docker/cli-plugins/docker-buildx
chmod a+x ~/.docker/cli-plugins/docker-buildx
export DOCKER_CLI_PLUGIN_DIR=~/.docker/cli-plugins
export DOCKER_BUILDKIT=1
# Build the Docker image
DOCKER_BUILDKIT=1 docker build -t dapp-application .
# Run the Docker container
docker run -p 8080:8080 dapp-application
-
For Kotlin components:
- Build:
./gradlew build
- Run:
./gradlew run
- Build:
-
For Rust components:
- Build:
cargo build
- Run:
cargo run --bin my_binary
- Build:
- Navigate to the root directory of the project via the terminal or command prompt.
- Run the following command to build the project: 'gradle clean build'
- To use the Gradle Wrapper use
./gradlew clean build
- If ./gradlew permission is denied run
chmod +x gradlew
- If the build is successful, you should see a BUILD SUCCESSFUL message in the terminal.
_
)|( +++ ((_ \|/
(o o) (o o) (o o) (o o)
ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
./gradlew cleanRust
./gradlew buildRust
./gradlew copyRustBinaries
./gradlew build
-
To run the application, execute:
gradle run
- or
./gradlew run
- or
-
Once the application starts, it will be accessible at
http://localhost:8080
. -
Open a web browser and navigate to
http://localhost:8080
to view thehome.html
page.
Execute the indexing.sh
script to start the file processing and deduplication. This script will look for files in the specified source directory and perform operations.
- Edit your directories you wish to use
./scripts/indexing.sh [source_directory] [processed_directory] [dedup_directory]
This is the core of your server application. It initializes a Javalin server which listens on port 8080.
The server configures static file handling to serve home.html directly from the /static directory. This setup ensures that users can access the web interface by navigating to http://localhost:8080/home.html
in their browser.
The server also defines endpoints for API operations which might interact with the Rust scripts or handle other backend logic.
HTML Frontend (home.html):
- Located in the
/static
directory, this file acts as the main interface for user interaction. It includes forms and scripts to communicate with the backend via AJAX requests, handling tasks such as user verification or data processing. This file uses JavaScript to make asynchronous requests to the server endpoints defined in the Kotlin application, facilitating dynamic content updates without page reloads.
preprocess_file.rs
anddeduplicate_file.rs
located in the/rust
directory are designed to perform data processing tasks. These scripts can be invoked from the Kotlin server using ProcessBuilder or through the shell script for batch processing.
- This script in the
/scripts
directory helps in managing routine tasks like starting the server or processing files through Rust binaries. It can be manually executed or scheduled via cron jobs to automate batch processing tasks.
- These files configure how the project is built and run. They ensure that all dependencies are properly managed and compile the Kotlin application correctly.
- Users access the Dapp application by visiting
http://localhost:8080/home.html
after the server has been started using the Gradle wrapper command./gradlew run
. The home.html page serves as the user interface, allowing them to interact with the application through forms and buttons that trigger AJAX calls.
- When a user submits data via the frontend (for instance, uploading a file for processing), the AJAX calls hit the endpoints defined in the Kotlin application. Depending on the functionality, these endpoints might process data immediately using Rust scripts or queue tasks for later processing.
HTML
,CSS
,JavaScript
, and images are served statically from the/static directory
, ensuring quick loading and separation of static content from server logic. Changes or Confirmations Needed
- Test all endpoints to confirm that they correctly handle requests and interact with the Rust scripts as intended.
Review static file paths in both the server setup and
HTML
references to ensure they align and are accessible via the web browser. Ensure error handling is robust in both frontend and backend to gracefully manage any issues during operation. By following these guidelines and setups, your Dapp application should provide a seamless and efficient user experience, leveraging the strengths of Kotlin, Rust, and shell scripting within a well-organized project structure.
***************************************************
* ____ ___ ___ ____ _ _ _ ____ _ __*
* / ___|/ _ \ / _ \| _ \ | | | | | |/ ___| |/ /*
*| | _| | | | | | | | | | | | | | | | | | ' / *
*| |_| | |_| | |_| | |_| | | |__| |_| | |___| . \ *
* \____|\___/ \___/|____/ |_____\___/ \____|_|\_\*
***************************************************
- For contributions, please open a pull request or an issue.
- For questions or support, contact @NinjaAssPirate | @KitBaroness