Sales is one of the busiest domains in an ERP. A lead becomes an opportunity, the opportunity becomes a quote, the quote becomes an order, and the order needs pricing and payment along the way. In the tdk-erp-system example, the sales stack holds twenty resources. This article walks through how they relate and how to check a flow.
The shape of the flow
The services follow the sales cycle:
-
lead-management-apitracks leads. -
crm-apiholds customer relationships, on port 4300. -
opportunity-apitracks the deal pipeline. -
quoting-apigenerates quotes. -
pricing-apimanages prices. -
order-management-apiprocesses orders. -
sales-forecasting-apimakes sales predictions.
The rest of the stack, including payment-processing-api, territory-management-api, and sales-portal-api, covers payments, territories, and the customer-facing portal.
Starting it
From the repository root, start the sales stack:
tdk up sales
Use --dry-run first if you have changed a service.json, so you can read the plan:
tdk up sales --dry-run
Dependencies matter here
Sales services depend on each other. A quote needs a price, and an order needs a customer. Each service declares what it needs with dependsOn, and TDK starts services in that order. If a quoting service starts before pricing is ready, its first request fails in a confusing way, so check the dependency list when you add a service.
Checking one flow
Pick one path, such as creating a lead, converting it, and requesting a quote, and check each step in turn. Use the health route first, then call the endpoint that does the work. Start with crm-api on port 4300, because the other services look up customers through it.
For each failure, read the log for that service:
tdk logs --json --service quoting-api --tail 200
Check readiness with tdk status --json before you run a flow. A service that is still pending will fail the flow even if its code is correct.
What to keep in mind
Test flows, not services. A sales service can pass its health check and still fail when a quote asks it for a price. The integration you care about is between services, so exercise the path that crosses them.
Stopping
When you finish, run tdk down. A stack left running holds the ports for the next start.
Summary
The sales stack is twenty resources along a sales cycle. Start it with tdk up sales, check dependencies before adding a service, and test one flow end to end, starting with crm-api on port 4300.
Top comments (0)