RFC Template (Request for Comments)
RFC proposal: summary, motivation, guide-level explanation, detailed design, drawbacks, alternatives, prior art, rollout, decision
How to use: Use for changes that affect other teams, public interfaces or are hard to reverse. Write the motivation with data first and name the decider and review deadline in the header. The main pitfall is debating solutions before reviewers agree on the problem, and not recording why an RFC was accepted or rejected.
Preview
RFC-[NNNN]: [Proposal title]
Request for Comments for a significant change to a product, API, platform or engineering practice. The section order follows the open-source RFC pattern popularised by the Rust project (summary, motivation, guide-level explanation, detailed design, drawbacks, alternatives, prior art, unresolved questions), with rollout and a review log added for teams. Replace every
[bracketed]value and every row marked Example.
| Field | Value |
|---|---|
| RFC number | [RFC-0042] |
| Title | [Proposal title] |
| Author(s) | [@name] |
| Decider | [@name or forum, for example Architecture Review Board] |
| Reviewers | [@name, @name, team-x] |
| Status | [Draft / In review / Final comment period / Accepted / Rejected / Withdrawn / Implemented] |
| Created | YYYY-MM-DD |
| Review deadline | YYYY-MM-DD |
| Discussion | [link to thread or pull request] |
| Tracking issue | [link] |
1. Summary
Example: Introduce cursor-based pagination for all list endpoints of the
public API (GET /v2/*), replacing offset pagination. Clients receive an opaque
next_cursor and pass it back to fetch the next page. Offset parameters keep
working for 12 months and then return an error.
2. Motivation
Example: Offset pagination causes three recurring problems:
- Deep pages are slow:
OFFSET 50000queries take 2.4 s at p95 and caused two incidents last quarter. - Clients see duplicates or gaps when records are inserted while they page.
- Large customers export data by paging to the end, which drives 30% of database read load.
If nothing changes, read load grows with customer data volume and the export use case keeps degrading. The expected outcome is constant-time page fetches and consistent results for clients.
2.1 Goals and non-goals
| Type | Statement |
|---|---|
| Goal | Example: p95 latency of any page under 200 ms regardless of depth |
| Goal | Example: No duplicates or gaps while paging through a changing collection |
| Non-goal | Example: Random access to page N |
| Non-goal | Example: Changing the bulk export product (separate RFC) |
3. Guide-level explanation
Example: Every list endpoint now returns a page object:
{
"data": [{"id": "ord_123"}, {"id": "ord_124"}],
"next_cursor": "eyJpZCI6Im9yZF8xMjQifQ",
"has_more": true
}
To fetch the next page, pass the cursor:
GET /v2/orders?limit=100&cursor=eyJpZCI6Im9yZF8xMjQifQ. Treat the cursor as
opaque; do not parse or construct it. When has_more is false, you have reached
the end. Sorting is fixed per endpoint (newest first for orders).
4. Detailed design
This section is the reference for implementers and reviewers.
4.1 Interface
The request and response types shared by all list endpoints:
interface PageRequest {
limit?: number; // 1..500, default 100
cursor?: string; // opaque, from previous response
}
interface Page<T> {
data: T[];
next_cursor: string | null;
has_more: boolean;
}
4.2 Behaviour
- Example: The cursor encodes the sort key and the ID of the last item (keyset pagination):
WHERE (created_at, id) < ($1, $2) ORDER BY created_at DESC, id DESC LIMIT $3. - Example: Cursors are signed (HMAC) to prevent tampering and expire after 24 hours; an expired cursor returns
400 cursor_expired. - Example: A composite index on
(tenant_id, created_at DESC, id DESC)is required for every paginated table.
4.3 Sequence
The sequence below shows a client paging through a collection.
4.4 Compatibility, security and operations
| Concern | Impact |
|---|---|
| Backward compatibility | Example: offset accepted for 12 months with a Deprecation header |
| Security | Example: Cursor signed and scoped to tenant; cannot be replayed across tenants |
| Performance | Example: Constant-time queries; index adds ~3% write overhead |
| Observability | Example: Metric for offset usage per client to drive migration |
| Documentation | Example: API reference and migration guide updated |
5. Drawbacks
- Example: Clients cannot jump to page N; some admin UIs need redesign.
- Example: Every client must migrate within 12 months; support load during migration.
- Example: New index on three large tables; build takes about 2 hours each.
6. Alternatives
| Option | Pros | Cons | Decision |
|---|---|---|---|
| Example: Keep offset, cap at 10,000 | No client change | Breaks exports; does not fix gaps | Rejected |
Example: Expose raw keyset parameters (after_id) | Simple, transparent | Locks sort order into public API; tamperable | Rejected |
| Example: Opaque signed cursor (this proposal) | Flexible, safe | Client migration | Chosen |
| Do nothing | No effort | Load and incidents grow | Rejected |
7. Prior art
- Example: Our internal events API has used cursors since 20XX with no reported issues.
- Example: Several large public APIs use opaque cursors with
has_moreflags; client libraries for them are common, which lowers the learning cost. - [Reference and lesson]
8. Unresolved questions
| ID | Question | Resolve by | Owner |
|---|---|---|---|
| Q-1 | Example: Is 24 h cursor expiry enough for slow exports? | Before acceptance | @api-lead |
| Q-2 | Example: Do we offer a total_count field (expensive)? | During implementation | @product |
| Q-3 | [Question] | [Stage] | [@name] |
9. Rollout
- Example: Phase 1: cursors on two endpoints behind a header opt-in; measure latency.
- Example: Phase 2: cursors default on all list endpoints; offset still accepted with
Deprecationheader. - Example: Phase 3: contact the top 50 offset users; publish migration guide.
- Example: Phase 4 (month 12): offset returns
400; remove code path.
Success measures: [p95 page latency < 200 ms; offset share < 1% before phase 4]. Rollback: [disable the flag; offset path stays until phase 4].
10. Review log and decision
| Date | Reviewer / forum | Feedback | Resolution |
|---|---|---|---|
| YYYY-MM-DD | Example: @dba | Index build must run online | Use concurrent index build |
| YYYY-MM-DD | Example: API guild | Cursor expiry too short for exports | Raised to 24 h (Q-1) |
| YYYY-MM-DD | [Reviewer] | [Feedback] | [Resolution] |
Decision: [Accepted / Rejected / Deferred] on YYYY-MM-DD by [decider]. Rationale: [One to three sentences, including conditions of acceptance.]
Section structure adapted from the Rust RFC template (rust-lang/rfcs, dual licensed MIT or Apache-2.0); text is original. Template licence: MIT.
Related templates
Architecture Decision Record (ADR) Template
Lightweight Nygard-style ADR: status, context, decision, consequences, alternatives, related decisions, lifecycle and log
Software & EngineeringAGENTS.md Template for AI Coding Agents
Repository instructions for AI coding agents: setup, build and test commands, conventions, architecture map, PR and security rules
Software & EngineeringAI Coding Assistant Policy Template
Policy for AI coding assistants and agents: autonomy levels, tool register, secrets, sandboxing, review of generated code, provenance, OWASP ASI and SSDF mapping