I'm sorry you're going through this. There are many apartments just like this in Massachusetts. That's why there was no lease... Technically, you're a tenant-at-will and that sort of defaults into the 30-day notice category. They do have a right to ask you to leave as long as they give you written advance notice and 30 days. And you have a right to leave on the same terms. It's unfortunate that the apartment is illegal but the truth is that there are many of them and they're the reason the rental crisis isn't as severe as it would otherwise be without them. They keep prices down for the rest of the apartments in the area... If there is an opportunity to make peace with the landlord, it might be something to consider so you can stay. Otherwise, anywhere you move you're likely to pay market rent (probably much higher than what you've got now) and there are no guarantees that everything was done to code.
Alternatively, you can buy a condo... in many areas it is less expensive on a monthly basis and makes more financial sense if you're planning to stay even just a couple of years and have at least 5% for a down payment.
Feel free to email firstname.lastname@example.org... more