Development Server

Development Server

Run a local development server with aer server to use your org’s Lightning pages, Visualforce pages, Aura and Lightning Web Components, and screen flows in a browser, run and debug Apex from Setup pages, test API integrations, deploy metadata, and inspect platform events, all without an org.

Start the server

aer server force-app/main/default

The command loads the Apex, metadata, and components from the specified paths. Add more paths as arguments or with --path, which can also be set in an .aerrc file. By default the server listens on http://127.0.0.1:8080.

Add --watch to apply changes while the server runs:

aer server force-app/main/default --watch

With --watch, a changed Apex class, trigger, or LWC file is reloaded, and a changed metadata file is deployed through the same pipeline as a Metadata API deploy. A deleted file is skipped, since a deploy does not delete metadata. A rebuilt .pkg file is applied as a package upgrade: its schema is merged, its Apex and components replace the old ones, and the stored records are kept. While a change is being applied, the page header shows an indicator, and a page rendered before the change completed shows a prompt to reload.

A restart over unchanged sources, metadata, packages, and options restores the type-checked program from aer’s cache instead of parsing the source again.

Press Ctrl+C to stop the server.

Landing page

Open http://127.0.0.1:8080/ and log in to reach the endpoint browser. It lists every development tool and API endpoint the server exposes, grouped by category. Type / to focus the search box and filter endpoints by path or description, press Escape to clear it, and use the copy button next to a path to put it on the clipboard. The list is built from the live routes, so Apex REST classes loaded from your source appear alongside the built-in endpoints. A status indicator in the header shows whether the server is still responding.

The development tool pages are:

PathPurpose
/lightningThe org as a Lightning app
/dev/lwcLightning Web Component preview
/dev/uibundleUI Bundle preview
/dev/visualforceVisualforce pages, each linking to its /apex/<PageName> page
/dev/flowsScreen flow runner
/dev/workitemsOrchestration work items assigned to you
/dev/eventsPlatform event viewer
/dev/jobsAsync job monitor
/dev/querySOQL query runner
/dev/dataObjects holding records, with record counts
/dev/explorerCode and metadata explorer
/dev/deduceaer deduce program runner
/dev/mocksHTTP callout mocks

The Lightning, Visualforce, flow, query, record count, and deduce pages require a session. A browser without one is sent through the OAuth authorize flow and returned to the page it asked for.

The pages share one design with a light and dark theme. The theme toggle in the header persists across reloads and follows you between pages.

Lightning frontend

/lightning renders the org from its own metadata at Lightning Experience URLs: the app launcher, each app’s tabs, list views, record pages, the home page, reports, and dashboards. Pages use the FlexiPages, page layouts, compact layouts, record types, and list views in your source, and record pages show each field’s API name beside its label.

  • Apps. The app launcher lists the org’s CustomApplications and tabs. An org that defines no applications gets the standard Sales, Service, Marketing CRM Classic, and Salesforce Chatter apps. A Console app renders workspace tabs and subtabs and docks its utility bar at the bottom of the page.
  • Record pages. A record page uses the Lightning record page assigned for the app, the running user’s profile, and the record type, then the page layout, then a generated two-column page. Detail sections, related lists, tabs, the highlights panel, the sales path, Chatter feeds and publisher, Today’s Tasks and Today’s Events, Potential Duplicates with its merge wizard, and component visibility rules render. A custom LWC, Aura component, or screen flow on the page runs, with a caption naming it. A component aer does not implement renders as a placeholder that names it and lists its properties.
  • Forms. New, edit, and clone forms follow the page’s Dynamic Forms field sections when it has them, and the page layout otherwise, with record type prompts, dependent picklists, State and Country picklists, polymorphic lookups, and + New <Object> in lookups. A save error appears under the field it names.
  • Actions. Edit, Delete, Clone, Change Owner, Change Record Type, Sharing Hierarchy, View Account Hierarchy, Send Email, Log a Call, lead Convert, Submit for Approval, custom buttons and links, global and object quick actions, flow, LWC, Visualforce, and Aura quick actions, and the Chatter Post, File, and Link actions run from the record page. Send Email sends the message as Messaging.sendEmail does, so it is delivered over SMTP only when the server was started with --allow-email.
  • Reports and dashboards. /lightning/o/Report/home browses report folders. A report renders as tabular, summary, matrix, or joined output with totals, editable filter values, and its chart. When Analytics.settings enables inline editing, detail rows can be edited in place, and the save runs triggers, validation rules, and flows. A dashboard runs each component’s report and renders bar, column, line, donut, and funnel charts, metric tiles, gauges, and tables. Every dashboard runs its reports as the user you are logged in as. With --use-dashboard-running-user, a SpecifiedUser dashboard’s reports run as the running user its metadata names, who must then exist in the server’s database.

