PracHub
QuestionsLearningGuidesInterview Prep
|Home/System Design/Apple

Design APIs for a Voting System

Last updated: Aug 5, 2026

Quick Overview

Define APIs and a core model for an authenticated election with one final ballot per voter and results hidden until close. The design discussion covers eligibility, deterministic timing, idempotent voting, concurrent submissions, recountable records, audit trails, and privacy boundaries.

  • easy
  • Apple
  • System Design
  • Software Engineer

Design APIs for a Voting System

Company: Apple

Role: Software Engineer

Category: System Design

Difficulty: easy

Interview Round: Technical Screen

## Design APIs for a Voting System Design the APIs and core data model for a voting system. Begin by clarifying the type of vote: identified or anonymous, single-choice or multi-choice, mutable or final, and whether partial results are visible before voting closes. For a concrete baseline, assume authenticated voters, one final single-choice ballot per voter per election, a configured opening and closing time, and results that become public only after the election closes. Explain how the contracts would change if those assumptions change. ### Part 1 — Model Elections, Options, and Eligibility Define the resources and APIs needed to create an election, add options, configure eligibility and timing, publish it, and read its current state. #### What This Part Should Cover - Stable election and option identifiers. - Draft, open, closed, and cancelled state transitions. - Authorization differences between administrators and voters. - Immutable voting rules once an election opens, or an explicit safe versioning policy. ```hint Put rules in the election version A ballot must be judged against the same option set and eligibility policy that the voter saw when casting it. ``` ### Part 2 — Cast One Ballot Safely Design the ballot endpoint, request and response fields, idempotency behavior, and error model. Address two concurrent requests from the same voter and a request racing with the closing time. #### What This Part Should Cover - Authentication-derived voter identity rather than a trusted body field. - Validation of election state, eligibility, and selected option. - A uniqueness or transactional rule enforcing one ballot. - Stable idempotency for an ambiguous timeout without permitting a second choice. ```hint Make acceptance one transaction The close-time check, eligibility decision, and one-ballot constraint must agree on one committed outcome. ``` ### Part 3 — Publish Results and Preserve Auditability Define result and administrative APIs, explain how counts are produced, and show what operators can inspect without exposing individual votes unnecessarily. #### What This Part Should Cover - Result visibility tied to election state. - Transactional counters or recountable immutable ballots. - Audit events for election changes and ballot acceptance decisions. - Privacy boundaries, rate limits, pagination, and monitoring. ```hint Keep a recount path Fast counters are useful for reads, but the system still needs an authoritative record that can detect or repair a count mismatch. ``` ### What a Strong Answer Covers - Gives concrete resource, ballot, and result contracts with meaningful status codes. - Enforces one accepted ballot under retries and concurrency. - Makes opening and closing boundaries deterministic. - Separates public results, administrative audit data, and protected voter information. ### Follow-up Questions 1. How would anonymous ballots change eligibility enforcement and audit storage? 2. What changes if voters may replace their ballot before close? 3. How would ranked-choice ballots affect validation and result computation? 4. How would you reconcile a materialized result counter with immutable ballot records?

Quick Answer: Define APIs and a core model for an authenticated election with one final ballot per voter and results hidden until close. The design discussion covers eligibility, deterministic timing, idempotent voting, concurrent submissions, recountable records, audit trails, and privacy boundaries.

Related Interview Questions

  • Design a Centralized Logging System - Apple (medium)
  • Object-Oriented Design: Hotel Room Booking System - Apple (medium)
  • Design a smartwatch sensor subsystem - Apple (hard)
  • Design CI/CD for AI Services - Apple (medium)
|Home/System Design/Apple

Design APIs for a Voting System

Apple logo
Apple
May 3, 2026, 12:00 AM
easySoftware EngineerTechnical ScreenSystem Design
0
0

Design APIs for a Voting System

Design the APIs and core data model for a voting system. Begin by clarifying the type of vote: identified or anonymous, single-choice or multi-choice, mutable or final, and whether partial results are visible before voting closes.

For a concrete baseline, assume authenticated voters, one final single-choice ballot per voter per election, a configured opening and closing time, and results that become public only after the election closes. Explain how the contracts would change if those assumptions change.

Part 1 — Model Elections, Options, and Eligibility

Define the resources and APIs needed to create an election, add options, configure eligibility and timing, publish it, and read its current state.

What This Part Should Cover Guidance

  • Stable election and option identifiers.
  • Draft, open, closed, and cancelled state transitions.
  • Authorization differences between administrators and voters.
  • Immutable voting rules once an election opens, or an explicit safe versioning policy.

Part 2 — Cast One Ballot Safely

Design the ballot endpoint, request and response fields, idempotency behavior, and error model. Address two concurrent requests from the same voter and a request racing with the closing time.

What This Part Should Cover Guidance

  • Authentication-derived voter identity rather than a trusted body field.
  • Validation of election state, eligibility, and selected option.
  • A uniqueness or transactional rule enforcing one ballot.
  • Stable idempotency for an ambiguous timeout without permitting a second choice.

Part 3 — Publish Results and Preserve Auditability

Define result and administrative APIs, explain how counts are produced, and show what operators can inspect without exposing individual votes unnecessarily.

What This Part Should Cover Guidance

  • Result visibility tied to election state.
  • Transactional counters or recountable immutable ballots.
  • Audit events for election changes and ballot acceptance decisions.
  • Privacy boundaries, rate limits, pagination, and monitoring.

What a Strong Answer Covers Guidance

  • Gives concrete resource, ballot, and result contracts with meaningful status codes.
  • Enforces one accepted ballot under retries and concurrency.
  • Makes opening and closing boundaries deterministic.
  • Separates public results, administrative audit data, and protected voter information.

Follow-up Questions Guidance

  1. How would anonymous ballots change eligibility enforcement and audit storage?
  2. What changes if voters may replace their ballot before close?
  3. How would ranked-choice ballots affect validation and result computation?
  4. How would you reconcile a materialized result counter with immutable ballot records?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Apple•More Software Engineer•Apple Software Engineer•Apple System Design•Software Engineer System Design

Your design canvas — auto-saved

PracHub

Master your tech interviews with 9,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.