This is the bridge web application for Adventure Layer, built with Create Eth App. The application enables users to transfer assets between different chains, currently supporting:
- Sepolia Layer 1
- Adventure Layer L2
- Adventure Shard 1
The project uses Yarn Workspaces to manage multiple packages:
adventure-layer-bridge-web/
├── README.md
├── package.json
├── node_modules/
└── packages/
├── contracts/ # Contract ABIs and address configurations
│ ├── src/
│ │ ├── abis/ # Contract ABI files
│ │ ├── addresses.js # Contract address configurations
│ │ └── index.js
│ └── package.json
├── react-app/ # React frontend application
│ ├── public/ # Static assets
│ ├── src/
│ │ ├── pages/ # Page components
│ │ ├── img/ # Image assets
│ │ └── config.js # Configuration file
│ └── package.json
└── subgraph/ # Graph Protocol indexing configuration
├── src/
├── schema.graphql
└── package.json
- Node.js >= 14
- Yarn >= 1.22
- MetaMask wallet
yarn installCreate a .env file in the packages/react-app directory:
REACT_APP_RPC_URL=<your RPC URL>
REACT_APP_CHAIN_ID=<chain ID>
# Start development server
yarn react-app:start
# Run tests
yarn react-app:test
# Build production version
yarn react-app:build- Build the project:
yarn react-app:build- The build artifacts will be in
packages/react-app/builddirectory.
There are two ways to deploy the application to production:
We provide a deployment script that automates the entire process. To use it:
-
Set up SSH access to your production server
- Ensure you have SSH access to your production server
- Make sure your SSH key is properly configured
-
Configure deployment variables Create a
.env.productionfile in the root directory with the following variables:DEPLOY_USER=ubuntu # Your server's SSH user DEPLOY_HOST=example.com # Your production server hostname DEPLOY_PATH=/var/www/bridge # Deployment path on the server SSH_KEY=~/.ssh/id_rsa # Path to your SSH key -
Make the deployment script executable
chmod +x scripts/deploy-pro.sh
-
Run the deployment script
./scripts/deploy-pro.sh
The script will:
- Build the application
- Create necessary directories on the server
- Deploy the files
- Set proper permissions
- Restart Nginx
If you prefer to deploy manually, follow these steps:
-
** Edit the config file **
- edit config.js in
packages/react-app/src/config.jsto change the RPC URL to the production RPC URL
- edit config.js in
-
Build the application locally:
yarn react-app:build-
Set up Nginx on your server:
- Install Nginx if not already installed:
sudo apt update sudo apt install nginx
-
Create Nginx configuration:
- Create a new configuration file:
sudo nano /etc/nginx/conf.d/adventure-layer-bridge.conf
- Add the following configuration (adjust as needed):
server { listen 80; server_name your-domain.com; # Replace with your actual domain location / { root /path/to/webroot; index index.html index.htm; try_files $uri /index.html; } location = /index.html { add_header Cache-Control no-store,no-cache; root /path/to/webroot; } }
-
Enable the site:
sudo nginx -t # Test configuration sudo systemctl restart nginx -
Create directory structure on server:
sudo chown -R $USER:$USER /path/to/webroot
-
Deploy files to server:
Using script:
./scripts/deploy.sh
Or manually using scp:
scp -r -i "/path/to/your/key.pem" packages/react-app/build/* user@your-server-ip:/path/to/webroot/
-
Verify deployment:
- Visit your domain or server IP at port 80 to ensure the application is running correctly
-
Other Notes
- Add ssl certificate to nginx config
- Edit the nginx config to change the port to 443
- Edit the redirect rule in nginx config to redirect http to https
- If you encounter 404 errors, check the Nginx error logs:
sudo tail -f /var/log/nginx/error.log - For permission issues: ensure proper ownership with
sudo chown -R www-data:www-data /path/to/webroot - For connectivity issues: verify firewall settings allow port 80 with
sudo ufw statusand adjust if needed
Runs the React app in development mode. Open http://localhost:3000 to view it in the browser.
The page will automatically reload if you make changes to the code. You will see build errors and lint warnings in the console.
Runs the test watcher in an interactive mode. By default, runs tests related to files changed since the last commit.
Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The Graph is a tool for indexing events emitted on the Ethereum blockchain. It provides you with an easy-to-use GraphQL API.
Generates AssemblyScript types for smart contract ABIs and the subgraph schema.
Compiles the subgraph to WebAssembly.
Before deploying your subgraph, you need to register on Graph Explorer. You will receive an access token there. Use it in the following command:
GRAPH_ACCESS_TOKEN=your-access-token-here yarn subgraph:authDeploys the subgraph to the official Graph Node.
- Deployment key files should be kept secure and not committed to the repository
.envand.env.productionfiles contain sensitive configurations and are excluded in.gitignore- Always use SSH keys for deployment instead of passwords
- Ensure proper file permissions on the production server
- Regularly update dependencies and check for security vulnerabilities
- Latest versions of Chrome/Firefox/Safari
- MetaMask plugin required
- Fork the project
- Create your feature branch
- Commit your changes
- Submit a pull request