← Snap Interview Insights

Snap·Backend Engineer·Onsite - System Design / Architecture·Senior

Senior
Apr 2026

Summary

Snapchat backend design round focused entirely on a file storage system with access control. Pretty deep dive, they wanted the full picture from data modeling all the way through caching and admin APIs.

Questions Asked (4)

Q1

Design a file storage system with access control, where users belong to groups, permissions can be granted at the file or folder level to users or groups, and permissions inherit downward through the folder hierarchy.

System DesignData ModelingTechnical Trade-offs
Author's notes

This one sprawled in every direction.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scale, then design a data model that separates metadata (files/folders, users, groups) from permissions, using a closure table or materialized path for efficient inheritance. Discuss how to evaluate permissions at read/write time, and cover trade-offs between precomputed effective permissions and on-the-fly resolution, including caching and consistency.

Pro tip: Emphasize that permission checks must be fast and consistent; propose a hybrid approach where effective permissions are precomputed and cached, but invalidated on ACL changes, and discuss how to handle deep hierarchies without recursive queries.

1. Clarify Requirements and Scale

Ask about scale (number of users, files, groups), read/write patterns, latency requirements, and whether permissions can be changed frequently. Also clarify if there are special cases like public links or temporary access.

2. Design Core Data Model

Define entities: User, Group, File/Folder (with parent-child relationship), and Permission (subject: user/group, object: file/folder, access level: read/write/own). Use a closure table or materialized path to represent hierarchy for efficient ancestor/descendant queries.

3. Define Permission Inheritance and Resolution

Explain how permissions inherit downward: a permission on a folder applies to all descendants unless overridden. Describe the algorithm to resolve effective permissions for a user on a file: gather all ACL entries from the file up to the root, apply precedence rules (e.g., explicit deny > allow, user > group).

4. Optimize for Performance and Scale

Discuss caching effective permissions per user-file pair, using an LRU cache with invalidation on ACL changes. Consider precomputing permissions for hot files or using a graph database for complex hierarchies. Address consistency trade-offs (e.g., eventual vs strong consistency).

5. Handle Edge Cases and Trade-offs

Cover scenarios like moving files/folders (recompute permissions), group membership changes, and permission conflicts. Discuss trade-offs between storage overhead, query complexity, and update latency.

Key Points to Mention

  • Use of closure table or materialized path for efficient hierarchy traversal and inheritance.
  • Permission resolution algorithm: collect ACLs from file to root, apply precedence (deny > allow, user > group, explicit > inherited).
  • Caching strategy: cache effective permissions with invalidation on ACL or group membership changes.
  • Trade-offs between precomputed permissions (fast reads, complex updates) and on-the-fly resolution (simple updates, slower reads).
  • Handling of group membership changes and their impact on effective permissions.
  • Scalability considerations: sharding by user or file, using a distributed cache like Redis, and ensuring low-latency permission checks.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

What database would you choose for this system and why? Walk through the trade-offs between relational, graph, and document databases for this use case.

Technical Trade-offsSystem Design
Author's notes

