This guide will walk you through setting up, building, and deploying the Liquity application locally.
Before you begin, ensure you have the following tools installed:
Clone the repository:
git clone [email protected]:liquity/bold.git
cd bold
Install the npm dependencies for all the packages in the repo:
pnpm install
If you are developing contracts, install the Foundry dependencies:
cd contracts
forge install
To build the app for production, start by copying the .env
file (provided as an example) to .env.local
:
cd frontend/app
cp .env .env.local
Edit the newly created .env.local
to set the app environment variables. The NEXT_PUBLIC_SUBGRAPH_URL
need to be set manually. You might want to create a GraphSeer account to get an API key.
Optional: you can generate a set of contract addresses for the .env.local
file by running the following command:
cd contracts
# Replace the address file with the one you want to use
pnpm tsx ./utils/deployment-manifest-to-app-env.ts ./addresses/11155111.json
This is useful if you want to use a different set of contracts than the ones provided in the default .env
file.
You can now build the app for production:
cd frontend/app
pnpm build-deps # only needed the first time
pnpm build
The app will be built in the out/
directory which can be deployed to any static hosting service.
Note: your server must be configured to serve .html files by default. If you are using Vercel, this is done automatically. If your server does not support this, you can build the app with a separate directory for each route:
NEXT_TRAILING_SLASH=1 pnpm build
Follow these steps to set up your local development environment:
# In a separate terminal window
anvil
cd contracts
./deploy local --open-demo-troves # Creates test troves for first 8 anvil accounts
pnpm tsx utils/deployment-manifest-to-app-env.ts deployment-manifest.json
Note: Save the output - you’ll need these addresses for the next step.
cd frontend/app
cp .env .env.local
Edit .env.local
:
- Uncomment the Hardhat / Anvil section
- Add the contract addresses from the previous step
pnpm dev
Your app should now be running at https://localhost:3000
For more detailed information about app development, refer to the app README.