This article introduces digisprudence, a theory about the legitimacy of software that both conceptualises regulative code’s potential illegitimacies and suggests concrete ways to ameliorate them. First it develops the notion of computational legalism – code’s ruleishness, opacity, immediacy, immutability, pervasiveness, and private production – before sketching how it is that code regulates, according to design theory and the philosophy of technology. These ideas are synthesised into a framework of digisprudential affordances, which are translations of legitimacy requirements, derived from legal philosophy, into the conceptual language of design. The ex ante focus on code’s production is pivotal, in turn suggesting a guiding ‘constitutional’ role for design processes. The article includes a case study on blockchain applications and concludes by setting out some avenues for future work.