Low-Level Design (LLD)
A detailed technical design document that specifies the internal structure of components, including class designs, database schemas, API contracts, algorithms, and configuration details needed for implementation.
Purpose
The LLD provides developers with sufficient detail to implement the solution consistently and correctly. It reduces ambiguity, ensures alignment across team members, and serves as a reference during code reviews and testing.
When to Use
Create LLDs during beta for complex components that require coordinated implementation across multiple developers. Not every component needs an LLD — use them for complex business logic or intricate integrations.
How to Build
Start by referencing the HLD component this LLD details. Restate the component's responsibility and interfaces at a summary level.
Define the internal structure: classes, modules, or functions with their responsibilities and relationships. Use class diagrams or module dependency diagrams.
Specify the data model in detail: database tables with columns, types, constraints, and indexes. Include entity-relationship diagrams.
Define API contracts precisely: endpoints, HTTP methods, request/response schemas, error codes, and authentication requirements.
Document algorithms or complex business logic using pseudocode, flowcharts, or decision tables. Specify error handling behaviour, retry logic, and edge cases.
Tips
- Write at the level where a competent developer could implement without clarifying questions.
- Include sequence diagrams for complex interactions between internal components.
- Document error scenarios and edge cases — these are where bugs typically hide.
- Keep the LLD close to the code — store it in the repository.
- Use code snippets or pseudocode for complex algorithms rather than lengthy prose.
Common Mistakes
- Writing an LLD for simple CRUD operations that do not need one.
- Not keeping the LLD in sync with the actual implementation.
- Omitting error handling and edge case behaviour.
- Making the LLD so prescriptive that developers have no room for engineering judgement.
- Not including data migration or backward compatibility considerations.
Government Context
In UK government, LLDs are particularly important for security-sensitive components handling OFFICIAL-SENSITIVE or above data. They support security accreditation by demonstrating that security controls are designed into the component level. For shared services used across departments, LLDs help onboard new development teams.