Render reports

Record, home, tab, and dashboard pages, and the forms, end with a render report naming the page or layout that rendered, counting the components by outcome, and giving the render time. From it you can:

  • Open the page assignment screen (/lightning/r/<Object>/<Id>/pageassignment or /lightning/page/home/pageassignment), which lists every assignment that could name a page, in the order they are consulted, and says whether each was used, skipped and why, or never reached. It also names where the highlights panel’s key fields and the action buttons come from.
  • Check show to reveal the fields, components, and tabs that visibility rules hid, each labeled with the rule that hid it. The choice is remembered in the browser.
  • Choose another of the object’s Lightning record pages, labeled with the apps, profiles, record types, and form factors assigned to it, to view the record with that page.

Setup pages

/lightning/setup/SetupOneHome/home links to Setup pages that use Salesforce’s URL paths:

PagePurpose
Object ManagerObjects with their fields, record types, list views, validation rules, and triggers, each with a detail page
UsersThe org’s users
Apex ClassesEvery class with its source; run a test, debug a test, or execute a static method
Apex TriggersEvery trigger with its source
Anonymous ApexRun a block, with a debugger
Apex JobsAsync jobs with their status and errors; pause and resume the async worker, run a queued job, or debug it
Bulk Data Load JobsBulk API 1.0 and 2.0 jobs and their batches, with each batch’s request and response
Query EditorThe SOQL query runner, with an option to use the Tooling API
Record CountsObjects holding records, with their counts
Email TemplatesEvery email template with its bodies
Platform Events, Change Data Capture, Event ManagerThe org’s platform events and change events

Setup Home also lists the aer server options in effect, each with the flag that sets it. The password, session tokens, and certificate keys are never shown.

Visualforce

/apex/<PageName> renders a Visualforce page, running its controller and extensions, and /dev/visualforce lists the org’s pages. Forms submit and run the action their command button or apex:actionFunction names, the standard controller’s save, quicksave, cancel, edit, delete, and view actions run when the page’s controllers do not define them, and custom components render. Page blocks, input and output fields, links, images, panels, page messages, includes, and apex:slds render, and $Resource, $Label, URLFOR, and the branching functions are evaluated.

A page with renderAs="pdf", and PageReference.getContent() and getContentAsPDF(), produce a PDF through ufo, a separate program that implements the Flying Saucer renderer Salesforce uses. aer looks for it in AER_UFO_PATH, beside the aer executable, and on PATH.

Aura components

Aura components run in the browser wherever Salesforce shows one: on a FlexiPage, as a tab, in the utility bar, as a quick action or action override, at /lightning/cmp/c__<Name> for a component that implements lightning:isUrlAddressable, and at /c/<Name>.app for an application. The markup, controller, helper, and renderer run, with attribute binding, events, aura:method, $A.createComponent, and the lightning: and ui: base components. Packages carry their Aura bundles and Lightning web components, served under the package’s namespace.

Screen flows

/flow/<FlowApiName> runs a screen flow and /dev/flows lists the org’s flows. Screens render their inputs, choices, sections, display text, images, lookups, data tables, and the toggle, address, and message components, with visibility rules evaluated as you change values. An embedded LWC’s FlowAttributeChangeEvent values are stored in the flow’s variables. Each screen-to-screen segment runs as its own transaction, as in Salesforce.

Flow approval processes and orchestrations start when a record save meets their entry criteria. /dev/workitems lists the work items assigned to you: an interactive step’s work item runs the step’s screen flow, and an approval step offers Approve and Reject.

