There are two common types of bankruptcy: Chapter 7 and 13. Depending on the type you had, you can have different “seasoning periods” on a mortgage program you find after the bankruptcy.
In case of a Chapter 7, your seasoning period begins from the moment of the action discharged. You will need to wait for 4 years to apply for conventional loans and for 2 years for VA or FHA mortgages. Sometimes you can even qualify for better terms, if you perform good financial management during these years.
After a Chapter 13 you may get even better conditions. A conventional loan is available after 2 years, while conditions of FHA or VA mortgages even earlier.
You can apply for such government-backed mortgages just after a year after filing a Chapter 13 bankruptcy. You will be required to confirm your regular on-time payments during at least 12 successive months. You will also need court permission for obtaining new loans.