# Scenario applications

Nine kinds of application Jadpo is meant for, what each does, and the
operations it uses. Use these tables to find the operation for a job;
each operation is described in its section of this page, or on the page
linked beside it.

**1. Online shop**

| Does | Needs |
|---|---|
| Basket total and a 10% discount | `money.sum`, `total * 90%` |
| Discount spread across the lines for the receipt | `money.allocate` |
| Product page address from its title | `text.slug` |
| Order reference read out on the phone | `random.code` |
| Products by price, highest first | `list.sort_by`, `list.reverse`; `order:` in a query |
| Product feed for a marketplace | `csv.write` |
| Image cache key | `hash.sha256`, `encoding.to_hex` |

**2. Appointment bookings**

| Does | Needs |
|---|---|
| Slots in the clinic's zone | `temporal.resolve`, `temporal.day_bounds` |
| Free slots: all slots without booked ones | `set.difference` |
| Earliest free slot | `list.min_by` |
| Cancel link in the confirmation email | `random.token`, `encoding.to_url_component` |
| Reminder a day before | `temporal.add_days` |
| A booking ends after it starts | A rule across fields ([Rules across fields](objects.md#rules-across-fields)) |
| Calendar invite file | `.ics` package |

**3. Delivery and logistics**

| Does | Needs |
|---|---|
| Driver's next stop and the rest | `list.first`, `list.drop_first` |
| Estimated arrival | `Instant + Duration` ([Arithmetic and comparison](arithmetic-and-comparison.md)) |
| Is the address inside the zone, distance to depot | [Geospatial](geospatial.md) |
| Tracking code | `random.code` |
| Carrier manifest import | `csv.read` |
| Proof-of-delivery photo fingerprint | `hash.sha256` |
| Parcels by weight band | `list.group_by` |

**4. Property listings**

| Does | Needs |
|---|---|
| Asking price shown in the visitor's locale | `text.format` |
| Price per square metre | `price / units.in(floor_area, AreaUnit.square_metre, ...)`: `Money` by a `Decimal` |
| Listing address | `text.slug` |
| Description preview | `text.trim`, `text.keep_first` |
| Features filter | `set.contains`, `set.intersection` |
| Map search in the visible area | [Geospatial](geospatial.md) |
| Portal feed import | `json.read` as a batch |

**5. SaaS with subscriptions and billing**

| Does | Needs |
|---|---|
| Plan prices per customer's currency | `Money` with a currency known while running |
| Proration for a mid-month change | `price * (days_left / days_in_month)`, the type's rounding |
| Invoice total of lines | `money.sum` |
| Signed webhooks to customers | `crypto.hmac`, `json.write` |
| Customers' third-party tokens kept safe | `crypto.encrypt`, encrypted fields |
| Features per plan | `set.contains` |
| Usage per day | `map.get`, `map.with`; monthly totals by an aggregate query ([Counts, sums and groups](counts-sums-and-groups.md)) |

**6. CMS with CSV imports and exports**

| Does | Needs |
|---|---|
| Import articles from a spreadsheet | `csv.read`, construction per row |
| Export for editors | `csv.write` with `CsvFormat.spreadsheet` |
| Tags typed by hand, tidied | `text.trim`, `text.lower`, `set.with` |
| Excerpt and word count | `text.keep_first`, `text.split`, `list.filter`, `list.count` |
| Articles in a locale's alphabetical order | `list.sort_by` with `locale:` |
| Rich text kept safe | `Html`, made safe by its construction |

**7. IoT telemetry**

| Does | Needs |
|---|---|
| Readings arriving in bulk | `json_lines.read` |
| Average, spread and extremes per window | `list.sum`, `decimal.divide`, `decimal.sqrt`, `list.min_by`, `list.max_by` |
| Drop repeated messages | `set.contains`, `list.distinct` |
| Latest reading per device | `list.group_by`, `list.last` |
| Hourly charts over months | Aggregate queries ([Counts, sums and groups](counts-sums-and-groups.md)) |
| Each device signs its messages with its own key | Keys held as data (see [What is built](standard-library-built.md)) |
| Bit-packed payloads | The device's provider package ([Logic and bits](logic-and-bits.md)) |

**8. Internal admin tool**

| Does | Needs |
|---|---|
| Bulk actions on selected records | `Set<Uuid>`, `set.difference` |
| Email shown masked | `text.keep_first`, `text.keep_last` |
| Export of a filtered list | `csv.write` |
| A record's raw JSON for support | `json.write` |
| Counts by status | Aggregate queries ([Counts, sums and groups](counts-sums-and-groups.md)) |
| Roles | `set.contains` |
| Two-factor codes | TOTP package; passkeys or a provider ([Ways to sign in](ways-to-sign-in.md)) |

**9. Support assistant with retrieval (AI)**

| Does | Needs |
|---|---|
| Embed help articles and find the closest | `Vector`, pgvector query ([Embeddings and search](embeddings-and-search.md)) |
| Answer as a typed reply with sources | `ai.generate(..., as:)` ([Typed output](typed-output.md)) |
| Show the answer as it is written | `ai.stream` ([Streaming](streaming.md)) |
| Keep within a monthly budget | AI limits ([Budgets](safety-and-privacy.md#budgets)) |
| Strip personal data before sending | `text.replace`; the [personal-data report](the-personal-data-report.md) |
| Chunk articles into passages | `text.split`, `list.keep_first` |

How much of the standard library each application uses, and how each
need was met, is in the
[design notes](https://github.com/jadpo-dev/jadpo/blob/main/docs/language/notes/19-standard-library.md#scenario-coverage).
