Here's the basic code for it with the same particles attracting and different particles repelling.
wackytoaster.at/parachute/particleslifesimulation.c3p
I do want to point out though that this is computationally really bad, the performance is terrible. It will probably be ok if you just wanna play around with a few hundred particles at most, play around a bit. I've done similar projects like that before and just kept it within the limitations.
If you really wanna go ham:
1. You'd want to get rid of box2D and instead use your own calculations for the particles. They won't need a lot for that, probably just a movement vector and radius. That would get rid of the extra bloat that box2D adds that doesn't matter for this simulation.
2. You will still be limited very quickly by how fast CPUs and javascript are, generally. If you really wanna do this at any greater scale, you'll have to do the same thing as the guy in the video, which is to do the calculations on the GPU instead. This is possible with webGPU but will require javascript and webGPU knowledge. Maybe you can get by with some library like turbo.js.org but I have not tested it at all.
Good luck.