I went relational first because the ACL and membership data is inherently tabular and you want transactions.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the specific system or feature (e.g., Snapchat's messaging, Stories, or friend graph) and its access patterns, scale, and consistency needs. Then compare relational, graph, and document databases against those requirements, highlighting trade-offs and justifying a primary choice with possible polyglot persistence.

Pro tip: Acknowledge that real-world systems often use multiple databases (polyglot persistence) and that the choice depends on the dominant access pattern—don't force a single database to do everything.

1. Clarify the Use Case

Ask questions to understand the system's data model, read/write patterns, scale, consistency requirements, and latency needs. This ensures your answer is tailored to Snapchat's specific context.

2. Outline Database Options

Briefly describe relational, graph, and document databases in terms of their core strengths: relational for structured data and complex joins, graph for highly connected data, document for flexible schemas and horizontal scaling.

3. Map Requirements to Trade-offs

For each database type, discuss how it handles the use case's key requirements (e.g., scalability, consistency, query flexibility) and the associated trade-offs (e.g., eventual consistency vs. strong consistency, join performance vs. denormalization).

4. Recommend a Solution

Choose a primary database (or combination) that best fits the dominant access patterns, and justify why it's optimal. Mention any complementary databases for secondary needs.

5. Summarize and Conclude

Recap the key reasons for your choice and acknowledge any potential drawbacks or mitigations, showing balanced judgment.

Key Points to Mention

  • Relational databases (e.g., PostgreSQL) offer ACID transactions and strong consistency but can struggle with horizontal scaling and flexible schemas.
  • Graph databases (e.g., Neo4j) excel at traversing relationships (e.g., friend networks) but may have limited horizontal scalability and are less suited for high-volume simple lookups.
  • Document databases (e.g., MongoDB, Cassandra) provide flexible schemas and horizontal scalability, ideal for high write throughput and denormalized data, but often sacrifice complex joins and multi-document ACID transactions.
  • Snapchat's scale demands high availability and partition tolerance (CAP theorem), often leading to eventual consistency for certain features.
  • Polyglot persistence: using different databases for different microservices (e.g., graph for social graph, document for messages) can optimize each use case.
  • Consider operational complexity, cost, and team expertise when choosing a database.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

How would you efficiently answer the query 'can user X access resource Y?' given that permissions can be inherited from parent folders and from group memberships?

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

The naive answer is: collect all groups user X belongs to, walk up the folder tree from Y, check ACL entries at each level.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements: expected query volume, latency, consistency needs, and permission model complexity. Then propose a hybrid solution: precompute and cache effective permissions using a graph traversal (e.g., DFS/BFS) over folder hierarchy and group memberships, and use an inverted index or materialized view for fast lookups. Discuss trade-offs between precomputation (fast reads, slower writes) and on-the-fly checks (slower reads, simpler writes).

Pro tip: Mention that you would use a bitmask or Bloom filter for quick negative checks to avoid expensive traversals, and highlight the importance of cache invalidation strategies when permissions change.

1. Clarify Requirements

Ask about scale (QPS, number of users/resources), latency SLA, consistency requirements, and permission model (read/write, inheritance rules).

2. Model Permissions as a Graph

Represent folders as a tree and groups as a DAG; user access is the union of direct, inherited, and group-based permissions.

3. Choose an Access Check Strategy

Decide between on-the-fly traversal (e.g., DFS up the folder tree and through groups) and precomputed materialized permissions. Consider hybrid: cache effective permissions per user-resource pair.

4. Optimize for Performance

Use caching (e.g., Redis) with TTL or event-based invalidation, bitmasks for permission sets, and indexing for group memberships. For negative checks, use Bloom filters.

5. Address Consistency and Invalidation

Discuss how to handle permission changes: invalidate affected cache entries, use versioning, or recompute asynchronously. Mention eventual consistency trade-offs.

Key Points to Mention

  • Graph traversal algorithms (DFS/BFS) for inheritance and group memberships
  • Caching strategies (Redis, Memcached) and cache invalidation techniques
  • Materialized views vs. on-the-fly computation trade-offs
  • Bitmask or Bloom filter for efficient permission representation and quick checks
  • Handling cycles in group memberships (DAG) and avoiding infinite loops
  • Scalability considerations: sharding, read replicas, and asynchronous updates

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

How would you handle caching, audit logging, and admin APIs for this access control system?

System DesignAPI & Integrations
Author's notes

Caching felt straightforward: cache resolved permissions keyed by user+resource, invalidate on any ACL or group membership change.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the access control system's scale and requirements, then address each concern (caching, audit logging, admin APIs) in turn, explaining trade-offs and how they integrate. Emphasize security, performance, and maintainability, and tie your choices back to Snapchat's high-traffic, low-latency environment.

Pro tip: Mention that audit logs should be immutable and stored separately from the main database to prevent tampering, and that caching authorization decisions must include a robust invalidation strategy to avoid stale permissions.

1. Clarify requirements and constraints

Ask about scale (QPS, number of users/roles), latency requirements, consistency needs, and compliance requirements. This ensures your design aligns with Snapchat's expectations.

2. Design caching strategy

Propose caching authorization decisions (e.g., in Redis) with appropriate TTL and invalidation on permission changes. Discuss cache key design, eviction policies, and fallback to source of truth.

3. Implement audit logging

Outline a system that logs all access control changes and access attempts asynchronously to a durable, append-only store (e.g., Kafka + S3). Ensure logs are immutable, tamper-evident, and include necessary context.

4. Expose admin APIs

Define RESTful or gRPC endpoints for managing roles, permissions, and policies. Include authentication, authorization (admin-only), rate limiting, input validation, and idempotency.

5. Address integration and trade-offs

Explain how caching, logging, and admin APIs interact (e.g., admin changes trigger cache invalidation and audit events). Discuss consistency vs. availability trade-offs and failure modes.

Key Points to Mention

  • Cache invalidation strategies (e.g., pub/sub, versioning) to handle permission updates without stale data.
  • Audit log immutability and tamper-proofing using append-only storage and cryptographic hashing.
  • Admin API security: authentication (OAuth/JWT), authorization (RBAC), rate limiting, and audit trails for admin actions.
  • Asynchronous logging to avoid impacting request latency, with backpressure handling.
  • Monitoring and alerting for cache hit rates, audit log failures, and admin API anomalies.
  • Compliance considerations (e.g., GDPR, SOX) for audit logs and access control data.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.