9 ms·
This seems like a good simple stack. Can it get more simple? I've been trying to envision the best stack for small weekend projects that will see 3-4 users a mo
by jacktheturtle 5y ago
This seems like a good simple stack. Can it get more simple? I've been trying to envision the best stack for small weekend projects that will see 3-4 users a month.
Ideally: Monolithic, 1 Language, No need to write your own APIs. Just direct access from the View.
- sixhobbits 5y agoif you don't want fancy partial-page reloads and UI interaction, then just Flask + HTML also works.
- dannywarner 5y agoAgree. Simple Flask and HTML gets you a long way and is easy to deploy and manage.
- jacktheturtle 5y agoMight want to give this a try. Thanks for sharing!
- dfinninger 5y agoFlask will take you pretty far. I'm not sure I would build a build a business around it, but it's the easiest thing I've found for just getting some code up on the web. This tutorial is a pretty in-depth guide that incrementally adds more features to a flask app: https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial... By no means do you need to use everything in here, but I reference it from time to time. This is plenty: from flask import Flask, render_template app = Flask(__name__) @app.route("/") def index(): return "<h1>hello world<h1>" @app.route("/foo") def foo(): return render_template("foo.html", vars={"foo": "bar"}) if __name__ == "__main__": app.run()
- bckr 5y agoI work at a company pulling real cash, built mostly on Flask. Flask is one of the things I like the most about the stack.
- toastercat 5y agoEven better: Bottle.py; single-file dependency, includes routing and a simple templating engine.
- atoav 5y agoNot sure if bottle is really "better" — it has different pros and cons compared to Flask, so whether it is better depends entirely on the usecase. If you e.g. have a use case where your dependency-situation is one where you won't benefit from bottle being single-file (because you e.g. have a ton of other non-single file dependecies), then choosing it over the widely used Flask might not be show you any benefits at all.
- toastercat 5y agoI was responding to the request in the top comment for something simpler that can be used for weekend projects. In this case, Bottle.py is "better" in that it is more simple than Flask; not that Bottle.py as a web framework is objectively better than Flask. For the record, I've used both, and Bottle is much faster to get started with. The docs are also much leaner.
- lambdaba 5y agoMeteor does this, in JavaScript, with built-in database and no writing of APIs, code is shared between client and server.
- jacktheturtle 5y agoI should give this another shot. I haven't touch it since 2017
- erokar 5y agoI think Rails is the best fit for this, alternatively something like SvelteKit + Supabase (the latter if you need a db).
- jacktheturtle 5y agoRails is awesome, I'm a huge fan. I just think there's a huge ramp up out of the box. I wish I knew how to go from rails init -> dashboard w/ login faster.
- boundlessdreamz 5y agoYou can use bulltettrail https://bullettrain.co/ https://bullettrain.co/ which was recently made opensource (+ paid pro features) for an easier ramp
- jms55 5y agoElixir + Phoenix/Phoenix LiveView is very good at this. LiveView lets you change state on the server, and have it reflected on the client. Or, when the client does an action, do something on the server (that can then trigger another state change on the client, etc). All of this is purely using Elixir - no need to write JS 99% of the time.
- danpalmer 5y agoOne of the benefits of PHP is the single page idea, where the file system directly matches the URL structure. For quick and dirty projects I’ve always wondered what a Python version would look like. Maybe Jinja2 pages, a place to define extra code to be run or a custom ninja tag for longer sections of Python, and a binary to launch the whole thing as a server?
- ramchip 5y agoPhoenix LiveView works great for this.
- toastercat 5y agoReplace Flask with Bottle.py. It's a single-file dependency (don't even need pip) and includes routing, and a templating engine. Super simple to prototype and iterate a backend API.
- farmin 5y agoThis is what I started doing. Bottle has user auth plugin called cork that is handy too. All very simple to understand. I did start using jinja instead of the built in template engine though.
- mekoka 5y agoIt really depends what you mean by simple stack. You mentioned "weekend projects", which indicates that you value development productivity. You want to be able to do more with your allotted time. The way we tend to envision a "simple stack" is to mean a combination of lighter and possibly specialized tools. But does that necessarily translate into quick development? Your choice of tools still relies on your experience with them individually. I often see people advocating for microframeworks when this question comes up. As a long time user, I would say sure, but with the caveat that they come with very few batteries, and sometimes fewer opinions. To me this is also the promise of many future decisions to be made, by you. How much time does a single decision typically cost you? Also, the size of your project's audience, doesn't imply that the app needs considerably less dependencies, than something more ambitious popularity wise. The difference usually lies in the infrastructure that will eventually specifically address scalability. I think a good simple stack for week-end projects should aim to get you from install to development fairly quickly. Don't waste time making too many technical decisions beyond the choice of tools. Spend half an hour setting up a container, design your database, and get to work. If some other people have already spent time working out what's best in 90% of cases, use that experience first. Find out later that your case falls within the 10% that doesn't apply. --- Now, for some more practical recommendations. I think Django's opinionated batteries make it a more compelling solution for "week-end" type projects. Does it matter that it installs megabytes on disk, of which you end-up barely using a few KBytes? For most cases I don't think it does. My stack suggestions for week-end type projects on the back-end will be heavily Python-centric (except for Ruby-On-Rails): - Django|RoR, Postgres: Opinionated batteries. Just hop on the train and simply let it drive you. - Flask, Psycopg2, Postgres: when you're already comfortable replacing most things Django offers for free, with your own assortment of best-of-breed tools and practices (testing, templating, etc). Working with Psycopg2 implies that you're reasonably comfortable working directly with SQL, and willing to spend some additional time working out the various kinks that inevitably need addressing, when managing your own connections to the database. - Flask|Django, Postgres, SQLAlchemy: Only if you already know SQLAlchemy. If you don't, just trust that you won't learn it in a week-end.