Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: What web framework should I use nowadays?
20 points by ehsan_akbari on Aug 20, 2016 | hide | past | favorite | 49 comments
With many Programming languages and Web frameworks available these days ( Laravel for PHP, Rails for Ruby, Revel for GO, Django for Python) I am really confused about which one to use. Could you please suggest me the best of above based on different aspects?

Thanks in advance, Ehsan



Personally, I highly recommend Django.

- It is very powerful, elegant, and extremely fun to use. - It has amazing resources and documentation. - It is written in Python. That's a major advantage because pyhon is used everywhere, and if you get good at it - you'll be able to easily experiment with other areas of programming.

The easiest way to start is to watch tuts+ Django Unchained course[1]. It's a great and easy to understand introduction that takes you through the process of creating a hackernews clone.

Then you should buy 2 Scoops of Django [2], it's the best resource to learn Django in more depth.

[1] http://code.tutsplus.com/courses/django-unchained [2] https://www.twoscoopspress.com/products/two-scoops-of-django...


I taught myself django earlier this year after years of java development.

From my experience there is a steeper learning curve for django than flask, but once there its fairly easy to use.

2 scoops is a good book - but it would be good to see fully worked example in the book. Its also got a learnign curve as its teaching you the authors approach to building django which may be different to other tutorials


Don't listen to any comments that give you definitives on popularity. Most places/people pick a framework based upon the technology they already have or their language of preference.

At this point most mature frameworks all have the same abilities. The only differences you might see are speed, and even then, most people don't take that into account.

Pick the language you like or know the best, and have at it.


I think I am going to take RoR(Ruby on Rails) as it seems kind of magic to me :)


There is no best.

What I would recommend though is creating a webpage that is static and gets updated dynamically with angular/react/vue with a rest server like tomcat/flask/express with the database of your choise.

When i first found angular i loved it, I never really given react a fair chance and i have recently started to use vue.js which is great.

As a rest server i am using flask with flask-restplus because its simple and i like python.

As a database i use MongoDB because its easy to set up, i'm sure there's better alternatives but i don't runt anything on a bigger scale so I havn't put much thought into it.


>and gets updated dynamically with angular/react/vue

Does this mean that the page won't load if the user has Javascript disabled? As in, you can't see the content w/out JS?

The fact that it's so unfriendly to those select about their browsing habits (i.e those who don't want to run any and all code thrown at them by a random guy on the web) is why I've been reluctant to use it. And if there's a fallback, why not just use that in the first place?

I don't think users ought to have to download JS, or have such a download to be the primary option, when really they're just there to see a blog post or something. It's as if we've gone back in time.


I think there is no best, but there are technologies you want to avoid.

Like my lastest rant will be against Angular. First load is usually with ugly {BLABLA} everywhere, last version breaks everything, ugly performance compared to vanilla JS or react, unnecessary complicated, academic mindset...


> ugly {BLABLA} everywhere

It's been a while since I used angular (1.4) but from what I remember, ng-cloak handles this.


Years ago I learned to code in PHP/MySQL, never really using a framework. I made some attempts to use CakePHP and Symfony but never liked them much.

When I wanted to build my first big project, I looked for something like Rails in PHP but couldn't find anything. I did find Django, though, which looked cool. Since Python was more similar to PHP than Ruby, I learned Python and used Django.

Eventually I found Django too heavyweight and "batteries included" for what I wanted, so I moved to Flask.

Flask is awesome and if you like Python I still recommend it. But I think it gives you too much flexibility and there are too many ways to do one thing. Also, Python does not strike me as a language well suited to the web, primarily because everything is synchronous.

I'm now building a web app with expressjs, which has all the benefits of flask (minimal, include modules as you need them) with better defined best-practices and a larger ecosystem.

I'm using parse-server as the backend. At first I hated parse because of vendor lock-in, but now that parse-server is open source, that argument is moot. Installing it on my own server is very easy.

The best benefit of using parse-server is how easy it makes building components in different languages. Because there is a parse client library in almost every language, you can write each component of a project in the language best suited to do the job.

For example, the web app I'm building is an express server that talks to parse. But the billing and invoicing portions of the code, which happen mostly in background jobs, are all Python. They talk to the same parse backend as the web app, complete with all the beforeSave/afterSave triggers and cloud code functions.

Building the web app has been very fast because of built in functionality of parse server like email confirmation, forgot password, etc.

Building the billing code has been enjoyable because I'm more comfortable with Python, and I can offload any consistency worries into beforeSave/afterSave triggers and cloud code functions. This way the web app and Python code can call the same logic.

Having used many others, I would highly recommend this approach.


I spent nearly 15 minutes on the parse website but still can't figure out what it does. All I see is that it's an open source version of the Parse API. But what is the Parse API?

Since you've used it before, would you care to elaborate on what the Parse API does?


They were originally "backend as a service," basically a smart layer over mongo. They charged pretty obscene rates per request, but now it's all open source so no worries about that.

