Sites Built Entirely Over API?

Solved
Highlighted
Tourist
5 0 2

Hey all. I'm new here, and have a rather high level question about building an API-driven website. 

tl;dr - I'm considering building a website (for a handful of reasons) entirely over the API. Using NodeJS/Express, I plan to grab items, tags, categories over the API, and deliver the cart & web experience completely over my own web server. I will likely be caching the products in my own redis cache as well to keep bulky API calls to a minimum. 

I'm curious if
1. Is this something anyone here has done before, and have there been any big issues with doing something like this?
2. Is the storefront API is to facilitate something like this?
3. Does anyone foresee any "gotchas" that may come from developing the site like this.

I understand that typically, it's best to use the liquid templates, and shopify's core website feature - but for this project, for a handful of reasons, we need to take an API driven path. 

I appreciate any feedback!

0 Likes
Highlighted
Shopify Expert
4270 32 435

This is an accepted solution.

Storefront API is made for you. Shopify would love it if you exploited that to the max for your own purposes. You are embracing some hot technology. You'd be crazy not to go this path, as it is for sure a chunk of the future. No other platform has the important details nailed leaving you with the more creative side of things. Not to say the API is perfect, far from it, but if you get in the car and start driving it, I think they'd love to help you smooth over any bumps or weird noises you see and hear.

 

I cannot imagine you having a bad time doing this. Share your experiences!

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
Highlighted
Tourist
5 0 2

Thanks! That is very encouraging. I'll definitely draft up a case study or a blog post and share it here once we're live. Aiming to get some of the base foundations of this into a github repository as well to help anyone else out in the future. 

0 Likes
Highlighted
Tourist
24 0 1

@HunkyBill 

Can you explain why the Storefront API is preferred over the REST Admin API or GraphQL?

0 Likes
Highlighted
Shopify Expert
4270 32 435

Storefront is meant to access and display products, and can handle checkout. Clear?

 

Admin API is made for management of products. Totally different use case. Clear?

 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
Highlighted
Tourist
24 0 1

tl;dr - I'm considering building a website (for a handful of reasons) entirely over the API. Using NodeJS/Express, I plan to grab items, tags, categories over the API, and deliver the cart & web experience completely over my own web server. I will likely be caching the products in my own redis cache as well to keep bulky API calls to a minimum. 

Nothing here requires the use of a front-end or directly implies the resources must be visible to the operator (user) with a front-end. What @Polymath said here could either mean they want a full-stack Node/Express app with a front-end layer as well, implying the "user" wants to view, and physically manage their processing as a Web app or it could mean they want to create a back-end service with Node/Express to receive, transmit, and process requests without a front-end (likely with a command-line interface).

The only terms in Polymath's response relevant to front-end were "liquid templates," and immediately then stated their inability to use this feature and other features and to go with an "API driven path," which further strengthens the possibility of them maybe talking about wanting the backend service option mentioned above. @HunkyBill 

0 Likes
Highlighted
Shopify Expert
4270 32 435

You asked a question and for all intents, I gave you the right answer. You seem to think because you hacked together some code my answer is somehow offending you? What did you want to hear? That your idea that building out a front-end based on back-end API calls is somehow cool? Good luck with that. I would never waste effort on that pattern as being useful, save for people with too much time on their hands re-inventing the wheel, and at that, having it usually end up being the wrong size, going flat, and then straight to the garage for repairs more often than not.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
Highlighted
Tourist
24 0 1

You seem to think because you hacked together some code my answer is somehow offending you? What did you want to hear? That your idea that building out a front-end based on back-end API calls is somehow cool?

Huh? I simply asked for clarity on whether your solution would be viable with a given architecture, because your original response of marketing lingo about the Storefront API explained nothing. Also, asking you to explain something in a developer forum isn't indicative of defensiveness, but the tone of your response definitely is.

That your idea that building out a front-end based on back-end API

That wasn't my idea though? The scenario I described was an API-only service with no front-end at all, which again, was posited only to clarify whether your professional opinion on the Storefront API would extend to this use-case, not whether the use-case itself was valid or "cool" or whatever.

0 Likes
Highlighted
Shopify Expert
4270 32 435

definitions are important.

My guess from the limited information you provided is that you figure Storefront API is not good enough for you. So you are building an API that some "code" can call, to deliver an experience. And you'll power that using your own API built on top of the back-end API.

Do you see why I prefer to not go deeper down this rabbit hole? Would anyone? I mean sure, lets all talk philosophy between developers, but I am just not able to "see" the benefit in trying to outgun a Shopify API. Sure, a lot of API calls in the Shopify ecosystem are not ready for prime-time, but I have been burned trying to patch those holes and so I am a bit nervous revisiting that.

So for clarity. I still think you want to avoid re-inventing the wheel. I guess if Storefront API is not good enough for your specific idea, and you can in fact give yourself all you need by tapping into the back-end, and offering yourself data to consume that helps you, all the power to you. You are doing Shopify a favour, and you're taking advantage of the power of the platform for good. Kudos! Keep it up!

 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
Highlighted
Tourist
5 0 2

Wanted to provide a quick update - since the discussion above by @rsfxiii actually touches on the methods we used. 

The solution we ended up with used a hybrid of the Admin API & the Storefront API. Some data we needed was best retrieved from the admin API endpoints and like @HunkyBill mentioned, it is a rabbit hole - so I won't go into too much detail.

Basically, the admin API became useful for retrieving product information, and category data at the server level. We cache the Admin API responses for products due to rate limiting, and use webhooks to flag the cache as stale. For checkout, cart, ephemeral product data, etc - the storefront API has proven to be perfect there.

If your site is 100% client side code, storefront is going to be perfect for your needs. If at any point you need that data on the server side, then yes, admin API can become useful - but again, intelligently caching the data is key here. Rate limitations can sneak up on you quick if you aren't being very careful with how you implement admin API calls.

Hopefully my use case can help put some of this into context.