Constraint: A restriction a solution must satisfy, e.g. "x + y = 10" or "no two employees share a shift". A constraint is a rule that any valid solution must satisfy. "Each employee works at most five shifts a week" and "two meetings may not overlap in the same room" are constraints.
The term shows up in two places developers meet often. In constraint programming, you describe the rules and let a solver find solutions. In databases, constraints such as NOT NULL, UNIQUE, foreign keys and CHECK enforce rules on the data itself.
What should you keep in mind with Constraint?
Database constraints are worth using even when your application already validates input. Validation can be skipped by a bug, a script or a direct database change. A unique constraint on an email column guarantees there are no duplicates, however the data arrives. It is the last line of defence for data you cannot afford to get wrong.
Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.