Varieties where every algebra is projective? Is it possible to classify all varieties (in the sense of universal algebra) where every algebra is projective?
Several years ago I asked a similar question, with "free" in place of "projective". It turned out it had been answered by Steve Givant in his 1975 thesis, but a variant question I threw in as an afterthought was still open -- to classify all varieties where every finitely-generated algebra is free. Keith Kearnes, Emil Kiss, and Agnes Szendrei were able to give a classification. In both cases (with or without the finite-generation condition in the hypothesis) the answer is the same: the only such varieties are sets, pointed sets, vector spaces over a division ring, and affine spaces over a division ring.
So now I'm feeling a little greedier, and want to relax freeness to projectiveness.  I think that now the "finitely-generated" and "infinitely-generated" cases will diverge. For instance, every finitely-generated Boolean algebra is projective, but not every Boolean algebra is projective. As pointed out by Keith Kearnes below, every finite Boolean algebra is projective except for terminal algebra (the corresponding statement under Stone duality is that every finite set is injective except for the empty set). So it's possible there's no divergence here. On the other hand, if "finitely-generated" is weakened to "finitely-presented", then as observed by Jeremy Rickard in the comments, we start seeing modules over general von Neumann regular rings, so in this direction things do start to change.
There are also at least two notions of projectivity to consider -- projectivity means that an algebra lifts against all epimorphisms, whereas regular-projectivity means that it lifts against all regular epimorphisms (i.e. surjections). As pointed out by Benjamin Steinberg in the comments, it really makes most sense for us to use the regular-projective versions (and there are too many questions on this question anyway) so let's focus exclusively on the "regular-projective" versions of the question:
Question 1': For which varieties is it the case that every algebra is regular-projective?
Question 2': For which varieties is it the case that every finitely-generated algebra is regular-projective?
Question 3: For which rings is the the case that every finitely-generated module is projective?
I'm pretty sure that a ring $R$ has all modules projective if and only if $R$ is a finite product of finite-dimensional matrix algebras over division rings by the Artin-Wedderburn theorem. Projectivity and regular-projectivity coincide in the abelian setting.
So the guess would be that for Question 1, the only varieties are finite products of those varieties where every algebra is free (i.e. of sets, pointed sets, algebras over a division ring, and affine spaces over a division ring) or varieties whose categories of algebras are equivalent to such (although perhaps a syntactic characterization of this condition is nontrivial?). For Question 2 and Question 3 I suspect there might be more interesting examples, which I'd like to hear about even if a classification is out of reach.
Just to be sure we're on the same page (since there are equivalent definitions of "projective" in the abelian case which are inequivalent in general), I say that $P$ is projective if for every epimorphsim $A \twoheadrightarrow B$ and every homomorphism $P \to B$, there exists a map $P \to A$ making the obvious triangle commute. This implies that every epimorphism splits, but I think the converse does not hold. "Regular projective" is the same, but with $A \twoheadrightarrow B$ assumed to be surjective.
 A: Tim asked about varieties where every algebra is free in 2014 on MO.
I wrote a partial answer in 2015. Later in 2015,
Emil Kiss, Agnes Szendrei and I wrote a paper to answer Tim's question.

My email records show that Emil, Agnes and Keith
also discussed the problem
of determining which varieties have the property that every
algebra is projective (or every finitely generated algebra
is projective). We didn't solve it, but made some
inital observations. Let me say that a variety
has ${\bf Proj}$ if all algebras are projective
and has ${\bf Proj}_{f.g.}$ if all finitely generated
algebras are projective.
First, some trivial observations:

* A variety where every algebra is free will have ${\bf Proj}$.
These are 
the variety of sets, the variety of pointed sets, the variety of
vector spaces over a division ring, or the variety of affine
spaces over a division ring.

* A variety of modules has ${\bf Proj}$
iff every cyclic module is projective iff
the associated ring is semisimple. (Jeremy mentions this in the comments.)

* Any variety with ${\bf Proj}_{f.g.}$
has the property that every member
has a singleton subalgebra. (In particular, the variety
of Boolean algebras does NOT have ${\bf Proj}_{f.g}$, 
since the 1-element BA is not projective.)
You probably already see the reason: In the presence of ${\bf Proj}_{f.g.}$,
any surjection onto
the 1-element algebra must have a section.

* The class of varieties with ${\bf Proj}$
is closed under products, matrix powers, definitional equivalence, and localization to the range of an invertible idempotent.
This includes Ben's example,
since the variety of rectangular bands is the product of
two varieties definitionally equivalent to sets.

Here are some slightly less obvious (but still easy)
observations.  Let $\theta$ be a congruence on an algebra $A$
and let $S\leq A$ be a subalgebra. The $\theta$-saturation, $S^{\theta}$,
of $S$ is the union of the $\theta$-classes that intersect $S$.
It is a subalgebra of $A$ and it is the least subalgebra
of $A$ that is a union of $\theta$-classes.
Call $S$ saturated by $\theta$ (or say that
$\theta$ saturates $S$) if $S^{\theta}=S$.
If $\theta$ is a congruence on $A$, then
a subalgebra $S\leq A$ is a complement to $\theta$
if $S^{\theta}=A$ and the restriction of $\theta$
to $S$ is the equality relation.


