Best practice store email unique MySQL and Validate JS

You can restrict emails to being unique only if not deleted with a virtual column:

create table user (
    email varchar(320),
    deleted tinyint,
    undeleted_email varchar(320) as (if(deleted,null,email)) unique
);

fiddle


You could reverse the logic and instead of storing a nullable deletion mark, store an active mark. Use a check constraint (in MySQL 8+) or a trigger (in lower MySQL versions which don't enforce check constraints) to restrict the possible values of the active mark to one (non-NULL) value (and NULL). Then put the unique constraint on the e-mail address and the active mark combined. That way you can have multiple rows with the same e-mail address and a NULL active mark but maximally one with that address and a non-NULL active mark.

CREATE TABLE user
             (id integer,
              email varchar(256),
              active tinyint,
              PRIMARY KEY (id),
              CHECK (active = 1),
              UNIQUE (email,
                      active));

db<>fiddle

But as a non technical side note, check, if you're legally allowed to keep the history of a user when they delete their account according to the data protection laws applying to you. They may have the right to expect that everything is deleted when they delete their account.

And you could also consider, no to create a new account, if a user comes back, but instead offer them to reactivate their old account.