Implementation lesson · MapProx
Designing MapProx Quotas Around Resources and Paid API Operations
A single monthly counter cannot accurately represent both current inventory and operations accumulated during a billing period. Enforcement also has to occur where an external request creates cost or consumes a constrained provider operation.
- EVC role
- Designed and built end to end
- Product status
- Publicly available
- Period
- Development began in July 2025
Context
MapProx is a field-sales mapping, route-planning, and visit-logging SaaS product. It manages persistent resources such as maps and business locations while also performing metered operations such as route optimization, discovery, and geocoding.
EVC Studios designed and built MapProx end to end.
Constraints
- Model persistent inventory separately from accumulated operations
- Prevent concurrent requests from exceeding an operation allowance
- Avoid charging for work that never produces the intended useful action
- Keep shared or team usage understandable without exposing internal thresholds
- Make denied and consumed usage auditable
Decision
The quota model treats current resources as stock measured through live counts and accumulated operations as flow measured through period counters. Provider-facing workflows check eligibility before avoidable paid work, then use an atomic reservation or consumption gate at the event the product defines as billable or complete.
Architecture and workflow
The sequence below is both the visual flow and its text description.
- Step 1
Classify the limit
Decide whether the rule constrains current inventory, provider invocation, a completed operation, or a saved result.
- Step 2
Check preliminary eligibility
Check available allowance before avoidable paid work, while recognizing that this check alone does not reserve capacity.
- Step 3
Reserve or perform
Reserve atomically before the provider call when invocation itself consumes quota. Otherwise perform the provider operation under the documented completion policy.
- Step 4
Consume, save, or compensate
Atomically consume or confirm usage at the defined completion event, persist the useful result, and compensate a prior reservation if downstream work fails.
Stock and flow answer different questions
A stock limit asks how many resources exist now. If a location is removed, capacity can become available again. A flow limit asks how many operations occurred in a defined period; deleting an output does not erase the provider work already performed.
MapProx therefore uses live database counts for persistent inventory and period counters for accumulated operations. The model follows the meaning of each business rule rather than forcing every feature into one counter.
Eligibility, provider cost, and the completion boundary
Preliminary eligibility should be checked before avoidable paid external work. Placing checks only in the interface or after the request permits unnecessary provider calls and makes alternate clients inconsistent. But a preliminary check is not a reservation: concurrent requests can all observe the same remaining allowance.
MapProx distinguishes eligibility checking, provider work, quota consumption, and saving a useful result. The product defines a specific completion event at which usage is officially consumed. When useful saved output defines that event, the provider call can occur before the atomic consumption gate; provider cost may already have occurred even if the later gate rejects completion. That is an accepted policy trade-off, not prevention of the provider call.
Atomic gates and concurrent requests
Atomic consumption at the completion boundary prevents concurrent requests from committing usage beyond the allowance. It does not retroactively prevent provider calls that already happened after preliminary eligibility.
If provider invocation itself must never exceed the allowance, the stronger general pattern is an atomic reservation before the call, followed by confirmation when work succeeds or compensation when downstream work fails. The evidence supports MapProx's eligibility and atomic-consumption boundaries; it does not establish that MapProx currently reserves quota before every provider call. The correct sequence depends on whether the product limits provider invocation, completed operation, or saved result.
- Keep enforcement centralized
- Define the official consumption event
- Use one owner for each counter
- Make retries idempotent where possible
- Design reservation compensation when invocation is capped
Messaging, teams, and auditability
Users need to know which kind of limit they reached, the relevant period or resource category, and which action can resolve it. Generic errors obscure whether deleting inventory, waiting for renewal, changing scope, or contacting an administrator is appropriate.
Shared workspaces need an explicit quota owner and aggregation rule. Usage records should distinguish denied, reserved, consumed, compensated, and saved states at a conceptual level so operators can investigate disagreements without exposing provider credentials or private map data.
Operational and maintenance consequences
Live counts add database work on resource paths. Period counters require renewal boundaries and clear ownership. Atomic gates add transaction logic, while provider changes can alter which operation carries cost.
For a small product with one inexpensive operation and low concurrency, a single counter may be sufficient. Complexity becomes justified when inventory, provider costs, team sharing, and concurrent requests have materially different behavior.
Trade-offs
- Live counts represent current stock without a drifting inventory counter, but add database work.
- Period counters represent accumulated operations efficiently, but can drift without one owner.
- Preliminary eligibility avoids clearly disallowed paid work but does not reserve capacity against concurrent requests.
- Atomic consumption prevents over-commit at the defined completion event, but cannot prevent an earlier provider invocation.
- Atomic reservation can cap provider invocations, but requires confirmation or compensation after downstream success or failure.
Context-specific limitations
- The model reflects MapProx resource and provider-operation boundaries.
- It does not prescribe universal billing periods or thresholds.
- Simpler products may need only one clearly owned counter.
- Quota semantics must be reviewed when provider costs or product rules change.
Generalizable lessons
- Classify a quota by what it measures before choosing storage.
- Use live counts for current stock and period counters for accumulated operations when their meanings differ.
- Check preliminary eligibility before avoidable paid work, but do not treat that check as reserved capacity.
- Define whether provider invocation, completed operation, or saved result officially consumes quota.
- Use atomic consumption to prevent concurrent over-commit at that boundary.
- When provider invocation itself must be capped, reserve atomically before the call and confirm or compensate afterward.
Decision checklist
- Is the limit current stock or activity over time?
- Which event creates provider cost?
- When does the user receive useful value?
- Can concurrent requests overrun the limit?
- Who owns shared usage?
- How are failure, compensation, and disputes investigated?