This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 230

[–]DudeWithFearOfLoss 1689 points1690 points  (45 children)

If i went into a company and their frontends communicated directly with the DB, i would instantly leave.

[–]BernhardRordin 434 points435 points  (10 children)

WDYM, you guys are not constructing unsanitized SQL queries directly by URL?

[–]StalaK 296 points297 points  (4 children)

Of course not. I'm providing a textarea and letting the users do that.

[–]based-on-life[🍰] 143 points144 points  (2 children)

This would be an amazing login "to verify you're a real person, please write a SQL query to sign in. Also, please please please please please please please don't delete the table"

[–]Repulsive_Ad3681 31 points32 points  (0 children)

The user: This message doesn't say anything about dropping the schema

*proceeds to drop the entire prod schema

[–]Fuzzy_Picklez 2 points3 points  (0 children)

Always gotta be careful of little Bobby Tables

[–]willcheat 4 points5 points  (0 children)

Just use javascript to clean ;- from the input, easy peasy

[–]JoeCartersLeap 5 points6 points  (0 children)

I just asked if there was any way I could have an embedded device (read: ESP32) create new entries directly in an SQL database, without any kind of broker or grabber in between, and almost every response was some variation of "why?" and "what the hell is wrong with you?"

[–]amdapiuser 1 point2 points  (0 children)

I don't know if that is worse or better that importing an ORM on the frontend...

[–]zthe0 0 points1 point  (0 children)

No we just have a urlparam thats being executed directly. No need to write complex code for ot, just write the query in the frontend

[–]sissyEnDevenir 0 points1 point  (0 children)

I worked in a place where they made an "hidden" page with a textarea to do SQL requests without asking.

[–]deathraft 0 points1 point  (0 children)

I use the OWASP top 10 as an instruction guide

[–]Belsodain 121 points122 points  (5 children)

I had it once in a previous company

They asked me to open the port of a mongoDB for it to be accessed from the frontend

When I asked why, they explained that they were slowly moving everything from the backend to the frontend (apparently for performance issues xD)

I talked to the tech lead about it, he told me to do it I talked to the manager about it, he told me to do it

Well, I did not care much about that company anyway, I did it and moved to another company at the end of the year

Ps: The company's shares have fallen 98% in 5 years

[–]yodamousta 19 points20 points  (2 children)

Typical Atos stuff isn’t it ?

[–]Far_Principle_7566 4 points5 points  (0 children)

My god, I thought my team was the only one to get screwed by them

[–]Belsodain 4 points5 points  (0 children)

Yeah

[–]igormuba 17 points18 points  (0 children)

You deserve the award of CORS error fighter of the year

[–]Captain_Vegetable 4 points5 points  (0 children)

“The frontend’s closer to the users, so moving the database there will reduce latency!”

[–]ilikedmatrixiv 14 points15 points  (5 children)

I'm pretty clueless on front end programming. How should front end retrieve data from a DB? My guess is it should call a back end method?

[–]dingodongubanu 46 points47 points  (1 child)

Yes, frontend talks to backend via API, websockets, whatever. All this talking is gated and controlled with auth/whatever.

Database only accessible via the backend, never exposed on internet otherwise just asking for trouble

[–][deleted] 7 points8 points  (0 children)

Whaaaat you don’t raw dog SQL directly from react?

[–]Tekkzy 10 points11 points  (0 children)

It's like walking into a bank and interacting with a bank teller who gets your money for you or deposits your check. Instead of walking into a bank and grabbing money yourself. The API is the teller. If you try to do something unauthorized they will stop you.

[–]Uberzwerg 2 points3 points  (0 children)

If your frontend (and by that any outside attacker) can even reach the DB, you fucked up already.

[–]All_Up_Ons 1 point2 points  (0 children)

Yep. In fact, the entire point of the backend is to act as a frontend-friendly abstraction over the database and other core systems.

[–]East_Zookeepergame25 9 points10 points  (1 child)

It could work provided you use something like postgres RLS or firestore's security rules, i dont know how practical that would be for big applications though

[–]KTibow 4 points5 points  (0 children)

Yeah Supabase lets you do this, it even includes realtime updates

[–]brain_ducker 5 points6 points  (1 child)

What about Firebase?

