let's dissect the energy of a coworking space, because it's not all good.
some of this -- no surprise -- is reproducable at a cafe. but what does a cafe have, that you don't?
i've spent years working from home as either a 1-man freelancer or 10-person team lead. in each role i've experimented with various setups to accommodate the energy i need to get the job done. here's what worked for me in my NYC loft(s) from 2013-2019.
first, i had persistent background noise from all the taxis outside. there was a window by my desk, facing 3rd avenue traffic. i owned a large "coffee" scented candle that i could light for just 10 minutes and get hours of aroma. and if i was working on low-energy tasks i played Soundcloud mixes directly through my iMac speakers, instead of headphones.
for snacks -- akin to the coworking space kitchen vibe -- i bought boxes of Quest protein bars (chocolate chip cookie dough) and frequently went to a cafe nearby for cold brew to-go. i've had several WeWork and indie coworking space memberships and getting OUT of the office every few hours for a coffee was key to refueling my motivation.
if i started to slack on a given project i would switch from my desk (typical roller computer chair) to the couch and work from my laptop, or read a book. my bookshelf was directly adjacent to my desk / couch / television. all my code and files are in Dropbox or Drive so switching devices mid task is not a chore.
in the evening when it gets dark, 30-watt lightbulbs at home don't compare to high-energy flourescents at most offices. but i mitigated this by working on different types of tasks at night. for example, headphones in and coding with decaf coffee, vs headphones out and emailing during the day.
speaking of night and day, you need a routine that clearly dilleniates the segments of your working time. even though i've not had a boss or office for years, i still set an alarm for 8:15am. after waking up i'd dress properly (casual but no pajamas) and go directly to a cafe. sometimes i would read a book there before returning home to begin work. setting a schedule like this gives you a clear sense of direction, e.g. "in the morning i'll accomplish X, and after lunch i'll do Y." i also think there is a shared "let's get it" energy in the morning when a million people on the island are grabbing a coffee and preparing for battle.
the final piece of the puzzle is other people. only 1 of my team members lives in NYC so we'd meet at my apartment 2-3x per month, usually on Wednesdays when our remote team has a video call standup. first we'd have breakfast at a dinner around 8 or 9a, then do the team meeting, then sit at my kitchen table (him) and desk (me) for the rest of the day, getting lunch together as well.