I'm currently working as a web developer in the DC area. About two months ago I interviewed with a well respected company (company A) after a good friend of mine referred me internally. After a rather vigorous interview process I was told that they really liked me and wanted to bring me on board, but unfortunately the government awarded the job I had interviewed for to another company. They said they would try to find other positions for me in the future but to obviously continue my job search elsewhere if I desired.
A few weeks later my current company began a large series of layoffs so like anyone else I began interviewing at several other firms trying to avoid an employment gap. After a few weeks a very large and respected company (company B) reached out to me with an offer letter, stating that I had 5 days to either accept or decline. After thinking it over for a few days and waiting to see if anything else would come through I hesitantly accepted with a start date in three weeks, knowing that having this company on my resume would lead to many good opportunities in the future. Although I was disappointed with the salary they offered and technology they want me to work with (java) I felt that at the very least I had to avoid being unemployed.
As luck would have it, less than a week later company A reached back out to me with a substantially better offer (over a third more money) in a position that directly aligns with my skills and chosen career path (front end dev with React.js). This offer has already been formally approved by the government so no problems there. As an added bonus company A will require a considerably shorter commute through the horrors of DC traffic.
If I had not already accepted company B's offer I would be madly excited about this opportunity as my friend has had a great experience there for almost 5 years and the technologies their using are exactly where I want my career to go. Also, over 30k a year more with equal benefits is quite substantial.
I know very similar questions have been asked previously, but I feel this is different enough in that I did not seek out other opportunities after accepting company B's offer, in fact I turned down many requests from IT recruiters and even contacted my friend to make sure he hadn't heard of anything coming through with company A. I'm aware that rescinding my acceptance with company B could certainly burn any bridges with them and possibly hurt my reputation as a whole. For the sake of professionalism and etiquette I'm inclined to keep my word and continue on with company B, however I feel I will quickly regret that decision and look to move on anyway after a relatively short time and it's clearly better to just move on now before they invest considerable recourses getting me up to speed. How bad is it ethically or professionally to move on? Any help is greatly appreciated!