and how to do it via node js ?
For SPF
you need a DNS record at the domain that you use as senders domain when sending e-mails. The content of this record contains the IP-number of your SMTP server. This will allow for example G-mail to see that the owner of your domain has authorised your SMPT-server to send e-mails "on the domain owners behalf".
For DKIM
you need a DNS record (same domain as above) that contains a public key of typically a rsa-sha256 key pair. You then setup your SMTP server to sign all outgoing e-mails using the private key in that pair. This will allow G-mail (among other things) to see that your domain has sent this e-mail, because no one else has the private key and could thus not have signed your e-mail.
For DMARC
you need a DNS record (same domain as above) that tells all other mail servers what to do with e-mails that does not align with your SPF or your DKIM settings. Typically allow or reject.
You can read more details on the DNS format here: [1] SPF: https://postmarkapp.com/guides/spf [2] DKIM: https://postmarkapp.com/guides/dkim [3] DMARK: https://postmarkapp.com/guides/dmarc [4] Verify your setup: https://www.learndmarc.com/