Quick Start
This guide will help you set up a project, deploy, make a change and test it.
0. Setup
- Node JS 18+
- NPM 7+ or Yarn 1+ or PNPM
- Create an AWS Account and set up your AWS CLI:
1. Create a new project
To create a new Eventual project, run:
- npm
- yarn
- pnpm
npm create eventual@latest
yarn create eventual@latest
pnpm create eventual@latest
Install Dependenices
- npm
- yarn
- pnpm
cd my-project
npm i
cd my-project
yarn
cd my-project
pnpm i
Review the created project structure
The project template generates the following project structure containing 3 NPM packages:
my-service
├──README.md # a README with some helpful tips
├──infra # an AWS CDK application that deploys the repo's infrastructure
├──packages
├──service # the NPM package containing the @my-service/service business logic
2. Make a Change
Let's make a small change to the formatMessage task in packages/service/src/hello.ts so we can trace through
export const formatMessage = task("formatName", async (name: string) => {
// return `hello ${name}`;
return `goodbye ${name}`;
});
3. Deploy the Service
Use the deploy script to deploy your Service to AWS with the AWS Cloud Development Kit.
- npm
- yarn
- pnpm
npm run deploy
yarn deploy
pnpm run deploy
You can find the CDK application in infra/src/app.ts. This is where you configure infrastructure.
4. Invoke a Command
Execute the hello command.
npx eventual invoke hello "my name"
The hello command in the template triggers a workflow and returns its execution ID.
{ "executionId": "<execution-id>" }
To see how, take a look at hello in packages/service/src/hello.ts.
5. Check the status of a Workflow Execution
Use the eventual CLI to get the status of the workflow we just started.
npx eventual get execution <execution-id>
It should output:
Result:
goodbye my name
Note the "goodbye" in the output. We made a change to a task that was then invoked by a Workflow Execution. The data returned by that Workflow Execution is what we see here.
6. View the logs
To view the logs for the workflow execution we just started, use the eventual get logs command followed by the --execution flag and the execution ID:
npx eventual get logs --execution <execution-id>
Next Steps
- To learn more about our features and capabilities, view the What is Eventual 📖 guide.
- Review the Reference Docs for a deep dive into Eventual's API.