How do I set a content entity field as required?
You need to use the ->setRequired(TRUE) option on the field. IE

$fields['source_id'] = BaseFieldDefinition::create('entity_reference')
      -&gt;setLabel(t('Thingy'))
      -&gt;setDescription(t('Pick a thingy'))
      -&gt;setSetting('target_type','thingy')
      -&gt;setRequired(TRUE)
      -&gt;setDisplayOptions('form', array(
        'type' =&gt; 'options_select',
        'weight' =&gt; 5,
      ))
      -&gt;setDisplayConfigurable('form', TRUE);


You will also need to uninstall and then reinstall your module to have the change reflected in the database before this will work.