We propose a flexible model of infectious dynamics with a single endogenous state variable and economic choices. We characterize equilibrium, optimal outcomes, static and dynamic externalities, and prove the following: (i) A lockdown generically is followed by policies to stimulate activity. (ii) Re-infection risk lowers the activity level chosen by the government early on and, for small static externalities, implies too cautious equilibrium steady-state activity. (iii) When a cure arrives deterministically, optimal policy is dis-continous, featuring a light/strict lockdown when the arrival date exceeds/falls short of a specific value. Calibrated to the ongoing COVID-19 pandemic the baseline model and a battery of robustness checks and extensions imply (iv) lockdowns for 3-4 months, with activity reductions by 25-40 percent, and (v) substantial welfare gains from optimal policy unless the government lacks instruments to stimulate activity after a lockdown.