A little backstory, then update.

Unknown to me at the time, boss had independently made a widget that was responsible for a sizable portion of the profit for this company. He was in the process of selling the widget to the company.

I was hired during a company expansion as a domain expert for a new product category in which they were developing. I was placed initially under boss to learn the company ropes.

There were a few odd things about the job, I was frequently not invited to team/company functions, outings, lunches, nor meetings. Being told by my boss that I needed to earn the right to go to these things, and I hadn't earned it yet, or that the meetings didn't concern me. The boss assigned me work on his widget, and generally left me alone. My desk wasn't in the same area as the rest of the team. I was put in new office space with the other people that started when I did. Even after space with my team opened up I was required to work in the temp area. I had to provide my own laptop and lamp for the first month while employed as the company as they hadn't procured me one. Yes, lamp, I didn't have overhead lighting in my area, as they planned to put in a skylight, it never materialized. Instead of moving on to the development phase of the task I was hired to do, I ended up taking support tasks, like calls, emails, writing docs, etc. (I chalked it up to needing to learn the system, but I was being paid triple what they were paying help desk staff) Also wasn't given write access to their code repository, I had to submit patches to my boss.

When I was let go, the owner and vp over boss brought up how they thought I wasn't a team player as I wasn't attending any company events. I needed to get my external affairs in order because I kept having outside engagements keeping me from work. Dumbfounded by these accusations I showed them I'd come to work everyday, attended every meeting I'd been invited and explained I often felt left out when the team got to go to outside events (from stuff like ice cream to pro ball games). After showing all my emails and schedule it came to light that my boss was never inviting me to these events and was giving them made up excuses for me.

As for the code, it was bad. Broken in very fundamental ways. I gave the code a fair eval during my exit. Explained how it's design flaws wouldn't allow them to expand the widget much beyond it's current abilities and showed how it was incompatible with their long term road map.

In the end I had no leverage, so I wasn't retained.

--- The update. ---

6 months after of my departure, a third of the company was gone. Everybody that was part of the expansion had left or was fired, and several other people took better jobs elsewhere.

Eventually they hired a few new developers to take over the widget. After a couple of years, a new version was released with new code base, but it was now late to the market and better products replaced it.

The owner eventually bought out the widget from my boss in order to sell the company, many years after I left. The majority of the staff at that point transitioned with the notable exception of my boss. He retired, I think he fishes now.

As for me, well, I had a couple of rough years there were I wasn't getting hired. Thought it was bad luck, but through some chance encounters I've came to learn that someone was spreading some bad info about me. I got some counseling, which helped.

As for why the retaliation, I think it was because my boss lost leverage and money over the widget deal. I learned from a former coworker that my boss had been planning an exit from the company as soon as the widget deal finalized, which was supposed to happen right after I started, not years later. I think he knew his program couldn't meet the roadmap he was selling the company and was hoping to make it someone else's problem.