In a large pot over medium heat, add the ground beef or sausage. Cook until browned, breaking it up with a wooden spoon, about 5-7 minutes. Drain any excess fat.
Add the chopped onion and minced garlic to the pot. Sauté for about 3-4 minutes until the onion becomes translucent.
Stir in the crushed tomatoes, broth, dried Italian herbs, and red pepper flakes (if using). Season with salt and pepper. Bring to a simmer and cook for 15 minutes to allow the flavors to meld.
Add the gluten-free pasta to the soup and cook according to the package instructions, usually about 8-10 minutes, until al dente.
Stir in the ricotta cheese until well combined.
Once the pasta is cooked, remove the pot from the heat. Finally, sprinkle the shredded mozzarella and grated Parmesan cheese on top. Allow it to sit for a few minutes, covered, until the cheese melts.
Serve hot, garnished with fresh basil if desired.