  In this paper, we study the existence, regularity, and approximation of the
solution for a class of nonlinear fractional differential equations. {In order
to do this}, suitable variational formulations are defined for a nonlinear
boundary value problems with Riemann-Liouville and Caputo fractional
derivatives together with the homogeneous Dirichlet condition. We {investigate}
the well-posedness and also the regularity of the corresponding weak solutions.
Then, we develop a Galerkin finite element approach {\color{blue}for} the
numerical approximation of the weak formulations and {drive a priori error
estimates and prove the stability of the schemes}. Finally, some numerical
experiments are provided to {demonstrate} the accuracy of the proposed method.
