Ask HN: Kotlin SpringBoot vs. Python Django for Min Viable Product

22 points by slroger 5 days ago

Hi everyone, I am a backend developer using Spring Boot and Java. I also know some Angular. I had an app idea and wanted to build out the backend in either Kotlin+SpringBoot or Django+Python. I already know Python from prior experience but was wondering which one of the two combinations would be faster for prototyping. I know Django works well since it was used for Instagram. It would be easier on me if Spring Boot+Kotlin is a comparatively good choice since I already use Java+Spring Boot. I dont plan on using Java for the app since it can be a bit verbose at times and Django already has authentication included unlike Spring Boot with Spring Security. The app idea is a social networking application so it would need users, likes, comments, messaging and an activity stream/news feed. what are your thoughts?

natbobc 2 days ago

> I am a backend developer using Spring Boot and Java.

If your goal is speed to market use what you know which is Spring Boot and Java.

If your aim is to learn something new then go with Django or sprinkle in some Kotlin incrementally (eg tests). I don’t think it’ll matter in the long run which you choose.

Conflating I want to learn something new with I want to deliver quickly will give you a suboptimal outcome for both.

JamesLeonis 2 days ago

In the spirit of "build one to throw away,"[0] consider making a prototype you can show off to potential users and friends. Use it as a glorified presentation to validate your idea. I did that with my current project by treating the "first" version as a hackathon prototype (no users, no security, no DB, terrible coding style, etc) that I could put in front of people and present my idea. I didn't bother with anything but speed so I could quickly validate. Once I had a good grip of my idea from feedback, I could sit down and plan a proper MVP.

Another thought is to use your idea as a springboard to explore those two technologies. Write three toy versions of your idea in each language/framework (Kotlin, Python, Java) that gives you a Rosetta Stone to compare their respective ecosystems.

[0]: https://en.wikiquote.org/wiki/Fred_Brooks#The_Mythical_Man-M...

> The management question, therefore, is not whether to build a pilot system and throw it away. You will do that. […] Hence plan to throw one away; you will, anyhow.

mmarian 2 days ago

Django also has an ORM with database migrations built in, which will speed things up. And if you're ever planning on leveraging data science / AI, it'll be a lot easier with Python.

Still, depends on your willingness to learn (and remember) a new programming language and framework. It's hard when it's not part of your day job.

kukkeliskuu 2 days ago

In my experience Django has much less boilerplate, so it is faster to develop in, especially traditional CRUD apps, if you had equal experience in both. It has admin, authentication, migrations etc. built-in.

The downside of Django is that while the initial DX is good, once you go into a little bit deeper, you need to learn how certain things should be done -- let's say if you use built-in forms and you want to create a inline formset with typeahead component. Well, it applies to Spring as well. Overall, Django still wins.

If you choose Django, try to do as much as possible in traditional Django way, meaning 90s form posting and full page load instead of single-page apps. That will be much quicker.

You can sprinkle some interactivity where you need it, for example using django-components, AlpineJS and HTMX. I would not use Angular (or Vue or React).

In any case, I would not optimize short-term productivity. This means I would not choose language because I had more experience in it.

You will be iterating much more than you are anticipating right now, because you can never really know what features give you traction. It is much better to optimize for long-term productivity, i.e. choose the best tool.

  • pennomi 2 days ago

    You can also use Django REST Framework to make your API in a wonderfully simple way. Then build your single page app in whatever method you prefer.

    • kukkeliskuu a day ago

      Yes you can, the question is whether you should, and if yes, to what extent.

      Developing SPAs as compared to traditional web pages with Django is at least 10x more work.

      In my experience, on most websites, on 80% of pages SPA gives very little additional value. Many non-essential pages are required to run on production, but especially if you are working alone, you should use the minimal effort to make them.

      Such pages are for example: registration, password reset/ change, support pages, static pages (contact, background info etc.), payment flow, requesting permissions, suggesting new resources for approval, all administrative pages etc. Most of these are not needed for an initial proof of concept, but they are required before going into production.

      For example, I created a website, a dance event calendar, which has approximately 200 views. (And 2M page views per month). Around 80 views use the Django admin -- so they work out of the box. Around 20 are for end users (no login is required).

      The remaining 100 are for entering data (i.e. CRUD) and the pages mentioned above, by approximately 300 data admin users, and only few of these pages are used very often.

      From these, only few pages really benefit from being a SPA. Of course this site is an extreme example, because for the page load time is the most critical factor for the usability -- and I can cache most of the data.

      One of of the pages which benefit from interactivity is where data admins mass-enter data (i.e. enter multiple events on single form). This was implemented using HTMX, which works really nicely with Django.

Sevii 3 days ago

I'm a fan of Spring Boot + Thymeleaf + Htmx. Django is a proven platform for the kind of app you want to build so you likely will be fine either way.

KronisLV 17 hours ago

If iteration speed is the main priority, I'd suggest you go with Django.

I've worked with Java and Spring/Spring Boot for years and while you can get most stuff done reasonably quickly, there are stacks out there that will let you iterate faster (Ruby on Rails, Python with Django/FastAPI, PHP with Laravel, Node with Express etc.).