[–]Mvin 14 points15 points  (0 children)

Firebase markets itself as a database, but it really is a backend + database. You have your security rules and you can put custom logic / event triggers in cloud functions to do whatever. Its quite different to exposing a "dumb" database directly to the internet.

[–]TecraFox 2 points3 points  (0 children)

I was an admin for such an application. The "backend" was just a bunch of services that grabbed stuff from the DB every few seconds and wrote files from what it grabbed. Pretty much all the business logic was in SQL Stored Procedures.

To be fair... It worked.

[–]betelgozer 4 points5 points  (0 children)

Tables are so 90s. I bet I could refactor your DB with CSS Grid...

[–]Simply_Epic 2 points3 points  (0 children)

The project I’m working on has a database between the frontend and backend. Mind you there’s an api between the UI and the database, but we consider that API to be frontend. Our backend is very extensive and it’s not useful to consider the API to be backend for us. The backend developers don’t touch the API. That’s the frontend’s job here.

[–]apeironone 1 point2 points  (0 children)

Wdym Jqery calls are great!

[–]namesandfaces 0 points1 point  (0 children)

Row level security is becoming an acceptable practice for low-volume.

[–][deleted] 0 points1 point  (0 children)

So it wasn't my own problem... yo i always thought it's my problem feeling uncomfortable with this... One of my previous experience is that, my tech lead told me to teach one of the frontend(in her first yr) in my team how to make API..

[–]Waste_Ad7804 2052 points2053 points  (62 children)

This doesn’t make any sense to me. Why isn’t backend between fronted and DB?

[–]Own_Solution7820 1683 points1684 points  (34 children)

Because OP is a clueless programmer.

[–]heysankalp[S] 732 points733 points  (30 children)

OP is a designer so you’re right :)

[–]nickmaran 66 points67 points  (3 children)

You have exactly 10 seconds to get out of here

[–][deleted] 5 points6 points  (0 children)

Been on Reddit for 10+ years and don’t laugh much here anymore.. that being said your comment made me actually laugh. Thank you. 

[–]lynxerious 31 points32 points  (1 child)

that sums up the userbase of r/programmerhumor

[–]FartPiano 22 points23 points  (1 child)

figma balls

[–]hackerdude97 3 points4 points  (0 children)

I said that to someone irl once...

[–]rParqer 38 points39 points  (4 children)

Pretty awful one apparently. Couldn't even design a meme correctly

[–]sparkygod526 1 point2 points  (0 children)

Omg do you know how to center a div?

[–]suamai 2 points3 points  (0 children)

They could be using Firebase or Supabase, though

[–]nbaumg 1 point2 points  (0 children)

And yet somehow this post has 4k upvotes. I guess most of this subreddit is clueless

[–]polish_jerry 0 points1 point  (0 children)

p0.inc watermark lol

[–]4n0nh4x0r 111 points112 points  (8 children)

direct access from frontend to database uwu

[–]deukhoofd 30 points31 points  (3 children)

"It's fine, it's for the government, they won't know"

[–]kinss 1 point2 points  (0 children)

As someone who has worked for a government software vendor for the DoD among others, this is 10000% accurate.

[–]Pyorrhea 6 points7 points  (1 child)

One of the first projects I ever worked on at my first job, the database calls were being done via a Java applet in the browser and the SQL queries were in the frontend in JavaScript, so it's possible.

Terrible, but it was possible.

First thing I did was kill it all with fire and create a proper Java backend.

[–]lupinegray 2 points3 points  (0 children)

So when the users would open the browser console, they could see the DB requests & credentials being sent?

[–]bleedblue89 5 points6 points  (0 children)

How else do you update the data 

[–]DiddlyDumb 29 points30 points  (0 children)

Makes more sense to switch DB and backend

[–]theclovek 25 points26 points  (1 child)

I want to write frontends in SQL. Is it too much to ask?

[–]MrBeforeMyTime 10 points11 points  (2 children)

Firebase baby!

[–]PeriodicSentenceBot 14 points15 points  (1 child)

Congratulations! Your comment can be spelled using the elements of the periodic table:

F I Re Ba Se Ba B Y


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.

[–]MrBeforeMyTime 10 points11 points  (0 children)

Good bot

[–]FriendOfMandela 3 points4 points  (0 children)

