Project structure
A “Vertex project” is any directory that contains an
sfdx-project.json file. Vertex reuses the standard Salesforce project
layout so the output of vertex build can be deployed with the sf
CLI without extra config.
The minimum
Section titled “The minimum”my-project/├── sfdx-project.json└── src/ └── hello.vtxsfdx-project.json is the project marker. src/ (the default) holds
your Vertex source. You can choose a different source directory with
--src.
sfdx-project.json:
{ "packageDirectories": [ { "path": "force-app", "default": true } ], "sourceApiVersion": "66.0"}After vertex build
Section titled “After vertex build”my-project/├── sfdx-project.json├── src/│ └── hello.vtx└── force-app/ └── main/ └── default/ └── classes/ ├── Hello.cls └── Hello.cls-meta.xmlEach .vtx file produces one Apex class. The class name is the file
name capitalized (hello.vtx becomes Hello.cls).
Modules and imports
Section titled “Modules and imports”Each .vtx file is a module. The module name is the file path
relative to src/, without the extension, using / as the separator.
src/billing/invoice.vtx # module: billing/invoicesrc/shared/utils.vtx # module: shared/utilsImport another module by its module path:
import billing.invoiceimport shared.utils
let i = invoice.total(...)See Modules & Imports for the full rules (public/private visibility, cyclic-import detection, re-export rules).
Test files
Section titled “Test files”Files ending in _test.vtx are test modules. They may import
non-test modules, but non-test modules may not import them.
src/├── invoice.vtx└── invoice_test.vtx # @Test functions live hereRun them with vertex test (see The vertex CLI).
Anon scripts directory (convention)
Section titled “Anon scripts directory (convention)”For real-project style examples, a common convention is to keep an
anon-scripts/ folder with one .apex file per public entry point:
my-project/├── src/│ └── hello.vtx # pub fn run()└── anon-scripts/ └── hello.apex # Hello.vtx_run();Then:
$ sf apex run --target-org <alias> --file anon-scripts/hello.apexThis is not enforced; it is just a tidy way to invoke your entry points against the org.
Where generated classes go
Section titled “Where generated classes go”vertex build writes to force-app/main/default/classes/. This is
the directory sf project deploy start picks up by default.
If your sfdx-project.json specifies a different default package
directory, the output still lands inside it under main/default/classes/.