maybe the electrical wires or the ignition coils or the crankshaft/camshaft sensors or in worst case the ECU itself has issues, I had similar problem, my car was cranking but it failed to start, I looked down under the car to find a broken belt coming from under the hood, it was later revealed that the snapped belt broke the bracket which holds the crankshaft sensor in place for proper operation, so the car failed to start
Did it stopped working suddenly while you were driving it, or you found that issue before driving the car at all ?