Maybe it's useful to add some general perspective to the efficient answer given. The approach taken by modp is undoubtedly the most natural one, taking advantage of the extra assumption that $W$ has dimension equal to $|G|$. This assumption is essential, since without it a $k[G]$-module may well have a space of covariants of higher dimension when the space of invariants is 1-dimensional. (Concrete examples occur when you consider restrictions to a Sylow $p$-subgroup in a finite group of Lie type of various standard modules.)
It's a standard fact that any finite $p$-group has only the trivial simple module over a field of characteristic $p$ (unlike the radically more complicated situation in characteristic 0). In particular, any module with a 1-dimensional subspace of invariants is automatically indecomposable. Though the indecomposable $k[G]$-modules can be arbitrarily difficult to study in general, the special assumption that $\dim_k W = |G| = \dim_k k[G]$ then yields an isomorphic embedding of $W$ onto $k[G]$. But for: For any finite group the group algebra over a field is both injective and projective as a left module. In the special case of a $p$-group, the group algebra is itself the projective cover (= injective hull) of the unique simple module. In particular, the socle (here the space of all invariants) is isomorphic to the head (here the space of all coinvariants). Indeed, the module $W$ is self-dual.