The independent cafe/coffee shop where I live which does well also does lunches but has been going for a good 20 years and is in a prime location, just next to the Sainsburys and in a small row of shops. I mentioned to the owner the other day what time did they open, he said 7.30am weekdays. The owners are always friendly which counts for a lot.
The other small American diner/cafe has been going at least since late 80s, has undergone family bereavement but seems to make enough for it to be a family business, over/after lockdown they changed to be an American diner which was a good move.
The chain of coffee shops, Brown and Green, started when artisan cafes were just becoming trendy, at least in our part of the world. They used to make special elaborate cupcakes for Red Nose Day, pakoras, soup, croissant/sandwich/coffee offer plus fruit which was sold at their first proper cafe at a station.
Then they opened a proper sit down cafe but aimed it at professionals as well as at families with children, so targetting both markets. The food has always been consistently good. Over lockdown they delivered food and had 'recipe boxes', and they had a huge cafe in a local big park where you can hire out the venue. The most important is that their food and drink is not ridiculously overpriced like some cafes are (£4 for a bog standard croissant which looks like it came from Sainsburys?!).
A new venue opened near us recently but is a cafe/bar combo, they started off by offering savoury muffins and cakes but when we next visited there was none of that and no decaff option which was a pity.
The thing which I'll say and which seems to matter, if you're in an area with lots of cafes/coffee shops and therefore lots of footfall, you can survive but if you make a mistake, e.g. with food or drink being consistently bad then you won't go there. One of the venues I mentioned in my PP, my DB went there recently, got takeaway coffees for him and his DW plus biscuit/cake things but both of them said the coffees were undrinkable, they were driving so it's not like they could go back. I was reminded of one time I went there though, dashed in, got a tea in a hurry and came outside (I'd asked for milk to be in it) and they hadn't put milk in at all! Black tea, yuck!
For me a lot these days, I'll go to Greggs or Waitrose or somewhere with cheap tea/coffee when I'm out though I do go to independent/chain coffee shops too. One local Costa I visited recently when out, the man almost spat at me, he was so rude. I won't be returning there.