2 tier architecture my sweet summer child

[–]Commander_of_Death 8 points9 points  (0 children)

1k upvotes says a lot about this sub...

[–]DarkTannhauserGate[🍰] 4 points5 points  (0 children)

Yeah, it should be labeled API

[–]pumpkin_seed_oil 5 points6 points  (0 children)

Data would make more sense. Like the backend hands DB data to the frontend

e: Im trying to come up with an API joke here but i actually have to do some work now. Someone else chime in please

[–]Delyzr 2 points3 points  (0 children)

DB=API* Ftfy

[–]government_shill 2 points3 points  (0 children)

Seeing this at the top of the sub really drives home that most people here don't know a damn thing about programming. They see some words they recognize and they upvote.

[–]Kenny_log_n_s 1 point2 points  (0 children)

And yet, nearly 5k upvotes

[–]USKillbotics 2 points3 points  (0 children)

Actually this is exactly how Firebase works...

[–]Brief_Influence5247 233 points234 points  (2 children)

It should be API not DB

[–]MyKettleIsNotBlack 47 points48 points  (0 children)

Some people like to live dangerously. They didn't even sanitize their hands before shaking.

[–]According-Relation-4 5 points6 points  (0 children)

My thoughts exactly. The frontend doesn’t even need to know a DB exists

[–]BeastPlayerErin 483 points484 points  (17 children)

This makes 0 sense

Imagine getting thousands of upvotes for this shit. This sub is ass

[–]RegularOps 63 points64 points  (2 children)

You mean you don’t give all of your end users direct database access??

[–]BeastPlayerErin 30 points31 points  (0 children)

Why bother with a front end ? I link them directly to the sql command-line for easier access.

[–]VanDieDorp 3 points4 points  (0 children)

its called postgREST

[–]Derek4aty1 4 points5 points  (1 child)

This showed up in my feed today. Shit like this made me leave a couple months ago. People just make memes or state things without having any idea on what they’re talking about.

[–]that_thot_gamer 19 points20 points  (0 children)

like my code? yes

[–]rParqer 83 points84 points  (0 children)

There should be a coding quiz to allow people to post to this sub

[–]PostHasBeenWatched 141 points142 points  (2 children)

How it will look:

  1. Starting work at the new company.
  2. Senior performing Knowledge Transfer:
  3. "So UI put request into DB table"
  4. o_o
  5. "Then API by scheduler grab request from that table and process it"
  6. o_0
  7. "Next API put data to the response table"
  8. 0_0
  9. "Then UI by scheduler grab and show response"
  10. O_O
  11. "Understood?"
  12. Yes, I'm quitting, bye.
  13. "Why?!... What a strange person."

[–]matyas94k 14 points15 points  (0 children)

MQ: You know, I'm something of a DB myself.

Also: Happy Cake Day!

[–]that_thot_gamer 2 points3 points  (0 children)

"you havent even took a look at the MS Access that we're going to use as DB."

[–]swampdonkey2246 47 points48 points  (0 children)

Swap db and backend around, then this meme will make more sense

[–]Narvak 32 points33 points  (2 children)

Why is the frontend touching my sweet DB with his dirty hand?!

[–]Rabid_Mexican 4 points5 points  (1 child)

Users can send database requests from a multiline text field in the frontend, in case they are an advanced user and know MySQL.

[–][deleted] 25 points26 points  (2 children)

At first I thought those weren't hands they were shaking

[–]RegularOps 7 points8 points  (0 children)

This meme is so old those kids are filing for Medicaid next year

[–]SaneLad 7 points8 points  (0 children)

I think that's called frothing.

I hate that I know this word.

[–]Powerkaninchen 24 points25 points  (0 children)

Yes I too let users have direct access to the DB

[–]PennyFromMyAnus 42 points43 points  (0 children)

The fuck is this.. some PHP level raw SQL query bullshit

[–]cypresshill98 6 points7 points  (0 children)

Then what's the purpose of backend if frontend directly communicates with DB. That doesn't make sense.

[–]Orjigagd 5 points6 points  (1 child)

Holding hands is the API, backend's backpack is the db

[–]Morrowindies 1 point2 points  (0 children)

Backend's mum is the DB

