For larger programs, the pattern I prefer and have seen some otherBigger projects typically use is to splitthe multiple files template added in Anchor 0.29. You can do this for new projects with:
anchor init counter --template=multiple
This splits up state/
and instructions/
. Under these folders, you can create files for each account type and instruction respectivelyhandler.
For example, a simple counter program might look like:
src/
instructions/
decrement.rs
increment.rs
initialize.rs
mod.rs
state/
counter.rs
mod.rs
lib.rs
errors.rs
Cargo.toml
README.md
You can do this for new projects with:
anchor init counter --template=multiple