Pretty simple question:
Is there a safe way to train for the front and back flip without killing myself?
The biggest mistake people make when learning to flip, is that they try to flip into pools and onto mattresses.
This is a mistake because it doesn't prepare you for the inevitable challenge of having to spot your landing. And it takes away the need to really cushion the landing with your legs. And this needs to be practiced.
Trampolines is a pretty good way to practice in the beginning. It teaches you to commit to the flip and spot your landing early. For instance, when you backflip, the very first thing we have in mind, is to rotate enough to see the ground again. From there, you spot the landing, and the rest of the movement is based on tucking (which increases rotation) and straightening out again (which decreases rotation), so that you land nicely, and don't over- or under-rotate.
When you're ready to take this to the next step, it's on the ground. If you have mats, use that. But like I said, don't use mattresses. They're too thick, which makes them harder to jump off of. And if you try to flip onto one from the ground, you're jumping onto higher ground, which is also obviously harder.
The best bet is to get a spotter. They will have one hand behind your knee, and one arm on your lower back. When you jump, you'll rotate around their arm, and they'll give you extra momentum by lifting your legs.
Keep in mind, this is entirely the flipper's movement. Everything the spotter does is assistance work. If you do something a little bit wrong, no worries, they'll save you. If you have fundamental flaws in your technique, they'll notice. It's pretty easy to see what goes wrong.
The more you practice this, the less your spotter will need to do. It should come pretty naturally, as you should easily feel yourself relying less and less on the spotter.
This video shows some nice progression steps.