This project is bootstrapped by aurelia/new.
npm start
npm run build
It builds dist/*bundle.[hash].js, updates index.html with hashed js bundle file name. then the hash will change. So to deploy to the production server, be sure to copy the generated index.html and dist/*. Otherwise those files will not have changed and will need not be redeployed.
To deploy everything, copy to production root folder:
base.css
favicon.ico
dist/index.html
dist/assets
In rare situation, you might need to run clear-cache after upgrading to new version of dumber bundler.
npm run clear-cache
dist/index.html is generated from index.html every time npm run build runs.
In this Aurelia application, data flows through a structured pipeline involving Views, ViewModels, Stores, and Services.
-
Role: The presentation layer of the application.
-
Interaction: Views are paired with ViewModels and bind to their public properties and methods using Aurelia’s binding system.
-
Responsibility:
- Handle display logic only.
- Apply formatting (e.g., currency, dates, numbers) to data provided by the ViewModel.
-
Role: UI controllers that connect Views to application logic.
-
Interaction: ViewModels are paired one-to-one with Views and are responsible for orchestrating UI behavior.
-
Responsibility:
- Inject Stores as needed.
- Delegate data retrieval, transformation, and business logic to Stores.
- Expose observable properties for the View to bind to.
- Handle user interaction and lifecycle events (
binding,attached, etc.).
-
Role: Centralized modules that manage state, business logic, and coordination of data.
-
Interaction: Injected into ViewModels (or other Stores if needed).
-
Responsibility:
- Act as the middle layer between ViewModels and Services.
- Call Services to fetch raw data.
- Apply business rules and transformations.
- Cache and manage shared application state.
-
Role: Interface with external resources like APIs, databases, or smart contracts.
-
Interaction: Injected into Stores.
-
Responsibility:
- Make HTTP requests or contract calls.
- Return raw, unformatted data.
- Remain stateless and reusable.
[ View ] → binds to → [ ViewModel ] → uses → [ Store ] → calls → [ Service ]
This separation supports:
- Reusability of Stores across different ViewModels
- Testability by isolating logic in Stores and Services
- Clean UI logic by keeping ViewModels slim and focused