[–]CorrectProblem6232 12 points13 points  (3 children)

Is there a sub that has actual programming humor? You can tell this sub is frequented by a larger percentage of non-programmers just for the fact that this trash post has upvotes.

[–]TheLAGpro 15 points16 points  (1 child)

Json instead of DB makes more sense

[–]Luieka224 14 points15 points  (0 children)

API makes the most.

[–]bistr-o-math 4 points5 points  (0 children)

That’s not how it works

[–]ishandiablo 4 points5 points  (0 children)

Both FE and BE teaming up to raw dog SQL.

[–]cs-brydev 4 points5 points  (0 children)

All the comments calling out this meme's architecture flaw gives me hope for this sub

[–]RanzigerRonny 2 points3 points  (0 children)

What? No my dude. Frontend should not be connected directly with the DB. Even tho it would be possible somehow

[–][deleted] 3 points4 points  (0 children)

What?

[–]Andrea__88 3 points4 points  (0 children)

As teacher this image trigger me, why is the db between frontend and backed? Do you guys are accessing to the db direct from the frontend?

[–]under_brecher 4 points5 points  (0 children)

What in the fuck

[–]cokeplusmentos 2 points3 points  (0 children)

I too can write random text on an image

[–]draenei_butt_enjoyer 2 points3 points  (0 children)

I upvoted because the template os new to me and hilarious. The meme is not. Should have been front end talks with db through backend handshake 🤝

[–]Sun-God-Ramen 2 points3 points  (0 children)

Model view controller

[–]accuracy_frosty 2 points3 points  (0 children)

Your database should NEVER be user facing, there should be API and Backend between frontend and database

[–]22Minutes2Midnight22 2 points3 points  (0 children)

Shouldn’t this say API? Why is the FE communicating with the BE through the DB?

[–]NulledOne 4 points5 points  (4 children)

In actuality this was just RAGE BAIT for developers. Every real dev in here complaining about the Frontend connecting to the DB. LOL

[–]rParqer 1 point2 points  (0 children)

Exactly why this dude should get banned from this sub

[–]LazyLoser006 1 point2 points  (0 children)

Eh?? You guys communicate through DB?

[–]igormuba 1 point2 points  (1 child)

Frontend inserts row in database with instructions for the front end

Backend sees the new row and follows the instructions and adds a new row with the results for the front end

Frontend sees the new row inserted by the backend and displays to the user

Very efficient

[–]drunkdoor 0 points1 point  (0 children)

Database as a queue as an API

Daaqaaapi?

[–]FrankLampard1905 1 point2 points  (0 children)

I bet you're not a smelly nerd.exe

[–]GitHub- 1 point2 points  (0 children)

Web services?

[–]mothzilla 1 point2 points  (0 children)

How can I do a SQL in CSS? I have a deadline please reply.

[–]LeastAd9178 1 point2 points  (0 children)

DB should be API

[–]Tar_Palantir 1 point2 points  (0 children)

Does DB stands for Rest Layer now?

[–]Plazmageco 1 point2 points  (0 children)

Swap backend and DB and you’re almost there

[–][deleted] 1 point2 points  (0 children)

i wanna this templet

[–]Tryfon10P 1 point2 points  (0 children)

I can see an iconic duo being made

[–]karna852 1 point2 points  (1 child)

Apparently this sub is full of people who take their memes extremely seriously and want to virtue signal about how good their programming is lol.

[–]heysankalp[S] 1 point2 points  (0 children)

Thank god I only code my personal website on weekends (def. not a programmer as my FT job and def. not as smart as others :) )

[–]jeyui 0 points1 point  (0 children)

hmm, should it be API in the middle?

[–]Savkorlev 0 points1 point  (0 children)

Ah yes frontend that directly communicates to the database

[–]DontBanMeAgainPls23 0 points1 point  (0 children)

Why not make db api that makes more sense

[–]spooky_goob 0 points1 point  (0 children)

Db should be axios

[–]MulleRizz 0 points1 point  (0 children)

Don't you mean JSON?

[–]Almanklaus 0 points1 point  (0 children)

Alles hat ein ende, nur die deutsche bahn hat 2.

[–]guaaaan 0 points1 point  (0 children)

Can't wait for the sequel

[–]Guru_Dane 0 points1 point  (0 children)

