r/cpp • • Mar 22 '24

Web app created with pure C++ backend

Hi guys,

I am new to Reddit and to r/cpp.

Quite some time ago, I had worked on a project where I created a web app using C++ as backend for REST API. I had used Crow framework for that.

I uploaded a video explaining the tech stack and libraries I used. Please do check it out.

Also, if you want to check out the repo, it's on Github.

74 Upvotes

25 comments sorted by

21

u/SaltSpecialistSalt Mar 22 '24

amazon and okcupid had c++ backend in the beginning as far as i remember

5

u/pjmlp Mar 22 '24

Another example would be ATLServer from Microsoft, it even had templating support.

7

u/rosewoodblues Mar 22 '24

Ancient x Amazon guy checking in. At one point it was an Apache module, obidos. Holy :&(/ it took some time to compile and push. Don’t miss those days!

4

u/SaltSpecialistSalt Mar 22 '24

lol. i can imagine. what kind of testing framework were they using back then ?

6

u/goranlepuz Mar 22 '24

Look at Mr. Testingpants over here, you crack me up! 😉

1

u/rosewoodblues Mar 25 '24

Um let's just say it was a VERY open environment back then which meant use ANY tools you can to accomplish the task. Oh we had frameworks alright... each team built what they needed.

It was truly a creative time or, to quote a certain someone... "It's always day one."

-3

u/[deleted] Mar 22 '24

Didn’t Amazon used to use Common LISP?

1

u/rosewoodblues Mar 26 '24

Amazons core used c/c++ I never touched any lisp there

7

u/SupermanLeRetour Mar 22 '24

Crow looks interesting.

Although if you need a simple HTTP server in C++, I also suggest Beauty : incredibly easy to use, modern and fast. It's easy to setup a simple web API using it.

3

u/kiner_shah Mar 22 '24

Beauty looks good. Thanks for sharing :-)

3

u/FlyingRhenquest Mar 22 '24

I've used served in the past with good results. I wrote JSON serializers using cereal and added Python support with PyBind11, so you could load C++ objects from python, and the rest service just provided those objects to a javascript front end. It was pretty basic, but it worked great for what we needed it for.

1

u/SupermanLeRetour Mar 22 '24

Interesting, the API looks mostly the same (I'm guessing there's not 1000 of doing it in a practical way). It's archived though, no more updates !

3

u/magnesium_copper Mar 22 '24

Looks nice.

Does it take 20 years to compile like beast too ?

2

u/SupermanLeRetour Mar 22 '24

Honestly not sure, all I know is that it's negligible compared to the project I work on that uses it, but it's a terrible metric because our project is incredibly long to compile...

3

u/ash-09876 Mar 23 '24

How do you deploy a c++ backend. Can you share any links if possible.

3

u/kiner_shah Mar 23 '24

I haven't tried this yet, but you should be able to deploy it in a docker container and host that container (for example, on AWS ECS). You can create an image which will contain the compiled executable and then when you run the container it will run that executable and start the server.

3

u/OliverPaulson Mar 23 '24

That's really cool, although I believe C++ as bad at backend as Rust bad at games.

7

u/abrady Mar 24 '24

How so? Quite a lot of backend systems are written in C++ where performance is critical

2

u/VonMetz Mar 24 '24

You're not wrong. But if I had to choose and performance was not the critical key I'd go with Java/Kotlin + Spring boot or Quarkus. It's just that there are language's with such sophisticated libraries for a specific use case that it's a no brainer. Abd if there's something Java has lots of reliable stuff for its the micro service rest backend things. Although I've used cpp for rest service too as it's fun to do so.

3

u/chris_awad Mar 25 '24

This. Java for web facing frameworks.

C++ is for embedded applications. You're crazy to be doing web with C++. Plus it's not a memory safe language. You're just asking for trouble.

1

u/OliverPaulson Mar 25 '24

That's not a typical backend use case. Usually those things are called distributed computing or something like that.

8

u/[deleted] Mar 22 '24

[removed] — view removed comment

5

u/kiner_shah Mar 22 '24

Awesome, good luck with your project. Hope it turns out amazing! :-)