Best modern technologies to use to build a database-driven site?


#1

Hi all,

It's been a while since I touched any back-end code (back when ASP and .Net was all the rage) and since then I've been getting my head stuck into front-end a lot more.

As a bit of a training exercise I want to build a site which will test both my front-end skills and allow me to venture into a bit of back-end code as well. Now back in the day I would have used something like an Access database to run a site and pull out data but what modern technologies would I be best to learn and implement to create a site which will contain multiple areas, all centered around displaying information around events for example - storing information on location, custom fields but also doing something like Master Pages allowed for, to create elements which are repeatable across pages.

Is PHP still relevant at this point or would I be best learning something else?

Thanks for the help in advance.

Cheers,

Andrew


#2

You cant go wrong starting with PHP (PDO) and Mysql/MariaDB. Here is a PDO tutorial to get you going https://phpdelusions.net/pdo

You can also download my PDO Bumpstart Database to get you going in the right direction. https://github.com/benanamen/pdo_bumpstart_ver1.6


#3

Thanks! Just to give a bit of background I've started looking into Node.js and Express (at the early stages so far) and they suggest using MySQL or MongoDB for database integration?

Also is VB (.Net or C#) still relevant or redundant these days? I remember back in one of my old jobs a few years ago they were using VB as a basis for sites.

I guess part of my original question should centre around what CMS I'm going to use to manage the site - any recommendations?


#4

.Net is bigger than ever, now that .Net Core is a thing. The company I work for has invested in it heavily and everyone using it loves it. Not VB, though. Forget that exists.

Node is a solid choice, so is MySQL, but a lot of developers like PostgreSQL more because it's full of features and lacks very little compared to other solutions. Mongo is a choice for a lot of tutorials, because it's easy to teach with JS. I don't know of anyone using it in production successfully.

GoLang is a rising star and is a pretty fantasic choice. It feels a lot like JS, but with more thought put into the core design and features. It's statically typed, makes threading and async easy, and compiles to a binary. It's considerably faster than most of the other choices.

I guess part of my original question should centre around what CMS I'm going to use to manage the site

this isn't really part of it, this changes the answers entirely. This is a different question entirely than the choice of a backend, because you won't be able to choice either the DB or the language if you want something solid. You won't be working with the DB or backend directly, and the choice isn't your's of what language you use.

It's likely you don't need a CMS unless you're building a site like SitePoint with a lot of editors and people making content. If it's a personal site, you'd be be better off with Gatsby or Hexo. You can host a static site for free with Netlify, or ultra cheap if you have a ton of traffic. Netlify is fantastic.

back in the day I would have used something like an Access database to run a site

This was never really a good idea. If you want something more lightweight and you don't have a ton of users but still want the db solution, then SQLite is a viable solution. It's a single file DB, like Access, but also not insane like Access.


Links:


#5

If you check out Mongo's website, they have listed a number of large organizations who use Mongo successfully.such as Sega, Chicago, Expedia, etc. So it is rising fast (having said that, I am just a beginner with the MEAN stack, and regularly develop with the PHP, mySQL stack, so that is not a biased response. :slight_smile: )


#6

So it is rising fast

It's being removed faster. I've read tons of horror stories over the years, but to pull them back up I'd have to remember the actual article names. The companies you named are not single entities and will have lots of different production grade databases. They might be using it in certain parts of the company where having an object store makes sense, but I guarantee their bread and butter is still relational. Mongo is far more common in tutorials than it is in real life, because it's easier to teach when combined with JS.

Here is a HN thread on the subject:
https://news.ycombinator.com/item?id=12290739

Here is a /r/programmer thread on the same article:
https://www.reddit.com/r/programming/comments/3dvzsl/why_you_should_never_ever_ever_use_mongodb/

Even if you need an object store, the PostgreSQL or MYSQL/Maria offer jsonb datatypes which give you the best of both worlds and is just as fast as Mongo.


#7

Hmm interesting! So MongoDB is more of a learning tool than something that should be used within production and gets people into learning about the ins and outs of databases and setup?

Something I've also been experimenting with is EJS which allows for templates - I presume I could combine EJS with a database connection if I wanted to? Or would another solution be better?

Time to get learning .Net and MySQL I feel... :slight_smile:


#8

So MongoDB is more of a learning tool

I wouldn't say it that way, it just works better for learning than it does for most real world situations.

I presume I could combine EJS with a database connection if I wanted to? Or would another solution be better?

EJS is for server side rendering. Generally, you do not mix sever side rendering with a fat client like React, Vue, or Angular. If you need the intial load performance boost, you can render these server side, but you shouldn't worry about that till you get there.

Your api would connect to your db and respond with json, not HTML rendered with EJS.


#9

Ah I see now - sorry I should rephrase that; it sounds like MongoDB is more of an entry point into learning other database technologies - would that be a fair observation? :slight_smile:

So you'd advise using React, Vue or Angular over EJS? Looks like I've got some learning to do then haha :slight_smile:
In terms of security, is PHP that hard to keep secure...or would .Net be a better option?

I guess what I'm trying to weigh up the most is what technologies would be worth my time training myself up in for now, and what could I also use to create a demo site with a robust front-end and back-end to take advantage of my new training?


#10

MongoDB is totally different from relational databases such MariaDB and other SQL databases, so I wouldn't call it an entry point into learning other database technologies.

And PHP is as secure as the person who is coding with it, so I wouldn't dismiss it as an option. I would just make sure I learned about PHP and security, and was careful to not be sloppy with it.


#11

I'm not familiar with MongoDB, but I am with IndexedDB, another "NoSQL" database. Similar to where for most cases JSON is adequate but sometimes SOAP is needed, "key: value" pairs might be enough for many tasks, but sometimes more will be needed. (i.e. a full fledged YesSQL database :wink: )

It's all about choosing the best tool for the job.

I guess there are enough similarities where it could help with learning other databases. I've worked with a few and knowing one often helped in learning another. Then again, forgetting a difference when thinking one while writing for another has led to a lot of :banghead: moments.


#12

So you'd advise using React, Vue or Angular over EJS? Looks like I've got some learning to do then haha

I apologise, I forgot the original question when I replied. Usually, a JS framework is the way to go for a user focused app. It will keep you sane when trying to build something user focused. But if you want to be indexed by search engines, pre-rendered or server side is the way to go. Search engines can execute the JS, but it's still advisable to use a solution that has less ways to go wrong and will give you less penalties.

Security is in the hands of the developer. You shouldn't concern yourself with the security benefits of one language over another, they are all secure enough.


#13

There are numerous PHP FrameWorks available that not only simplify coding by not having to "reinvent the wheel" but are also frequently updated with the latest security features.

The current framework I use is less than 2 Megs including the documentation! This usually takes about a minute to download and upgrade the live version.


#14

If you want a server-side solution that looks like HTML, ColdFusion will do that. Granted, it is NOT inexpensive. That's one of my beefs with Adobe - they jacked the price after they bought MacroMedia. But the CF tags are like HTML tags, and if you want you can also put code between <cfscript></cfscript> tags and do 99% of what you can do with the CF tags. It's robust, you can create custom tags, and it's easy to connect to most databases (although I do not think there are any NoSQL connectors.)

Lucee is the open-source version of ColdFusion, and is better at licensing (you don't have to pay extra to spin up instances in the cloud like you do with Adobe ColdFusion.)

Just my two cents.

V/r,

^ _ ^


#15

I see, thanks!
So if I was to create a website which requires a database for my own training purposes I may be best sticking with PHP or .Net? When looking forward in my career, many job listings for Front End Development seem to just have HTML, CSS, JS, Node, React, Angular and Vue listed - for most there is no mention of PHP or .Net interestingly. I know some listings are put up by agencies with not much clue about the technologies involved but still...

Thanks for the other replies by the way - it seems PHP may be one way to go then due to all the support and the community.

This is a very naive view (I've never worked with ColdFusion) but I haven't heard of ColdFusion being used for many years (probably the last time I saw it on a job listing was around 2006/2007).

Apologies that this thread has grown more to looking into coding languages and my own training/development rather than the best technologies to use for a specific purpose - I guess I'm looking for something that will cover all bases - something I can pick up as training but also keep up with the latest tech to use for a test website.

Thanks again!


#16

for my own training purposes I may be best sticking with PHP or .Net?

I never said this. I would personally never advocate PHP, because of multiple reasons I'm not going to get into here. But, mostly because I see no value in it. When PHP became popular, it was the best solution on the block, today it doesn't really excel at any area that would make me give it consideration.

My suggestion has always been Node.js, because you will be using JS on the frontend anyway and it's less to learn. Writing an api endpoint that connects to a DB is stupid simple. It's also very easy to get up and running and deployed. Much easier than any kind of Apache or nginx configurations you'd need to make for PHP.

.Net is a good choice, but configuring a deployment server is going to be difficult or expensive, depending on if you choose .Net Core (difficult) or Windows Server (expensive).


#17

Thanks mawburn.
Maybe I haven’t done enough training yet but so far I see Node.js just as a local thing to make testing developments easier, rather than something that can be deployed to a web server. Are there any restrictions with its use such as browser/device support?

I’m enjoying doing some MongoDB training at the moment and if Node.js setups are anything like that then I shouldn’t have any issues. I’m still intrigued by .Net Core though…Not knowing much about backend technologies at the moment I guess I’d need to train up MySQL or similar to make the best use of .Net?


#18

Are there any restrictions with its use such as browser/device support?

No, it’s a server-side thing. The client’s browser/device is irrelevant.

Not knowing much about backend technologies at the moment I guess I’d need to train up MySQL or similar to make the best use of .Net?

You can use Mongo with .Net if you want, or MySQL/Maria, or PostgreSQL. But, historically SQL Server has been the SQL DB of choice for .Net since it fits into the Microsoft tech stack. I would assume that is till the case with .Net Core given the massive amount of support and libraries that were previously baked into .Net, but you can certainly use any DB you want.

Same can be said for Node.js or virtually any other thing you choose. Your data store is mostly irrelevant when talking about the server-side language choice.


#19

Great thanks for the reply!
I messaged my current website host about .Net Core support and they said that it isn’t available on their Cloud hosting unfortunately - looks like I may be looking at a new host or another package for .Net Core. They also seem to only support MS SQL.

Looking at the differences between .Net and .Net Core is it maybe worth me starting out just with .Net and building up from there?


#20

Tbh, I haven’t dealt with them much since .Net Core was a thing. I do not like Windows, so I would lean heavily to .Net Core. Linux is a much cheaper server with lots of unique solutions, like Lambda and Heroku, that do not exist on a Windows stack.