Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

anon9348's avatar

Algolia: front-end or back-end implementation?

Hi there,

I started this conversation because I would love to hear your opinion on this subject. Although front-end (JS) implementation is more performant and brings other advantages like search dialog and other cool stuff, I feel that a back-end implementation is more secure (you keep your keys on the server) and scalable (if you code to an interface like in the first lesson Jeffrey presented, later you can easily move to another search engine without much hassle whereas in the fron-end case it seems much more difficult to achieve the same goal). What do you think?

Cheers!

0 likes
2 replies
ltrain's avatar

You can actually use a search only key on the frontend that Algolia provides so user's can't start modifying your indexes and your account and so forth. Rest of your index creation and management would remain on the backend. This can actually be a pretty significant performance advantage without much security risk. Obviously it depends on your dataset but if it's general data accessible to everyone highly recommend going with the client side solution. If it's data related to specific users per index or you need to do some specific filtering on the result set that you don't want the user to know about, then would say keep it on the backend and proxy the results through your own API. In general I don't think it should be implemented on the backend just for the sake of code maintainability if it slows down the user experience.

monaye's avatar

Is your site needs SEO ? SEO is very critical for content focus site. If seo is critical for your site and If you are going to use the frontend solutions, get ready to spend a lot of hours for SEO optimization. If you have enough developer that's fine otherwise I will go with backend solutions.

Even though Google announced they now support JS, I heard a lot of complain from my colleague about it is not implement fully and giving a lot of headache.

Please or to participate in this conversation.