Cook the ziti pasta according to package instructions until al dente. Drain and set aside.
In a skillet over medium heat, brown the ground beef or sausage with the diced onion until the meat is fully cooked. Add the minced garlic and cook for an additional minute. Drain any excess fat.
In a large bowl, combine the cooked meat mixture, marinara sauce, ricotta cheese, Italian seasoning, salt, black pepper, and red pepper flakes. Stir until well combined.
In the slow cooker, layer half of the cooked ziti, followed by half of the meat sauce mixture. Sprinkle half of the mozzarella cheese on top. Repeat the layers with the remaining ziti, meat sauce, and mozzarella cheese.
Cover and cook on low for 4 to 6 hours, or until the cheese is melted and bubbly.
Before serving, sprinkle the baked ziti with grated Parmesan cheese and garnish with fresh basil if desired.