News for hackers. Stuff that matters.
Re:Ask HN: What stack would you use to build a CRUD web app ... by theli0nheart on Saturday March 03, 2018 @08:23AM (#16509176)
I work with startups, so I make this decision every 2-3 weeks or so.

Language: Python. Python is easy to learn for those that don't know it, and all-around liked. It's not hard to find engineers with existing experience if you need to grow.

Framework: Django. Django does everything you might want in a framework. It scales with larger teams, and the admin is still one of its killer features.

Frontend: SCSS/SASS, and vanilla JS with some jQuery sprinkled in. When (if) the team/product grows, figure out which frontend framework fits best.

Database: PostgreSQL. Well-maintained, reliable, and great documentation.

In-memory cache: Redis.

Infrastructure: AWS. EC2 for hosting, S3 for file uploads and static file storage, CloudFront for content delivery.

Web server: nginx. Let's Encrypt for SSL cert generation.

App server: gunicorn. It works.

There are probably a few other things I'm missing but these are the big ones! All of my clients from years back (a few who now have 20+ people on their engineering teams) are still using this entire stack, so it scales both technically and as the number of team members grow. Happy to answer any questions!

Re:Ask HN: What stack would you use to build a CRUD web app ... by zengid on Saturday March 03, 2018 @12:33PM (#16510380)
>> .. and vanilla JS with some jQuery

If I could I'd buy you a beer and cheers you for relieving my JS anxiety a bit. I love jQuery, and I'm tired of feeling ashamed of it, damnit!

Re:Ask HN: What stack would you use to build a CRUD web app ... by jgoodhcg on Saturday March 03, 2018 @12:56PM (#16510512)
I don't think that quote justifies your love of jQuery. The keywords are "some" and "sprinkled in". In my experience jQuery always trends towards a huge mess the more it is used.

Sure, it could be used but it really shouldn't.

Interacting with the DOM in a procedural way, and storing state on the DOM is always going to be harder to manage than using a reactive pattern when you trend towards more complexity.

Re:Ask HN: What stack would you use to build a CRUD web app ... by zengid on Saturday March 03, 2018 @03:22PM (#16511352)
It's s CRUD app! You don't need everything to be a SPA with a heavy weight framework!
Re:Ask HN: What stack would you use to build a CRUD web app ... by mercer on Sunday March 04, 2018 @06:54AM (#16514392)
You can use something like Preact for little widgets here and there. It's not one or the other!
Re:Ask HN: What stack would you use to build a CRUD web app ... by golergka on Saturday March 03, 2018 @01:41PM (#16510786)
Really depends on what level of complexity we're talking about. Simple form with a couple of fields or something like gmail?
Re:Ask HN: What stack would you use to build a CRUD web app ... by drinchev on Saturday March 03, 2018 @03:37PM (#16511424)
jQuery is no better ( these days ) than Vanilla JS, which you will love as well especially if you choose to use ES6 syntax.
Re:Ask HN: What stack would you use to build a CRUD web app ... by Something1234 on Sunday March 04, 2018 @08:42PM (#16518077)
`document.querySelectorAll` is amazing. It's a unification of the css syntax and javascript. No more filtering it your self, and your standard javascript stuff still works. It's wonderful.
Re:Ask HN: What stack would you use to build a CRUD web app ... by brandfountain on Saturday March 03, 2018 @08:03PM (#16512696)
All of this except Django, overkill for many small and mid sized projects. I use a lightweight Bottle/uwsgi api to get json into _underscore templates. Up and running in ten mins :)
Re:Ask HN: What stack would you use to build a CRUD web app ... by theli0nheart on Saturday March 03, 2018 @08:10PM (#16512726)
I have a CloudFormation template that sets it all up for me in about 5 minutes (gets a little tiresome to do the same thing over and over again). Booting an EC2 instance and installing the necessary packages takes the bulk of that time. I spend about 30 seconds setting the project name and domain name, make some coffee, and by the time I'm done everything is up and running. The template sets up the GitHub repository, provisions the entire stack, and sets up auto-deployment, amongst a lot of other things.

Shameless plug: I'm currently looking for beta testers to use this provisioning tool, so if you're interested in trying it out for your stack, send me a note (email in profile).

Another commenter mentioned that EC2 was relatively expensive. Technically, that's true, but the sheer power of being able to automate everything in the infrastructure is pretty awesome.

Re:Ask HN: What stack would you use to build a CRUD web app ... by golergka on Saturday March 03, 2018 @01:40PM (#16510779)
I always had a question I wanted to ask an experienced Django dev. After trying this framework for a couple of hobby projects (I'm a client game developer primarily and never worked on "serious" web project), I kinda got the impression that it's architecture is created for two main user roles: admins who create most of the content and have marvelous admin forms in front of them to input all the data, and users, who mostly consume the content and only occasionally input some data. When I tried to create complex input forms with a lot of complicated, relational data that users would be able to input and modify, it felt so much harder than exposing the data models in the admin panel — it really felt that this wasn't the use case this framework was designed for.

Did I get the right impression, or may be I just didn't learn to use Django correctly?

Re:Ask HN: What stack would you use to build a CRUD web app ... by ioddly on Saturday March 03, 2018 @05:45PM (#16512131)
From the Django tutorial:

> Generating admin sites for your staff or clients to add, change, and delete content is tedious work that doesn’t require much creativity. For that reason, Django entirely automates creation of admin interfaces for models.

> Django was written in a newsroom environment, with a very clear separation between “content publishers” and the “public” site. Site managers use the system to add news stories, events, sports scores, etc., and that content is displayed on the public site. Django solves the problem of creating a unified interface for site administrators to edit content.

> The admin isn’t intended to be used by site visitors. It’s for site managers.

https://docs.djangoproject.com/en/2.0/intro/tutorial02/

Re:Ask HN: What stack would you use to build a CRUD web app ... by bennylope on Sunday March 11, 2018 @11:29AM (#16563311)
It sounds like the "out-of-the-box" expectations created by the admin app are the problem. I mean, hey, Django makes exposing data models in the admin interface trivial! You can certainly create more complicated forms for relational data, but in those cases you can't rely on Django's default functionality to do as much for you. I've written or worked on more than a few serious apps including those with more complex user facing data and Django's worked beautifully. Happy to answer any specific questions you might have.
Re:Ask HN: What stack would you use to build a CRUD web app ... by theli0nheart on Saturday March 03, 2018 @04:40PM (#16511761)
> When I tried to create complex input forms with a lot of complicated, relational data that users would be able to input and modify, it felt so much harder than exposing the data models in the admin panel

Hmm, really interesting. I can't say I've ever run into this, and maybe it's just that Django is so good at the admin stuff, it makes everything else look hard in comparison.

Most forms I have start off as subclasses as ModelForm. If I need to combine two forms on one page, I just give the form a prefix and populate them both within the same <form> tag. I'm not sure if this is the sort of more "complicated" use case you were thinking of, but y4mi's suggestion of breaking forms into sections with wizards is another great way to go about it.

Re:Ask HN: What stack would you use to build a CRUD web app ... by y4mi on Saturday March 03, 2018 @02:24PM (#16511019)
i'm not an experienced django dev but i asked the same question some time ago. The answer i got back then was essentially 'one form per object, if you want to create two interdependent objects, just chain the forms into a "wizard"'

it kinda makes sense, considering how easy it is to create form views

Re:Ask HN: What stack would you use to build a CRUD web app ... by ioddly on Saturday March 03, 2018 @05:46PM (#16512151)
Oh hey, you already made my post for me!

I do prefer React for when a frontend framework is appropriate, but I also think that's not always the case.

I think there's a lot to be said for familiarity. Rails instead of Django? Sure, if you and the folks you're working with know it better.

Re:Ask HN: What stack would you use to build a CRUD web app ... by graystevens on Saturday March 03, 2018 @12:24PM (#16510320)
Looks like exactly what I would suggest, although I’d argue EC2 might be slightly overkill. You’d get more for your money with Linode/DigitalOcean/OVH or even Hetzner’s new cloud offering. Will help save some pennies early on.
Re:Ask HN: What stack would you use to build a CRUD web app ... by dmarlow on Saturday March 03, 2018 @03:39PM (#16511435)
In-memory cache: Redis.

Do you typically run Redis on the same host as your web server? Treating it as "in-memory" can have interesting side effects as you centralize it and introduce network delays.

Re:Ask HN: What stack would you use to build a CRUD web app ... by theli0nheart on Saturday March 03, 2018 @04:32PM (#16511702)
> Do you typically run Redis on the same host as your web server?

Yes, at least initially.

> Treating it as "in-memory" can have interesting side effects as you centralize it and introduce network delays.

I'd love to hear more about this!

Re:Ask HN: What stack would you use to build a CRUD web app ... by dmarlow on Friday March 16, 2018 @06:29PM (#16604443)
Sorry, totally missed this because there is no notification system here...

Let's say you have a large, tight loop in which Redis is used. If it's local, great, no problem. Now when it's centralized, you introduced a network delay you hadn't planned for. This "gotcha" comes up when you mess around with cache locality and didn't account for the delay changes in all areas of code.

Re:Ask HN: What stack would you use to build a CRUD web app ... by bojanstef on Wednesday March 07, 2018 @01:41AM (#16534692)
Is there any way you could create (or link) a small, open source app that uses these technologies.

Something good for beginners? I realize I'm asking for a lot but I might as well ask.

Re:Ask HN: What stack would you use to build a CRUD web app ... by Waterluvian on Saturday March 03, 2018 @03:49PM (#16511487)
What parts of jquery do you use today? I ask because my impression is that it's simply not needed anymore with the better DOM interface methods like querySelector
Re:Ask HN: What stack would you use to build a CRUD web app ... by theli0nheart on Saturday March 03, 2018 @04:28PM (#16511678)
A lot of it has been simplified thanks to API improvements, but simple element manipulation, event handling, etc. is just a little bit easier with it than without. The special ":hidden" selector is just one example I grabbed from opening a recent JS file (e.g., `$(selector).is(":hidden")`).
Re:Ask HN: What stack would you use to build a CRUD web app ... by mlevental on Saturday March 03, 2018 @08:37AM (#16509202)
I picked all of these things for my startup 6 months ago except I'm using Vuetify with Vue. just like it doesn't make sense to rebuild everything that Django provides it doesn't make sense to rebuild all the UI components Vuetify provides.
Re:Ask HN: What stack would you use to build a CRUD web app ... by shmooth on Sunday March 04, 2018 @05:46AM (#16514174)
what does this mean in English?