Definitions that generalize in algebraic contexts Apologies in advance: this is not a precise question.
A basis $B$ for a vector space $V$ can be characterized by the property that every function $f:B \to V'$ can be uniquely extended to a linear map $f^*: V \to V'$. This notion is sufficiently abstract that it generalizes to other areas of algebra, where we can talk about mathematical objects that are freely generated by a set.
I was wondering if there are other properties of basis elements that generalize in a straightforward way like this. 
For example, here is another definition of a basis: every vector in $V$ can be expressed as a unique linear combination of basis elements. This seems to generalize: for example if $B$ is the Boolean algebra generated by $X$ then every element of $B$ is given by a unique Boolean combination of members of $X$. But what's the correct generalization of linear/Boolean combination? A function $f:A^n\to A$ which commutes with every homomorphism $h:A\to A$ (where $n=|X|$)? 
Second question: is it possible generalize the usual definition linear independence, i.e. if $a_1v_1+...+a_nv_n =0$ $a_i=0$ for $i=1..n$? What would this mean, for example, in a freely generated Boolean algebra? (Of course there's the property of being a subset of a generating set, but I'm looking for generalizable properties that stay close to the original definitions.)
 A: One answer to your first question is given by Definition 2.1 in Bart Jacobs' Bases as Coalgebras. The key point is that for any monad $T$ on a category $\mathbf C$, choosing a basis for a $T$-algebra $A$ is the same data as giving $A$ the structure of a $\overline T$-coalgebra where $\overline T$ is the induced comonad on the category $Alg(T)$ of $T$-algebras. 
In more down-to earth terms, if you have a model $A$ of an algebraic theory, take $TA$ to be the free model generated by the underlying set of $A$. You have a natural map $A\xrightarrow{\eta_A} TA$ which identifies $A$ as the basis of $TA$ and a natural map $TA\xrightarrow{\epsilon_A}A$ which identifies the model structure on the set $A$. Every choice of basis for $A$ determines a homomorphism $A\xrightarrow{b} TA$ subject to $\overline{T}$-coalgebra axioms


*

*$\epsilon_A\circ b=\mathrm{id}_A$;

*$Tb\circ b=T\eta_A\circ b$


Then the set of basis elements $B\subseteq A$ can be recovered as the equalizer $B\hookrightarrow A\overset {b\underset{\eta_A}\rightrightarrows}TA$ in the category of sets.
For example, if $V$ is a $\Bbbk$-vector space, $TV=\{\sum_{i=1}^nr_iv_i\}$ is the set of formal finite linear combinations of elements of $V$ (better: finitely supported functions $V\to\Bbbk$). It has a natural structure as a vector space (that's what $T$ being a monad amounts to), and the natural linear map $V\to TV$ is given by $v\mapsto 1\cdot v$.
Now a basis $b_i\in V$ for $V$ also determines such a linear map $V\xrightarrow{b} TV$ sending $v\mapsto\sum\phi_i(v)b_i$, where the latter is the formal linear combination of $b_i$'s that gives $v$. Conversely, if you just have such a linear map $V\xrightarrow{b} TV$, to be a basis you need to satisfy two conditions:


*

*$v=\sum\phi_i(v)v_i$, i.e. the obvious composite $V\xrightarrow{b} TV\xrightarrow{\epsilon_V} V$ is the identity.

*The formal linear combination $\sum\phi_i(v)(1\cdot v_i)\in TTV$ is the same as $\sum\phi_i(v)(\sum\phi_{i_j}(v_i)v_j)$, i.e. the less obvious composite $V\xrightarrow{b} TV\xrightarrow{Tb} TTV$ is equal to the less obvious composite $V\xrightarrow{b}TV\xrightarrow{T\eta_V}TTV$.
It is clear that basis elements are precisely those for which $\phi_i(b)=1$ when $v_i=b$ and is $0$ otherwise, i.e. for which we have an equality of formal linear combinations $\sum\phi_i(b)v_i=1\cdot b$.

If dealing with $R$-modules, there exists a linear maps $M\to TM$, i.e. from an  $R$- module $M$ to finite linear combinations of elements of $M$, that satisfies condition 1. of being a coalgebra if and only if the $R$-module $M$ is projective. In other words, an $R$-module $M$ is projective exactly when some (equiv. every) generating set $m_i$ admits $R$-linear functions $M\xrightarrow{\phi_i}R$ so that $m=\sum\phi_i(m)m_i$.
So perhaps your second question of linear independence of the generating set is also captured by property 2 of being a coalgebra.