They provide a nice dashboard for creating Mongo collections (which they call Classes).

You write "cloud code" in JavaScript. You can write beforeSave and afterSave functions which are triggered before/after you save a document. You can also write "cloud functions" which execute within parse-server and interact with the database.

The result of this is that you can perform a lot of heavy lifting and consistency logic in one place, "the cloud." That way you can build clients in multiple languages (like an iOS app, Android app, web app) that only need to worry about their platform specific details.

Their original value prop was for building mobile apps, but since the ecosystem is pretty mature with a client in every language, I find the benefits extend to writing multiple clients for any purpose.


I'm curious: did you consider using Flask as a back-end, instead of parse-server? Is parse-server just easier than coding your own API back-end with Flask and whichever db you like?


No. That would effectively mean reimplementing all the logic of parse-server in flask. And when I was done doing that, I wouldn't have a client library in every language ready to interact with my backend.

Parse-server is definitely a faster way to start because it's already an API layer in front of the database.


If you want to do real time, give a shot also to Elixir/Phoenix.


We're using Elixir + Phoenix at http://udio.ai/ (with Postgres and Mongo). It's an absolute dream to work with. Best backend environment I've ever used. There are just so many niceties one runs into at every corner: doctests, umbrella projects, :observer.start, etc.


Not just real time Phoenix with Elixir is the most exciting framework for me today. Its what RoR was 10 years back. Developer happiness complemented with crazy fast response times.


Agreed, anything performance sensitive - and a lot of apps are - is worth the shot.

At the same time, you have to be aware the ecosystem is far from being mature. I am trying right now to use MongoDB and the last Ecto adapter seems to not be compatible with the other libraries.


Here is what I settled with for my website after trying a few things over the years. In the process I have discarded nodejs, JAX-RS, maven, Undertow, JQuery, bootstrap (partially) etc.

Currently, pure java servlets serve json over REST-like API. The jar dependencies are servlet-api.jar, a couple of json-related jars and an sqlite jar. Multiple fine-grained sqlite files for data. Tomcat as the servlet container with no static content.

A nodejs reverse proxy forks the API and static web requests between tomcat and another nodejs static webserver. The static content is angualrjs + html + css with minimal and reusable js files mostly fetching json data. I also have a little bootstrap dependency for forms.

I have an apache ant build file that copies the ~60kb war file and static content directly to the production from my dev system. Tried maven before but Ant seemed much simpler and more than enough for my needs. The ant build does a lot other things also.

I use Eclipse for the easy navigability across the code and other nice refactoring features. Ant does all the build work.

Earlier I tried pure nodejs (no java), then JAX-RS and then Undertow container etc. Nothing seemed simpler than the current setup. By the way, the site is https://worktheme.com


> A nodejs reverse proxy forks the API and static web requests between tomcat and another nodejs static webserver.

Just curious why you don't use nginx here. It will serve static files and proxy to the API. I'm sure the nodejs proxy was easy enough, but adding in gzipping files, rewrite rules, SSL, etc and it seems like nginx would even end up being more simple.


NodeJS rev proxy allows custom logic after intercepting requests - all in javascript. Not sure if NGinx would allow that. But yes, I would probably move to Nginx in near future for its tomcat-like robustness.


Your system of minimal dependency java is interesting. Do you have anything open source I can look at or otherwise get a dive into this technique?


Sure - Will publish to github and post here. For a brief note, the java servlets use Google's gson for interfacing wih web requests. Beyond that it is all plain old JDBC with sqlite. That is all to the "API" part of our service :-)


Come on, Java is a very rare language of choice for web development since I can't think of a popular website written in Java :|


It depends on what you mean by a "website". You need to understand that a web application need to have a client-side (managing user interaction) and a server-side (mostly fetching data). Java is still more popular than any other technology for the server-side part. May be you should read more. And think more.


I meant the back-end. Noone bothers to write the front-end with these languages ( ASP.Net is an exception ) when there are tons of great JS libraries avalable.


What would you like to make? They are all ok and can do whatever the other ones can.

A lot of people choose based on their primary preferred language, so if someone likes PHP they might use Laravel, if someone wants their stuff to be in Python they might use Django or Flask.

Go's ecosystem is not as mature yet and you'll have a harder time finding relevant resources or libraries.

Nowadays I prefer Javascript/React stuff because you can make much more "responsive" and nicer UI/UX with that setup as opposed to the way all those other frameworks work which is to push html back to the client that you "enhance" with some javascript.


If you just want to get up and running quickly and get normal stuff done easily go with RoR or Django (depending on if you prefer Ruby or Python as a language)

If you want to learn something 'new', exciting and interesting and put yourself ahead of the pack of where web development might be heading, go with Elixir/Phoenix. That's what I'm currently doing anyway.