Personally, in some cases I'd also limit the usage of Java/Django/whatever to the back end API (a boring RESTful one) and write a SPA in Vue to consume it, since it's powerful enough to get things done but not too much so to the point of getting in your way (e.g. React or Angular, personal preference, some people won't like Vue and will prefer Svelte, others HTMX, it depends). On the other hand, SSR still will be faster to iterate with, even with the coupling.

As for auth, I'd outsource to Auth0 or any other OpenID Connect provider. I've also self hosted Keycloak and use mod_auth_openidc to simplify it, but it was quite annoying to setup, so going for an industry standard protocol on top of whatever SaaS makes sense seems sane.

alentred 2 days ago

I would go with whatever I know best. Whichever you chose, your productivity won't depend on the technology per se, but how familiar you are with it - when doing MVP/prototypes the tech needs to not get in the way, all else is doable with whatever stack you chose.

Having said that, you seem to be choosing between a language you know with a framework you don't, and the other opposite. Maybe there is a way to stick to both language and a framework you are familiar with?

DataDive 2 days ago

Python, in general, would be much faster for prototyping than Java.

That is the main attraction of Pyhon.

  • threeseed 2 days ago

    As someone who has developed commercially in at least a dozen languages I couldn't disagree more.

    There is no one language that is faster at prototyping than others. It's purely based on whatever you experience is and what aligns most with your way of thinking.

    Some people like me need strong typing and functional constructs to be productive. Others are the complete opposite.

    Some people would instantly gravitate towards SPA for anything web based others would go for SSR.

    etc etc.

constantinum 3 days ago

The documentation for Django has consistently been cited in this forum as an excellent example of thoroughness and best practices.

brudgers 3 days ago

It doesn't matter. Choosing a framework is not actual work. When you are not building, neither has advantages, and you are not building.

Sure, maybe one or the other might make the work marginally easier. But it is going to be hard work no matter what...if you build of course. Not building is the easiest path by far, and there is nothing wrong with not building.

The app idea is a social networking application so it would need users, likes, comments, messaging and an activity stream/news feed.

The hard part of building a social networking app is getting a bunch of people interested in doing those things with it. They don't care about your technology. And they damn sure don't care about how easy or hard it was for you to build.

Good luck.

tomerbd 2 days ago

Coming from java spring and knowing some python looking around - I decided I would django for side projects and leave java and spring for my day job. I think it's more suitable for side projects.

openplatypus 2 days ago

I will echo others: you will prototype fastest in things you know.

I can whip an MVP working in Spring before I learn how Django ORM works. Because I am so familiar with it.

vladi160 2 days ago

The fastest way is what you already know (Java/Spring). It doesn't matter, how fast for development is the other (Python/Django).

dzonga 2 days ago

whatever you know best.

all those are decent options.

camjw 2 days ago

Use whichever one you know best already

shortrounddev2 2 days ago

I don't use dynamically typed programming languages anymore so I'd say kotlin

  • IshKebab 2 days ago

    I would agree although it's worth noting that Python has static typing and if you use Pyright you actually get a pretty solid typing experience. Not quite on par with Typescript but I'd say it's a better experience than Java for example.

    The big catch is that little "if" I snuck in there. Unfortunately most Python developers don't use Pyright, which means you'll inevitably have to work with coworkers who just don't get it, or libraries that don't have type stubs. So in practice if you're working with other people/libraries it's a much worse experience than Kotlin or Typescript.

    Add in Python's abysmal infrastructure story and... yeah don't pick Python unless you have a really good reason. Django is a decently good reason, but I'm not sure it's enough.

greenthrow 2 days ago

Whatever you already know how to use is going to be faster. Obviously.

Second, you are worrying about all the wrong things. Nobody cares what language you use. What matters is are you building a useful product that actually fits a real need?

nprateem 2 days ago

I evaluated both for my latest project. I wanted to go with Spring Boot for static typing.

In the end I went with django for one reason: The admin.

Why there's nothing comparable in the java world I don't know, but for an early project it's invaluable to be able to focus on your app while having a good enough admin.

Almost everything else favoured Java tbh (cheaper devs - unlikely for kotlin though, static typing, performance, etc).

Having said that, their REST thing was garbage. I seem to recall it didn't play well with the DB repos or something. Django ninja is much better from what I've used so far.

Oh yeah, also I recall you're right about the lack of user registration stuff. I read most people use keycloak or something, but that's still more stuff to run and wire up than django allauth.

Also I'd question why you want to write the app in a different language. It'll double your work for little gain unless you have real need. Just chuck a Web shell around a responsive website and fill the gaps for the native stuff.

  • ailef 2 days ago

    For the admin part, check out http://snapadmin.dev

    It's my open source project which provides similar functionality, although not nearly as complete (and as well maintained) as the Django alternative.

    • victor106 2 days ago

      this looks great!!! I think yours is very close in capabilities and features to django admin. What things do you think are missing?

      • ailef a day ago

        Thanks! I think the Django one allows more stuff like e.g. layout customization. I haven't used it extensively so it was more of an assumption honestly! It's been around a long time and I just spent a couple months on my project instead.

    • nprateem 19 hours ago

      Awesome! I'd been hoping someone would make one.

shams93 5 days ago

Django is going to get you up and running and in business, while springboot is much harder to deploy.

  • slroger 5 days ago

    thanks I thought the same. Will focus on django

    • ysleepy 2 days ago

      While I hate Spring, it is much easier to deploy than django/python projects.

      Spring is a single-file deployment and apt install openjdk, while django needs a venv or a whole container, dependency installs on the host etc. it's not even a contest.

  • coldtrait 2 days ago

    What's the recommended deployment platform for Django?

nie100sowny 2 days ago

Friend, avoid those leaky abstractions with milions of pages of docs for all cost!

Just use Kotlin+Ktor/http4k+Exposed+Postgres or alternatively more old school Java+Javalin/http4j+JOOQ+Postgres.

Benefit from serverless or services like GCP cloudrun