Gigafactories are being built, exciting Tesla car models are on the pipeline, and profits have been on the rise for consecutive quarters - it should be easy to see that all is well with the automaker. Indeed, it is but according to Elon Musk, the company went through hell a few years back and teetered to near bankruptcy.

The Tesla CEO revealed the problem that hounded the company between 2017 and 2019 while in the middle of ramping up the Model 3 production. Musk described the period as "extreme stress and pain," that went on for a long stretch.

He added that it was a "production and logistic hell," and that Tesla was just a month away from collapsing. Musk admitted that the EV maker struggled with the likelihood of bankruptcy but he stopped short of sharing some details.

CNBC said Musk was responding to a question on Twitter on the issue of bankruptcy and the company chief recalled that Tesla's financial struggles at one point nearly led to its demise. It was a "hell" of an experience but it seemed that for the automaker, the focus now is to take advantage of its exploding growth.

Sales have been increasing and Tesla's latest earnings report pointed to ballooning profits in the last five quarters, which belied the scenario painted by Musk that as recent as last year, the company would have imploded.

Back in 2019, the Model 3 reached a maximum production level of around 60,000 units but Musk was able to raise billions in fresh investment injections and it appears that Tesla is zooming all the way up. The Gigafactory in Shanghai is now operational and versions in Berlin and Austin will be online soon.

Musk's plan is to accelerate production and roll out at least 250,000 units per year. The Model 3 will soon be joined by the Model Y crossover, the Cybertruck, the Semi, and the Roadster. Things are looking up for Tesla that it seemed hard to imagine that the company at one time had to deal and fend off bankruptcy.

Moving forward, Tesla is gearing up to realize its ambitious goals. Over the next two years, the company's capital expenditures will reach $12 billion for the production facilities in Germany and Texas to start assembling EVs in large numbers, per the report by CNET.

The targets set by Musk for the automaker could be described as a moonshot but the CEO knows there is no way to but up. Tesla still needs to do away with existing handicaps that could slow down growth and it appears that the best solution seen by Musk is to flourish at an accelerated pace.