Getting a single page app to be sensibly indexed by Google is not easy.
I think this is the most important point when people are deciding whether they should move their entire frontend layer to the browser in their new projects, and frankly, a lot of guys pushing (or developing) for single-page webapps don't get that.While it is possible to have a mix of client-side routes/pushState/server-side generated template, it's actually non-trivial. So I really don't see a lot of cut and dry separation of layers anytime soon until Google can start indexing sites that fetches data after the HTML structure has arrived.
Big full-stack webapp frameworks are here to stay, tho we might see more webapp frameworks that are great at doing API first to emerge.
Some other points:
- haven't tried Angular testing yet but it has end-to-end testing (and you can swap out your backend services for mocking)
- you can use Celery (uses RabbitMQ/Redis/Mongo/whatever underneath for the broker) for offloading the jobs in Python. Just add a decorator to your work function, makes it really easy (you can also use PiCloud if you need something with more crunching power)
- ElasticSearch docs are still a bit of a minefield. I was already familiar with Solr and Lucene and I struggled with them (ElasticSearch is really nice though)
- Lucene itself is very complicated when you need it to do more for you. ElasticSearch can't protect you from that complexity but there is a mighty engine down there to solve all your searching needs
- Mongo makes dev easy, but I worry about the long term cost when things get complex. I did a job recently and found that my brain struggled to keep the internal Mongo doc structure intact.
- I wouldn't make a single page app if I wanted it indexed by google. I guess there are usecases but I haven't run into them yet.
It's still early days for this stuff and it still has a way to go. We're all going to learn some lessons along the way I'm sure.
Thanks for sharing your code, I'll look at it later when I'm not supposed to be getting a job finished :)
I don't worry too much about that. You can use the repository patten to manage the serialisation and storage of your objects. Given this is something you'd typically do in most backends, I don't think it's a big ask. I do worry about the Mongo scare stories.
> You can use Celery (uses RabbitMQ/Redis/Mongo/whatever underneath for the broker) for offloading the jobs in Python. Just add a decorator to your work function, makes it really easy (you can also use PiCloud if you need something with more crunching power)
I can't remember evaluating Celery, so possibly I overlooked it. Perhaps it didn't work with Python 3 at the time?
I'll have to look into Angular.
[1] http://www.nczonline.net/blog/about/
Do you know if that architecture is compatible with Angularjs' philosophy?
http://www.youtube.com/watch?v=vXjVFPosQHw
(which was also posted by politician) was very useful in explaining the theory. I also made some changes to it, but offhand I can't remember what they were. I think it was to do with the separation of starting vs initialising modules (parts of a page).
Say / responds with the homepage as per usual and /feed responds with a different html start point, but the same application code.
Using this technique you could create a site that responds to multiple urls with html and at the same time creates a SPA experience using a single js application (say, with backbone for example).
What I learned: - Javascript requires a lot of architecture to be sustainable over even medium size apps (I stole N. Zaka's architecture)
- Writing functional tests for Javascript is difficult. (Writing unit tests is easy)
- Most web browsers are nearly there with everything you need for one-page-apps. IE8 is the only real problem, and I think my problems are soluble.
- Python's single threaded nature requires that you make explicit effort to add offline jobs (I added a priority queue using redis)
- Elasticsearch is actually quite complicated once your needs move out of the completely trivial
- Most of the documentation for Elasticsearch assumes a working knowledge of Lucene (which I don't have).
- Mongodb is really really easy to develop against
- Getting a single page app to be sensibly indexed by Google is not easy.
Here's the backend source:
- https://github.com/calpaterson/recall
And the frontend source:
https://github.com/calpaterson/web-recall
And the current deployed version is here:
https://recall.calpaterson.com/about/
I'd love to answer any questions, I'm not as keen on one-page-apps now as I was when I started.