Persistent storage

By default the server keeps its data in an in-memory SQLite database that is discarded on exit. Pass --db to keep data between runs:

# SQLite file
aer server force-app/main/default --db aer.db

# PostgreSQL
aer server force-app/main/default --db postgres://aer:secret@localhost/aer

# Disposable PostgreSQL server started for this run
aer server force-app/main/default --db postgresqltest://

The postgres:// and postgresql:// forms connect to an existing PostgreSQL database. The schema is created with identity columns and PL/pgSQL triggers, and the formula and SOQL functions aer needs are installed as database functions when the database is first used. Each pooled VM opens its own connections and transaction, so concurrent requests run in parallel rather than serializing on one storage handle, and SELECT ... FOR UPDATE takes row locks in the database. A lock that cannot be acquired within the lock timeout raises a QueryException with UNABLE_TO_LOCK_ROW, the same error sfapex raises.

postgresqltest:// starts a private PostgreSQL server for the run and removes it on exit. A local PostgreSQL installation is required. The exec and test commands accept the same --db values.

A server started against an existing database does not repeat work it has already done. After a full startup aer records a fingerprint over the schema, loaded packages, and startup options. A later start with the same fingerprint attaches to the database without migrating tables or reseeding metadata. Any change to the source, packages, or flags produces a different fingerprint and runs the full startup. Upgrading aer does not require rebuilding the database.

Session tokens issued against a persistent database are stored in it, so a login survives a server restart.

Seeding a persistent database

--bootstrap-db copies tables from a SQLite file into the server’s database before startup. The copy merges rather than replaces: rows already present in the target are kept, a bootstrap row whose Id already exists is ignored, and re-running the copy is a no-op. See Bring In Setup Data for how to build a bootstrap file.

Local LWC preview

Open http://127.0.0.1:8080/dev/lwc in your browser to see a list of available Lightning Web Components. Click any component to render it in an isolated preview. The preview page injects mock @wire data and lets you interact with the component as if it were running in a Salesforce environment.

Combine --watch with LWC preview for a fast feedback loop:

  1. Start the server with --watch.
  2. Open a component preview in your browser.
  3. Edit the component’s HTML, JavaScript, or CSS.
  4. Save the file—the server reloads and the browser reflects changes.

LWC preview supports:

  • @api properties with editable inputs
  • @wire adapters backed by local Apex and schema
  • Component composition and slots
  • Lightning base components

UI Bundle preview

UI Bundles are listed at http://127.0.0.1:8080/dev/uibundle and served at their application URL, http://127.0.0.1:8080/app/c__<bundleName>, after you log in. The Data SDK shim resolves both @salesforce/platform-sdk and the older @salesforce/sdk-data import, and exposes the graphql.query and graphql.mutate API. Source-tree walkers skip node_modules and hidden directories.

The Explorer

Navigate to http://127.0.0.1:8080/dev/explorer to browse the application architecture exposed by your source paths and loaded packages. The Explorer displays:

  • Objects: Standard and custom objects with their fields, relationships, and picklist values
  • Apex Classes: Methods and signatures, call graphs showing which methods call which, interface implementations, and class inheritance hierarchies
  • Flows: Flow definitions with entry points and variables
  • Custom Metadata: Custom metadata type records
  • Reports: Reports, custom report types, and standard report types with their columns, filters, and joins, each report linked to the fields it reads

The call graph includes calls made from property accessors, field initializers, static and instance blocks, and triggers.

Explorer showing Apex class relationships, method calls, and interface implementations

Use the Explorer to verify that your local environment matches expectations before writing Apex tests or integration code.

The Explorer is for browsing these relationships interactively. To ask a question across the whole source tree, such as which methods nothing calls or which fields no report uses, write a program for aer deduce, which evaluates rules over the same kinds of relationships.

Query runner and deduce

/dev/query (also Setup → Query Editor) runs a SOQL query and shows the records in a grid whose columns follow the SELECT clause: a parent field as Owner.Name, a subquery as a nested grid, and an aggregate under its function text or alias. A large result shows its first 2,000 records with a Load more button. Check Use Tooling API to run the query through /tooling/query. The query is kept in the page address, so it can be bookmarked.

