The structural formula of cocaine is;

                CH3
               /
              O
               \
                C=O
               /
    CH2--CH--CH   
   /    /      \    
CH2    N-CH3    CH-O
   \  /        /    \
    CH2 ------CH2    C=O
                    /
                   Ph


Ph represents phenyl group

It is possible to synthesise cocaine by a variety of routes, but all of these are either very difficult if they start without the tropinone ring, or use precursors that are unobtainable, expensive, or dangerous (eg. atropine)