Appearance
Forge apps
Forge apps can be created with the Action or Page component in the Forge SDK.
Actions
Actions are the building blocks of Forge. An action runs your code each time the user submits a form or schedules the action to be ran.
ts
export default new Action(async () => {
const name = await io.input.text("Your name");
// run your code
return `Invited ${name}!`;
});
INFO
Actions can range from CRUD operations to workflow tasks.
Transactions
A transaction represents a single run for an Action. A transaction has the following states:
- Success - occurs when a transaction has completed
- Error - occurs when the transaction has an error
- Canceled - occurs when the user leaves the page or when the user explicitly cancels the transaction
Pages
Pages allow for building complex multi-page Forge apps in order to group your Actions together. You can link pages to various Actions for the user to run.
ts
export default new Page({
name: "Users",
routes: {
delete: {
name: "Delete user",
handler: async () => {
const name = await io.input.text("Your name");
// run your code
return `Uninvited ${name} 😢`;
},
},
invite: {
name: "Invite user",
handler: async () => {
const name = await io.input.text("Your name");
// run your code
return `Invited ${name}!`;
},
},
},
});
Best Practices - Forge apps
Forge apps are highly customizable. However, we recommend several best practices for building Forge apps to retain customizability and support for future feature releases.
Pages vs Actions
Pages allow for building complex multi-page Forge apps on top of your actions. If your Forge app has complex requirements and multiple actions, we highly recommend using the pages component.
View this chart to get an idea of whether you should create an action or a page. You can always group your action into a page when your Forge app grows in complexity.
Use Case | Actions | Pages |
---|---|---|
Admin Dashboards | ❌ | ✅ |
View Only User Interfaces | ❌ | ✅ |
Single-step workflows (e.g. CRUD operations) | ✅ (simple workflows) | ✅ |
Multi-step workflows | ✅ (simple workflows) | ✅ |
INFO
Pages cannot run actions directly on the page and currently requires linking to an action from the page. We recommend using pages if you expect your actions to grow in complexity.
Integrated or Standalone Service
Forge can run as a background process alongside your service or as it's own standalone service. We recommend running Forge alongside your service for the best developer experience.