My programming background : I spent 2 years on C/C++ (university) and Java quite lot time on that too, Rails ( which I'm currently learning ) and AngularJS.

What I'm planing to make is a website where people could share their ideas and consult relating to their ideas. ( Actually much of the process will be like Stackoverflow with some major enhancements )


Your question would be easier to answer if you were to share something about your programming background, and your objectives.

e.g. how experienced are you, which languages do you use already, if any, and what do you want to do (get a job, build a particular thing, build multiple CRUD sites, ...)


I just got out of my degree and have the exact same problem. I was thinking in getting a full-time RoR + react job because that's what many startups are using. However, I don't know the exact reasons they use it besides the large community. It's hard to make a framework choice without knowing what are the parameters to be considered when you have zero experience.


It's not clear to me what questions you're asking. I've re-read your comment several times, and I think you're asking one of the following:

A) Which web framework (e.g. Rails, Django, ...) should I spend time learning on my own, because it will help me get my first job after my degree?

B) Which full web stacks, including front-end (e.g. React or Angular) and back-end (e.g. Rails or Django) are popular among my potential employers, and why?

Is it A or B, or something else?

Also:

- What is your level of experience in programming? Zero? Some projects as a minor during your degree? Several years writing your own pet projects?

- What language(s) do you already use?

In choosing a framework to learn, you're not making a lifelong commitment. If you intend to be a professional developer for the next 40 years, I doubt you'll use the same framework or type of language for the whole time.

The most important thing is to pick something which allows you to be productive early on. That will help provide motivation to keep at it, to learn more, and to get better.

If you are starting out, then trying to learn Rails and React at the same time seems like a steep path. Unless you have a lot of concentrated time, you might be better off learning one at a time. If you pick React first, then build a React app that consumes some existing APIs. If you pick Rails first, then build server-rendered sites first. Then learn to present the same content via APIs. Then add React.


EXPERIENCE:

Yeah, some programming experience with: Java, C, C++, python, javascript, ruby and php. I have build some simple android and desktop apps. Nothing production quality.

------------------------------

CHOOSING A FRAMEWORK:

These are some things I have been considering (the list falls short):

-Does it attract good developers? is the community large enough?

-Fast prototyping.

-How will it handle scaling issues? new features?

-Are companies moving away from it? why?

------------------------

JOB:

Anything that uses the framework I pick. I was thinking RoR/React but it's just a thought.


Picking a framework to get started isn't a lifelong commitment. So trying to optimise for these 5 factors (the 4 you listed, plus being able to get a job) at the same time is overkill, and unlikely to result in a better decision.

Just pick one. You will not regret starting with Rails or Django, providing you put in sustained effort to learn best practices.

Re: 'fast prototyping', the RoR+React combo won't give you that. De-coupling the front-end and back-end of your code has many advantages, but fast prototyping is not one of them. Particularly as you'll be learning as you go, with two different languages (Ruby and JS) and two frameworks, you'll spend twice as much time stuck.


For the JVM -> Play is excellent, especially with Scala.

For Ruby -> Rails

For JavaScript -> Node.js/Meteor (Quick dirty demos)

For Python -> Django


Which programming languages do you know?

React is the most popular clients ide framework, Rails is still the most popular serverside.


Sorry, I think React was not Client-side framework, it's only "A JAVASCRIPT LIBRARY FOR BUILDING USER INTERFACES" (taken from it's website). As we know, it's like jQuery, few people call it "Javascript Framework", but it's only "Javascript Library". CMIIW, thanks before :))


I don't think rails is the most popular worldwide. Almost certainly that is PHP. Perhaps in your circles rails is popular. I know view few rails programmers myself.


PHP isn't a framework though.


It more or less is. It's a language and a web framework. That happens to have other frameworks built on it.


Sorry for late reply but I am genuinely curious on how you think PHP is a web framework? At best you can say it has routing built in, but no one even uses just php files as they are for "routing" anymore. How else is it a web framework? Especially over other scripting languages like Ruby that have a strong focus on web dev, but are just languages?


No actually you don't what a programming language is! PHP is a web programming language ( Not a General purpose one though ) which is completely a different stuff from a framework. Laravel is a framework written in PHP. Like the fucking Django framework which you can't think of any other modern technology. I loathe dinos who just stick to an old programming language ( like C )


Would be surprised if React was more popular than Angular 1.x, but it definitely has more traction than both 1.x and 2.


If you are starting out without experience, I would choose based on which one has the best tutorials available.


Which to me is DJango or Rails, with my vote for DJango.


Would you to read this article: www.phpthewrongway.com? I hope you got some inspiration! Cheers.


iOs: Swift (or React Native to use only Javascript)

Android: Kotlin (or React Native to use only Javascript)

Web app: Ruby + Rails >= Go > Python + Django > PHP + Laravel

Client-side app: React + Redux


All of them are good enough. There's no best.


Completely agree with you. None of them could beat one another. In fact,I believe one should learn all of them and choose to work with the one appealing to him/her.


Surprised you dont mention nodejs in your picks




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: