A Frontend Template suitable for use with soroban contract init --frontend-template, powered by Astro.
cp .env.example .envnpm installnpm run dev
If you look in package.json, you'll see that the start & dev scripts first run the initialize.js script. This script loops over all contracts in contracts/* and, for each:
- Deploys to a local network (needs to be running with
docker runorsoroban network start) - Saves contract IDs to
.soroban/contract-ids - Generates TS bindings for each into the
packagesfolder, which is set up as an npm workspace - Create a file in
src/contractsthat imports the contract client and initializes it for thestandalonenetwork.
You're now ready to import these initialized contract clients in your Astro templates or React, Svelte, Vue, Alpine, Lit, and whatever else JS files. You can see an example of this in index.astro.