/dev/data lists every object that holds records, with its count, each linked to a query over its records.

/dev/deduce runs aer deduce Mangle (Datalog) programs against the server’s loaded code and metadata, including metadata deployed since the server started. The example programs from aer deduce --help-examples can be loaded and run from the page.

API endpoints

The server exposes Salesforce-compatible REST and SOAP API endpoints. Point external tools, scripts, or integration tests at the local server instead of a Salesforce org.

Authentication

Connect to the local server using the Salesforce CLI:

$ sf org login web -r http://127.0.0.1:8080 -a aer
Successfully authorized admin@aer.local with org ID 00D000000000000

The default credentials are:

  • Username: admin@aer.local (override with --username)
  • Password: password (override with --password)

REST writes require an authenticated session. Create, update, and delete requests run as the user the session token resolves to, and a request with no valid session is rejected with 401. A create that does not supply a record type is assigned the profile’s default record type, matching Salesforce.

Pre-shared session tokens

A client that cannot complete the browser login flow, such as a CI job or a script, can be given a token in advance. Pass --seed-session-token (or set AER_SEED_SESSION_TOKEN) to register that token as an authenticated session for the default admin user at startup:

aer server force-app/main/default \
  --seed-session-token '00D000000000000!AQEAQ.local.dev.token'

The token must start with 00D000000000000! and continue with letters, digits, underscores, or periods. Log in with the Salesforce CLI using the same token:

SF_ACCESS_TOKEN='00D000000000000!AQEAQ.local.dev.token' \
  sf org login access-token --instance-url http://127.0.0.1:8080 -a aer

Session tokens are accepted in both the Bearer and the classic OAuth <sessionId> authorization schemes.

REST API examples

Create a record:

$ sf data create record -s Account -v "Name='Acme'" -o aer
Successfully created record: 001aer000000001AAA.
Creating record for Account... done

Query records:

$ sf data query -q "SELECT Id, Name FROM Account" -o aer
┌────────────────────┬──────┐
│ ID                 │ NAME │
├────────────────────┼──────┤
│ 001aer000000001AAA │ Acme │
└────────────────────┴──────┘

Total number of records retrieved: 1.
Querying Data... done

Call Apex REST:

sf apex run rest -m GET -u /services/apexrest/MyService -o aer

A packaged @RestResource class is served under its namespace, at /services/apexrest/<namespace>/<urlMapping>, as in a subscriber org.

The server supports composite requests, batch requests, the SObject Collections API, Bulk API 1.0 and 2.0, and POST /process/approvals for submitting records for approval. A record written through any REST or Bulk endpoint runs the same triggers, flows, workflow rules, and validation rules an Apex insert would, and each row reports its own errors. The default API version is 67.0; override it with --api-version.

A query result larger than the batch size (2,000 records by default, or 200 to 2,000 set with Sforce-Query-Options: batchSize=) returns done: false and a nextRecordsUrl, as Salesforce does, and queryAll returns deleted records. Bulk API 1.0 query jobs support PK chunking (Sforce-Enable-PKChunking) and queryAll, jobs with concurrencyMode Serial run their batches one at a time, and CSV query results use Salesforce’s format.

Tooling API

Tooling queries return ApexClass, ApexSettings, ApexCodeCoverage, ApexCodeCoverageAggregate, ApexOrgWideCoverage, and MetadataComponentDependency, whose rows come from aer’s dependency graph. MetadataContainer, ApexClassMember, and ContainerAsyncRequest implement the container save path used by IDE integrations, and runTestsSynchronous and runTestsAsynchronous run tests and record coverage. runTestsAsynchronous accepts suiteNames, so sf apex run test --suite-names works against the server.

POST /tooling/apexCompileResults type checks the program and returns each class, interface, and trigger that does not compile, with each problem’s line, column, and message, and IsValid on ApexClass and ApexTrigger is false for those. GET /tooling/symbols returns Apex type metadata as typeStubs: category=builtin for the standard library, database for your Apex, and dynamic for the classes generated from record-triggered flows, filtered by namespace and name.

Analytics API

