38

I'm about to start creating a music project website for a friend. It should be pretty simple for now: no dynamic content (tour dates, etc.), and nothing more than a few embedded sample songs or SoundCloud links. I'm not expecting to use anything more than vanilla JavaScript and Bootstrap or Foundation for a responsive grid.

Is this enough however? Can I simply upload HTML, CSS, and JS files to a host and be done with it, or should I take the time to program a backend server in Node or PHP?

Deegriz
  • 471
  • 1
  • 4
  • 7

6 Answers6

87

If you don't know whether you need server-side code, you probably don’t*

*Caveat: Server-side code is essential for security, when you want to internally control access to content, data, or functionality. (It does not necessarily need to be your server, see last paragraph.)

Ask yourself what problem using server-side technologies would solve. If you can’t think of any (and in your case, I can’t either) then you don't need them.

Be aware that a lot more than you might think is possible using just client-side code. JavaScript frameworks like AngularJS or ReactJS can let you integrate with third party, dynamic content through API’s using Ajax. (This includes hooking into an API that could handle its own security.)

Tim Grant
  • 1,360
  • 10
  • 15
56

Read about static site generators. These allow you to create a site in a programmatic manner (using templates, data, etc), and not by hand-crafting HTML. The result is a set of static HTML and CSS that does not require any backend.

https://www.staticgen.com/ lists and ranks a number of such open-source generators; closed-source offerings likely exist, too.

9000
  • 24,342
6

You can and should use only a static site if it is enough, or use a static site generator. Why? Maintainability. Code has bugs. Every few weeks there is another WordPress security hole found. If you use a common CMS, you will have to patch it constantly. Else your friends website will soon contain advertisement for illegal drugs, ISIS propaganda, malware which is installed on visitors computers or worse. Even if you regularly patch it, you might be too late so you have to constantly check for hacks. There are ways to secure this CMS. Install "security plugins", configure a web application firewall like mod_security etc. All just more work. They also have to be kept updated. Sometimes your mod_security rules will break a plugin for WordPress, you have to analyze that and fix it. More work.

You might think, nobody will want to hack that site. But for the common security holes found in common CMS systems, there are soon automatic bots that crawl/search the web and hack ALL sites using that CMS. They just want to spread their links/malware/propaganda.

With a static site (created manually or with a generator), you don't have that problem.

If you implement your own backend, it will also have security holes (no one is perfect) but most likely no one will exploit them for that little website. But what do you want to implement? If you want to create an editor where your friend can change tour dates himself, think how long this will take you until it is easy enough for him to use without your help. How many times can you just quickly change the dates for him with that time budget?

In my opinion, far too many people today just use CMS systems for every site, because static HTML is "old". If you don't need anything that isn't possible with HTML5, use server side code. But if you don't need it, you save lots of lots of time without it.

Josef
  • 297
3

You only need to do backend programming when you need it.

However even basic features like emailing forms require basic backend programming usually. If it's just a display site then yes, it's fine.

deek
  • 139
2

Not necessarily, but there are some problems you are likely to run into if you make the entire site in plain HTML.

Many sites have the same menu, header and footer elements on multiple pages. If you simply copy and paste these from one page to another then this maybe become tedious and error prone as the site gets bigger and you need to keep making changes in these areas.

In the days before server side programming was so common one common way to address this was to use frames to embed these areas into every page. This fell out of favour several years ago, so I don't recommend doing it now. You could write some simple server side code instead to display these common elements on every page.

I would agree with others here who have recommended using an off the shelf CMS.

bdsl
  • 3,924
0

I think If you Don't know you should use server-side Or not, then you probably don't need it. there are lots of things that you can do with client-side for a website.

By using js, bootstrap you can create a decent website