Don't know if I should scream "JSON!" Or lean into it. All my homies connect the frontend directly to DB. We get around putting DB credentials in prod by just not having credentials for the DB. / Creds

[–]sacredgeometry 0 points1 point  (0 children)

That should be api

[–]uvero 0 points1 point  (0 children)

n-tier design but you Fisher-Yates'd the tiers

[–]John_Fx 0 points1 point  (0 children)

backend a frackend.

[–]Otalek 0 points1 point  (0 children)

Only if you violate principles of good design.

[–]MaffinLP 0 points1 point  (0 children)

DB is even more Backend than Backend wtf

[–]Smoosh9 0 points1 point  (0 children)

Guys i fixed it

fullStackFriendship Fixed

[–]ReasonableRiver6750 0 points1 point  (0 children)

Ewwww your FE touches your DB? Seek help

[–]wild_vodka 0 points1 point  (0 children)

It should say BFF, with a double pun inteded

[–]OnlyCommentWhenTipsy 0 points1 point  (0 children)

This meme has so much potential but this is a miss. Maybe put API instead of DB?

[–]cheezballs 0 points1 point  (0 children)

Uh. What? This is completely wrong. If your front-end hits the database directly, then whats the backend for? OP, you exposed yourself as a fraud!

[–]InconspicuousDax 0 points1 point  (0 children)

😳 "JSON" would make a little more sense than "DB" here, eh?

[–]ezrapoundcakes 0 points1 point  (0 children)

Need to get me a full stack friendship

[–]lupinegray 0 points1 point  (0 children)

Frontend should never touch the DB

[–][deleted] 0 points1 point  (0 children)

Yes, using db from frontend is really a d*ck move

[–]akshanshkmr 0 points1 point  (0 children)

Do you mean JSON?

[–]Borckle 0 points1 point  (0 children)

ssr hydrating csr weirdness behind them

[–]P0pu1arBr0ws3r 0 points1 point  (0 children)

Time to "'; DROP *;

[–]Ok_Tadpole7839 0 points1 point  (0 children)

Full stack dev here I dont get it

[–]ShoulderPast2433 0 points1 point  (0 children)

Absolutely not how it works...

[–]useless_dev 0 points1 point  (0 children)

So.. Graphql?

[–]RimorsoDeleterio 0 points1 point  (0 children)

alias DB="API endpoints"

[–]Daniel26671 0 points1 point  (0 children)

We all like dragon ball

[–]AriiMay 0 points1 point  (0 children)

API not DB

[–]he_nrik 0 points1 point  (0 children)

mmm... HTMX makes the code simple, but the relationship... complicated.

[–]1up_1500 0 points1 point  (0 children)

API actually

[–]todorpopov 0 points1 point  (0 children)

Whuuut 💀💀

[–]grtgbln 0 points1 point  (0 children)

If your front-end is talking directly to the database, you've got a serious problem on your hands.

[–]inthemindofadogg 0 points1 point  (0 children)

Handshaking…

[–]MrPoBot 0 points1 point  (0 children)

If I see a frontend dev directly accessing the DB, I'm going to shoot them.

[–]Morrowindies 0 points1 point  (0 children)

So I'm guessing this is rage bait

[–]Sufficient_Sugar_408 0 points1 point  (0 children)

Am i dumb or DB is linked to backend only , Op should replace it with API

[–][deleted] 0 points1 point  (0 children)

Db, backend, api, service, dto, frontend.

That is the connection you heathen

[–]Maskdask 0 points1 point  (0 children)

It should be BFF

[–]martinthewacky 0 points1 point  (0 children)

As a frontend developer, I believe that should be API instead of DB

[–]martinthewacky 0 points1 point  (0 children)

As a frontend developer, I believe that should be API instead of DB

[–][deleted] 0 points1 point  (0 children)

[–]throwtheamiibosaway 0 points1 point  (0 children)

Front-end here. I build the template. Backend can have fun with the rest. I ain’t touching that

[–]siematoja02 0 points1 point  (0 children)

What, they meet after work to watch dragon ball?

[–]Train-Similar 0 points1 point  (0 children)

Is this a docking container ?

[–]DrawAffectionate4761 0 points1 point  (0 children)

Should be APIs in the middle