Slice garlic and shallots thinly. Chop green onions into small pieces. Set aside.
In a small bowl, mix together thin soy sauce, kecap manis, oyster sauce, and sesame oil to make stir fry sauce. Set aside.
Remove tofu from packaging. Carefully press down on tofu with paper towels to remove excess liquid from tofu. Cut tofu into small bite sized squares. Use paper towels to once again remove excess liquid from cut tofu.
Place cut and dried tofu into a large gallon sized ziplock bag. Add in cornstarch and mix everything together. Make sure all sides of tofu are coated by the cornstarch.
Add 1/2 cup (or more) of oil to a large frying pan. Heat oil using medium to high heat. Once oil is hot, add in tofu in small batches. Be sure to not overcrowd your pan. Fry one side for 2 minutes and flip to other side. Fry for another 2 minutes and continue to flip every couple of minutes until all sides of the tofu are golden brown. Total frying time should be about 6-8 minutes. Once tofu is golden brown, remove from hot oil and let tofu cool on top of paper towels.
Remove excess oil from frying pan and leave only about 2 tablespoons of oil in pan. Using medium heat, add in shallots and garlic. Cook shallots and garlic for 2-3 minutes or until golden and fragrant. Turn down the heat if shallots and garlic begin to burn.
Add in sauce mixture to pan and mix everything together.
Add in tofu and optional Thai chilis.
Add 1/3 cup of water and green onions. Cook for another 2-3 minutes or until sauce has thickened. Serve immediately over a bowl of rice.