How would one host a ecommerce website without giving away the source code?

This is just a hypothetical question, but say I have designed a website for my client, sent him all the source codes (index.html, styles.css, script.js, etc), and he asks me how he’s supposed to actually get the whole thing up and running. What do I say? What are the best options?

Client-side code is code that is run within the user’s browser. So there isn’t a way to “hide it”. You could run your actual source code you write through optimizations, such as minifcation, so the code you write is “condensed down” and optimized for end-user use. This is usually done because the goals of the code you write aren’t usually the same as the code that is ran by the browser.

This usually is part of the actual project. You cannot expect a client to be able to take code and “run it” correctly. With-in an organization there’s usually dedicated individuals that manage the operations of your software. (devs vs ops).

In a freelance relationship the client could be able to handle this on their own, or include it in their specifications for the project. Or they could not, in which case you could walk them through it and manage things for them.

If you are to manage things for them, it’s mostly up to you to host/run/manage the operations and deployment of the source code you write. If its just static client-side code, then you could use a static-client side only host, such as github-pages, or Netlify, or firebase hosting. Generally static site hosting is very cheap for providers so there are a lot of free or super cheap options out there.

However, if you need more than just client-side hosting you’ll probably have to pay (or have the client pay) and the entire process gets more complex.

Finally, the whole concept of “the person I’m writing code for can see my code!” usually isn’t a big deal as they technically own the code you write as they are paying for it. In general this is all handled before anyone starts on anything as part of the job’s contract, which can be used legally to handle any edge-cases, but generally isn’t a problem if all parties are on the same page.

Hopefully that helps a bit. Good luck, keep learning, keep building :+1:

1 Like

Oh sorry I think I might’ve asked too many questions all at once and probably made the whole thing sort of confusing lol.

I want to clarify that I would never be so scummy as to lock away the client’s own code. I meant to ask if there is a way for them to protect their own code. If I were doing it myself, I would definitely just host it on Github and be done with it in 5 seconds, but then my concern would be that any random Joe can just copy the source code and make their own store in the exact same way. (Though I have now realized that it might border on the paranoid side of things)

You can make the repo private.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.