* A variety $\mathcal V$ has
${\bf Proj}$ (${\bf Proj}_{f.g.}$)
iff every (f.g.) algebra is a retract of a (f.g.) free algebra.

* A variety $\mathcal V$ has
${\bf Proj}$ 
iff the following condition holds:
Whenever $A\in {\mathcal V}$ has a congruence $\theta$,
then $\theta$ has a complementary subalgebra.
(There is a corresponding property for
${\bf Proj}_{f.g.}$. Also, if the condition holds for
free algebras, then it will hold for all algebras.)

*
A locally finite variety $\mathcal V$ has ${\bf Proj}_{f.g}$
if and only if $\mathcal V$ is ``Frattini-free''. That is,
every finite algebra in $\mathcal V$ has trivial Frattini
congruence.
(The Frattini congruence of an algebra $A$ is the join
of all congruences which saturate all maximal subalgebras
of $A$.)

Since the algebras in varieties with ${\bf Proj}_{f.g.}$
have at least one trivial subalgebra,
we decided to examine all examples
of varieties generated by a single, finite, idempotent
strictly simple algebra to see if ${\bf Proj}_{f.g.}$ holds.
($A$ is idempotent if every fundamental operation
satisfies an identity of the form $f(x,x,\ldots,x)\approx x$.
$A$ is strictly simple if it is simple and has
no nontrivial proper subalgebra.)
The results were these: 
If ${\mathcal V} = HSP(A)$, where $A$ is a finite,
idempotent, strictly simple algebra, then $\mathcal V$
has ${\bf Proj}_{f.g.}$ if and only if
$A$ has types 1, 2, or 3
in the sense of tame congruence theory.
(This theory allows five types of local behavior, 1--5.
Type 1 simple algebras
are those that look locally like a $G$-set,
type 2 simple algebras
consists of algebras that look locally like a vector space,
type 3 simple  algebras are those
that look locally like a Boolean algebra,
type 4 simple algebras are those
that look locally like a lattice,
type 5 simple algebras are those
that look locally like a semilattice.)
We examined infinitely many different clones
to determine that the type 1,2, 3 varieties
have ${\bf Proj}_{f.g}$ while the type
4, 5 cases do not. Our results seem to suggest
that ordered algebras are unlikely to have ${\bf Proj}_{f.g.}$.
Here we interpreted locally the following failure of
${\bf Proj}_{f.g.}$ from the variety of distributive lattices.
(The distributive lattice on the right is not projective,
since the map does not have a section.)


EDIT 2-14-21
[From Tim] From what you say, it sounds like you may have found some examples of ${\bf Proj}_{f.g.}$ varieties which are not (or not obviously) products of varieties where all algebras are free -- is that accurate?

Yes, but all examples we found "resembled" modified versions of the variety of sets, a variety of modules or the variety Boolean algebras. The simplest new example that hasn't yet been mentioned is the variety of rectangular bands with an involution. The rectangular band identities are: $x(yz)\approx (xy)z, x^2\approx x$, and $xyz\approx xz$. Add to this variety a unary function $x'$ satisfying $(x')'\approx x$ and $(xy)'\approx y'x'$. The resulting variety is not decomposable into a product of other varieties (since it has a unique simple member up to isomorphism, and products of at least 2 nontrivial varieties have at least 2 simples), however it does have the property that all members are projective. Not all are free. In fact, the variety of rectangular bands with involution is categorically equivalent to the variety of sets (which implies all algebras in this variety are projective), but it is not definitionally equivalent to the the variety of sets (since not all algebras in this variety are free).
A: Here is an example of a variety where every object is regular-projective. I am not sure what you mean by a product of varieties, so I don’t know for sure if it fits into that context but I suspect it does.
First note that an algebra is regular projective if and only if it is a retract of a free object.  This is more or less exactly like the standard argument for modules since regular epimorphisms are pullback stable.
A rectangular band is a semigroup satisfying the identities $x^2=x$ and $xyx=x$.  Every non-empty rectangular band is isomorphic to one for the form $A\times B$ where $A$ and $B$ are sets and the multiplication is of the form $(a,b)(a’,b’)=(a,b’)$.  The free rectangular band on $X$ is $X\times X$ with the above multiplication where $X$ embeds diagonally to get the universal map.  Clearly, if $X$ is of cardinality at least the max of the cardinality of $A,B$, then we can write $A\times B$ as a retract of $X\times X$.
Notice that these are precisely direct products of left zero semigroups with right zero semigroups.  Since either of these kinds of algebras are term equivalent to sets, it wouldn’t be surprising to me if this example is captured by what you mean as a product of examples.  I believe the category of rectangular bands is equivalent to the product of two copies of the category of sets so that is probably what you mean by a product.
