Viviani started his career at A.S. Roma. He was given his first team debut by Roma coach Luis Enrique in the 2011–12 UEFA Europa League play-off round against Slovan Bratislava in August 2011. On 12 December 2011, at age 19, he made his debut in Serie A in the 1–1 draw against Juventus, in which he started. He played 9 games in all competitions his first season, mostly coming on as a substitute. On 22 March 2012, Viviani captained the Roma Primavera side which won the Tim Cup after a 2–1 aggregate win against Juventus in a two legged final. After coming through the youth system, Viviani signed a 5-year contract in May 2012.
Serie B loan
He was loaned to Padova for the 2012–13 season where he scored two goals in 22 matches. He made his debut with the 18 August game against Atalanta. On 25 September, Viviani scored his first goals of his career, scoring both goals in a 2–0 win against Empoli. On 1 July 2013, Viviani joined Pescara on loan, again in Serie B. He made his debut 14 September in the next away game against Varese, scoring on his debut, scoring with a freekick in a 3–2 loss. On 24 September, Viviani scored his second goal for by scoring a freekick against Avellino in a 1–1 draw. In January 2014, Viviani was recalled by A.S. Roma as part of the transfer deal which saw Gianluca Caprari join Pescara, on the same day Viviani was loaned back out, this time to fellow Serie B side Latina. He was given the number 7 shirt. On 28 February, Viviani scored his first goal for Latina in a 3–0 victory against his old side Padova with a long range shot. Viviani scored a freekick against Novara on 12 April in a 4–1 victory. On 10 May, Vivani scored a freekick in a 2–0 victory for Latina over Ternana. He was integral to helping Latina to a 3rd-place finish, guiding them in the Serie B playoffs, Latina got to the final but lost out promotion to Serie A to A.C. Cesena after losing the two legged final 4–2 on aggregate. After returning to A.S. Roma, on 26 June, Viviani's agent revealed that his future would depend on Roma's plans for the player under manager Rudi Garcia. On 21 July 2014, Roma confirmed that they had let the player discuss terms with Championship side Leeds United, after Leeds made an inquiry about the player four days earlier. The player was also left out of the Roma squad for their pre-season tour. On 22 July 2014, Viviani was set to sign for Leeds United on a season long loan deal, and he was in attendance on that day for Leeds' 2–0 pre-season friendly defeat against Mansfield Town. However, the transfer of Viviani to Leeds dramatically fell through despite the player attending pre season games. After his Leeds move fell through, he re-joined Serie B side Latina.
On 31 August 2016, Viviani joined fellow Serie A side Bologna on a season-long loan deal. On 20 November, he scored his first league goal for Bologna, a free-kick and assisted Mattia Destro's headed goal that put Bologna level, before Blerim Džemaili made it 2–1, followed by Viviani's splendid set-piece which put the game to bed and allowed Bologna to claim a 3–1 home victory over Palermo; ending a six-game winless run for Roberto Donadoni's side.
SPAL
He joined newly promoted Serie A side S.P.A.L. 2013 in the summer of 2017, during his first season he scored 3 times in 27 games as helped keep the club in Serie A and signed a permanent deal with the club in June 2018.
Viviani is a deep-lying playmaker who plays primarily as a 'Regista' in the defensive midfield position; he is also renowned for his ability from free kicks. His style of play has been compared to compatriots Andrea Pirlo and Marco Verratti.