The analytics/reports and analytics/dashboards endpoints run reports and dashboards loaded from your source. Report results use the factMap shape the Salesforce Analytics API returns. A dashboard response includes the metadata of each component and its report results, run as the authenticated user unless the server was started with --use-dashboard-running-user.

The Analytics Download API returns images: /analytics/download/report/<reportId>.png returns a report’s chart, and /analytics/download/lightning-dashboard/<dashboardId>.png returns a dashboard with each of its components. As in Salesforce, these are browser URLs that authenticate with the session cookie, so log in through the Lightning frontend first. aer draws its own chart layouts, so the images differ from Salesforce’s in detail.

Deploy metadata to the running server

The server implements the Metadata API deploy endpoints, so a standard deployment from the Salesforce CLI updates the running server without a restart:

sf project deploy start --source-dir force-app/main/default/classes -o aer

# Validate without applying
sf project deploy start --source-dir force-app -o aer --dry-run

Deployments are extracted and imported with the same metadata walker the server uses at startup, so any type aer loads from source can be deployed: Apex classes and triggers, objects and fields in metadata or source format, flows, flexipages, workflow rules, permission sets, profiles, custom metadata records, queues, labels, value sets, static resources, Visualforce pages, email templates, reports, and dashboards.

Remote site settings and external credentials deploy too, so a deployment can add the setting that permits a callout.

Each deployment compiles Apex against the merged schema, validates package.xml members the way the Metadata API does, migrates storage tables for deployed objects, and commits only on success. A deployment fails only for errors in the components it deploys. A class it does not deploy that no longer compiles is marked invalid, as Salesforce does. Deployments queue in Pending status, apply one at a time, run as the deploying user, and roll back on failure. A deployment that changes only Apex does not trigger a schema reload. Deployed classes keep their ApexClass Id across the Tooling API, the Data API, and Apex.

The Metadata API’s describeMetadata, listMetadata, createMetadata, updateMetadata, and upsertMetadata calls are answered too, and a write is applied the same way a deployment is.

Event Viewer

The Event Viewer at http://127.0.0.1:8080/dev/events displays platform events and deliveries during the session. Use it to verify that your code publishes events correctly and that subscribers receive them before deploying to an org.

Publishing events

Events can be published through:

  • Apex (EventBus.publish())
  • REST API
  • Pub/Sub API (gRPC)

Subscribing to events

Subscriptions are supported through:

  • Pub/Sub API (gRPC)
  • CometD Streaming API
  • Apex triggers
  • LWC Emp API

Integration testing with events

  1. Start the server and open the Event Viewer in your browser.
  2. Publish events via Apex, REST, or Pub/Sub API.
  3. Watch events and deliveries appear in real time.
# Start the server
aer server force-app/main/default &

# Authenticate
sf org login web -r http://127.0.0.1:8080 -a aer

# Publish a platform event
sf data create record -s OrderStatusChange__e -v "Status__c='Completed'" -o aer

# Verify the event was published and delivered via the Event Viewer

Running on several machines

With a PostgreSQL --db, aer server --cluster forwards API requests and async Apex to agents on other machines, which run them against the same database. See Clustering.

Tips

  • Use --sandbox to set Organization.IsSandbox to true for code that checks the environment.
  • Load managed packages with --package or --package-dir to test integrations with third-party apps.
  • Use --allow-callouts to allow the server to make real HTTP callouts.
  • Use --wiremock to mock HTTP callouts with WireMock stubs (works with or without --allow-callouts).
  • Assign permission sets to the default user with -p PermissionSetName, and permission set groups with --assign-psg GroupDeveloperName, for permission-aware testing.
  • Set the org’s default locale and currency with --locale and --currency. See Configuration.
  • The Apex heap limits are 10 MB synchronous and 25 MB asynchronous. Use --heap-limit 6/12 for an org that enforces the Summer ‘26 limits.
  • Run a SandboxPostCopy class after startup with --sandbox-post-copy <Class>.
  • Use --allow-email to deliver Messaging.sendEmail over SMTP instead of logging and discarding it. See Sending real email.
  • Put flags you pass on every run in an .aerrc file.
  • Every response carries a Server: aer/<version> header, which is a quick way to confirm a client is talking to aer rather than an org.