What is the difference between a bildungsroman and a roman a clef?

A bildungsroman (in German, it means “education novel”) deals with the formation of a young person and includes common coming-of-age stories.

James Joyce’s Portrait of the Artist as a Young Man (1916) is an example.

A roman a clef (in French, it means a “novel with a key”) contains one or more characters or situations based on real-life models.

Theodore Dreiser’s American Tragedy (1925), based on a 1906 murder in the Adirondacks, is an example.