We introduce the concepts of generalized compatible and cocompatible bimodules in order to characterize Gorenstein projective, injective and flat modules over trivial ring extensions. Let R⋉M be a trivial extension of a ring R by an R-R-bimodule M
Nearby in the stack
such that
M
is a generalized compatible
R
-
R
-bimodule and
Z(R)
is a generalized compatible
R⋉M
-
R⋉M
-bimodule. We prove that
(X,α)
is a Gorenstein projective left
R⋉M
-module if and only if the sequence
M⊗RM⊗RX→M⊗αM⊗RX→αX
is exact and coker
(α)
is a Gorenstein projective left
R
-module. Analogously, we explicitly characterize Gorenstein injective and flat modules over trivial ring extensions. As an application, we describe Gorenstein projective, injective and flat modules over Morita context rings with zero bimodule homomorphisms.