To resurect a mac mini g4 circa 2005 with a failed harddrive and a failed optical drive and no original disc here is what you do. For the Hard drive you would need to put a working hard drive into it following disassembly guides found everywhere, it probably won't be formatted correctly, its ok. The replacement hard drive would need to be a 2.5" drive with an ATA connection, any size. You can skip replacing the optical drive for $40. You will need to obtain the correct OSX install disc and/or disc image (.toast or .iso). You will also need to have another mac with a working optical disc drive and a firewire cable.
If like me you probably lost your install disc 5 years ago that is a problem, you need a disc/image. The PPC mac minis cant boot from usb so that means no install from flash drive, and you cant boot from any disc because optical drive was gone. That leaves Target Disc Mode or purchasing that optical drive for about $40.
To get OSX:
-If you don't know what OSX version you need go to www.everymac.com and look for minimum and maximum osx versions you could install, any in those ranges given on the site will work and you need to obtain one. The hardware you own is the license key and OSX was paid for when it was bought at a store in 2005. To obtain OSX Leopard you need to buy, borrow, or download the torrent.
You usually need the "retail version" that comes with a plethora of drivers. Borrowing a disc from a friend is sometimes bad since it isn't a "retail version" and will only contain drivers for that specific model of your friends. Buying a disc will suck because Apple doesnt sell retail Leopard anymore and the only way to buy an original unopened disc is on ebay for $200 since the unopened discs are rare, and yes the mac mini isn't worth that much. That leaves downloading, look for the "retail version" that you looked up.
With the OSX image, burn it to a DVD on any computer whether mac or pc, if on a pc change extension to .iso (must have non hidden extension types) and download IMGBURN, which is freeware. To utilize "target disc mode", turn on the borrowed fully functioning mac WHILE holding the "T" on the keyboard. Once booted to the gray screen with the large firewire symbol, put in your newly burned disc with OSX installer. Then connect the two macs with the firewire cable. Now turn on the destination mac (with new harddrive in it) WHILE holding the "option" key or "ALT" key. The taget disc mode essentially allows the broken mac to borrow the optical disc of the working mac as if it were internal. The screen should pop up with the install disc listed as an option and click the arrow, if the ?Folder pops up you did it wrong, hold atl, or maybe its "c".
Once at the install screen dont click anything because only the external drives on the working mac will be selectable, notice at the very very top there is a menu bar, select disc utility. on the left is every optical and hard drive available both internal and external. Take note not to select the harddrives from the working mac. Select the new harddrive that is internal. Now look for the partition tab. Select 1 partition, from the drop down select Mac Journaled case sensitive, and then partition it. Now you can exit disc utility and go back to the installer and the new harddrive should be selectable. Install as normal. Again dont install on the working computers harddrive. Follow setup and enjoy your resurected mac mini.
If so inclined you could remove the broken optical drive and put a second 2.5" drive, it would need to be pata to fit on the cd drives cabling.