  We define and study the stack ${\mathcal U}^{ns,a}_{g,g}$ of (possibly
singular) projective curves of arithmetic genus g with g smooth marked points
forming an ample non-special divisor. We define an explicit closed embedding of
a natural ${\mathbb G}_m^g$-torsor over ${\mathcal U}^{ns,a}_{g,g}$ into an
affine space and give explicit equations of the universal curve (away from
characteristics 2 and 3). This construction can be viewed as a generalization
of the Weierstrass cubic and the j-invariant of an elliptic curve to the case
g>1. Our main result is that in characteristics different from 2 and 3 our
moduli space of non-special curves is isomorphic to the moduli space of minimal
A-infinity structures on a certain finite-dimensional graded associative
algebra $E_g$ (introduced in arXiv:1208.6332). We show how to compute
explicitly the A-infinity structure associated with a curve $(C,p_1,...,p_g)$
in terms of certain canonical generators of the algebra of functions on
$C-\{p_1,...,p_g\}$ and canonical formal parameters at the marked points. We
study the GIT quotients associated with our representation of ${\mathcal
U}^{ns,a}_{g,g}$ as the quotient of an affine scheme by ${\mathbb G}_m^g$ and
show that some of the corresponding stack quotients give modular
compactifications of ${\mathcal M}_{g,g}$ in the sense of arXiv:0902.3690. We
also consider an analogous picture for curves of arithmetic genus 0 with n
marked points which gives a new presentation of the moduli space of
$\psi$-stable curves (also known as Boggi-stable curves) and its interpretation
in terms of $A_\infty$-structures.
