Heat the olive oil in a large pot or Dutch oven over medium heat.
Add the diced onion and sauté for about 3-4 minutes, or until translucent.
Stir in the minced garlic and cook for an additional 1-2 minutes until fragrant.
Add the ground beef or sausage to the pot, breaking it up with a wooden spoon. Cook until browned and no longer pink, about 5-7 minutes.
Stir in the crushed tomatoes, chicken or vegetable broth, oregano, basil, and red pepper flakes (if using). Season with salt and pepper to taste. Bring the mixture to a simmer.
Add the gluten-free pasta to the pot and cook according to the package instructions, usually about 8-10 minutes, until al dente.
In the last 2 minutes of cooking the pasta, add the fresh spinach to the soup and stir to wilt it.
Once the pasta is cooked, remove the pot from heat. Stir in the ricotta cheese until well combined.
Ladle the soup into bowls and top with shredded mozzarella cheese. If desired, garnish with fresh basil leaves.