5 ms·
Ask HN: I want to write a simple webapp, how should I start?
First of all, thanks for reading this, you probably have read it many times before.
So, here is what I want to do: I want to index some of my magazines. My webapp should have a search field, where I can type in a single phrase or look up complete issues.
I know that I need a database in the backend for this (that I need to populate).
But since I have no experience in developing (neither web nor other) and only possess a "dangerous half knowledge), I'd thought I ask your advice.
Which road should I start on? PHP + MySQL would be the first to come into my mind, but since I'm a clean slate, would it make sense to start with something completley different (and maybe as accessible)?
Thanks for taking the time to read and answer, looking forward to your input.
- deleted 12y ago[deleted]
- techaddict009 12y agoIf you want to go up with PHP then better use Laravel + Mysql or Postgresql. And if you want to learn you can opt for laracast.com videos. They are one of the best resource for laravel. P.S Laravel is one of the best PHP based framework.
- jagermo 12y agoThanks for the answer, I haven't thought of using a framework. Looks interesting. Any downsides to using a framework?
- collyw 12y agoFrameworks will give you a lot of learning to do up front, but it will pay off in the log run. PHP will be easier to get started with, but you will probably create a bit of a mess if its your first application. Maybe a microframework (like Flask) will make you do to enough things correctly, without being to much of a learning overhead.
- musicalentropy 12y agoA lot of people is talking about Laravel. I'm new on web development, and I thought that Symfony 2 was more popular. Any specific reason for prefering Laravel to Symfony ?
- techaddict009 12y agohttps://news.ycombinator.com/item?id=9284803 https://news.ycombinator.com/item?id=9284803 One person replied to this here.
- coreymaass 12y agoIt depends on your motivation. Do you want the tool? Or do you want the experience of building it? Is it just for you, or do you want/hope/expect other people to use it? If it's just for you, and you just want the tool, use a google spreadsheet. If it's just for you, and you want the experience of building it, then create a simple PHP script, and use a flat file to store your magazines. If your hope is to build a "real" web app, with user accounts and all that, then you've got a lot of choices. Start with a list of features and functionality you want in your app, and put them in order of priority (including "user signs in", "user recovers password", etc). Choose a technology, and start piecing together those features. Use stack overflow, and find communities for the technology you've chosen. Ask for help often. Take your time, and have fun.
- jagermo 12y agoThanks. It's just for me, I was hoping to use it as a kind of springboard to get into coding. I used a few of the ressources (including Learn XX in XX days), but I think I'll learn best, if I have something to work on. So I'll probably go for the real web app part, just to learn. It'll be ugly, probably, but hey :)
- coreymaass 12y agoThat's a great answer. It's a great example app for learning on. How it looks isn't important. There are plenty of tutorials out there for building a simple CRUD app. I think those would be a good place to start.
- tehwebguy 12y agoTry Base Rails: https://www.baserails.com https://www.baserails.com It's not free, but you can run through at least one of their full blown web app tutorials in less than a month so you'll only pay $25. I've been helping a friend who is trying to learn to build webapps and this has been his favorite resource so far.
- jagermo 12y agoThanks, I'll have a look at that. The courses look really interesting. Hmm.
- alexyang21 12y agoHey I'm Alex, one of the cofounders of BaseRails. There's a lot of great advice in this thread already, but here are my two cents. Learning the fundamentals of coding is somewhat different from learning to code to build X. If you're focused on the latter, find a good tutorial on how to build something similar to X (or a simplified version of X). You'll pick up the basics of the language/framework along the way, and when you've finished the tutorial, you can then customize what you've built to match the app you were envisioning all along. If you have any specific questions about BaseRails or Rails/coding in general, I'm happy to help. Feel free to reply back here or shoot me an email at alex@baserails.com.
- charlieegan3 12y ago> But since I have no experience in developing (neither web nor other) I'd try and get some basic programming in first. Javascript makes sense if web development is the end goal.
- jagermo 12y agoI tried it, however I want to build something with this try. I always have had problems following through, if I was just building some kind of placeholders.
- collyw 12y ago"Web development" can cover a lot. JavaScript makes sense if you want to be more font end focused. PHP or Rails (or Django or Flask) make more sense for back end focused stuff.
- jagermo 12y agoYes, I know, its a little vague. But that's how it is if you look at it from the outside, I guess. There are so many languages, frameworks etc so it is kind of hard to find the right starting point. One of the reason why I asked here :)
- jekrb 12y agoJavaScript makes sense for the backend stuff too. (io.js, node.js)
- colund 12y agoLearn from W3Schools tutorials HTML http://www.w3schools.com/html/default.asp http://www.w3schools.com/html/default.asp PHP+MySQL http://www.w3schools.com/php/php_mysql_connect.asp http://www.w3schools.com/php/php_mysql_connect.asp
- jagermo 12y agothanks, those look like really nice ressources. Bookmarked.
- zuck9 12y agoDon't rely too much on them. http://www.w3fools.com/ http://www.w3fools.com/
- jagermo 12y ago>>For many beginners, W3Schools has structured tutorials and playgrounds that offer a decent learning experience. However, it would be a mistake to continue your education without learning from more reputable sources, so when you're ready to level up, move on. Oh thank god, I thought I had stumbled in some kind of developer flamewar there.
- ptrk 12y agoMiguel Grinberg created an awesome step-by-step guide for building Python Flask applications: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-...
- jagermo 12y agoUhhh, thank you. I was interested in using Python, since it seems so omnipresent when you look at the it security space. So this might be a great alternative to PHP (at least for me...)
- rahimnathwani 12y agoHe now has a book, too: http://www.amazon.com/Flask-Web-Development-Developing-Applications/dp/1449372627 http://www.amazon.com/Flask-Web-Development-Developing-Appli...
- makaimc 12y agoI agree Miguel's tutorial is fantastic for a step-by-step walkthrough. He also has a video to cover much of the material: http://pyvideo.org/video/2608/flask-by-example http://pyvideo.org/video/2608/flask-by-example If you're going down the Python route I'll throw in Full Stack Python http://www.fullstackpython.com/ http://www.fullstackpython.com/ I wrote FSP to provide beginners with context as to what these terms like web server, WSGI server and platform-as-a-service mean without assuming you have prior programming experience.
- krapp 12y agoIf you go with PHP, I would suggest learning how to use Composer[0], PHP's sort of de facto package manager, to organize your project. What you're describing seems like a really simple application, but even so, with dependency management, a router and the PSR autoloader it's much, much easier. Of course, choosing another language (Python, Ruby, whatever) will likely mean choosing a framework and the package manager for that language, but with PHP you have to decide whether or not to use package management or a framework on your own. The minimum viable product version of this as I see it can be done within a single PHP file, so it could be argued that the extra complexity isn't strictly necessary. If you're working in Windows, Xampp[1] makes it very easy to set up a local server and test PHP applications on your own machine. [0]https://getcomposer.org/ https://getcomposer.org/ [1]https://www.apachefriends.org/ https://www.apachefriends.org/
- jagermo 12y agoWow, thanks, haven't thought of that. I was thinking to use either a virtual machine or the LAMPP stack on my NAS/Raspberry. I tried Xampp, but it kind of screwed with my installation back than. Plus, the Pi isn't really doing anything, time to change that.
- ssiddharth 12y agoIf you're going the PHP route, I recommend Laravel. It's easy to pick up, there's a ton of interest and plenty of places to teach you. They even have a neat little Vagrant box to help you with the initial set up.
- grandalf 12y agoSounds to me like indexing the magazines is perhaps the most challenging aspect of this.
- jagermo 12y agoYeah, data entry will be a whole lot of work. But since it is just for me, I can take my time :)
- NhanH 12y agoIt's not just data entry. The actual search aspect is gonna be challenging (it's not harder than the web itself, but you need to know where to look, the keyword would be either "Lucence, "Solr" or "Elastic Search", for the record). One thing I want to note is that you didn't mention which "kind" of webapp development you care about (ie frontend, backend or both). Roughly, the distinction is whether you care about making a website (the part where people look at) whether you care most about just the functionality part of the webapp.
- jagermo 12y agoHm, interesting point. Although I don't think it will be a lot of data, but I'll look into it when I have it up and running.
- wyager 12y agoI would recommend not using PHP. http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ Here are some suggestions for web-app languages: Python + flask. Ruby + rails. Go standard HTTP library. Haskell + snap. I've used all of those and thought they were at least decent. The last two are my favorite for web development.
- jagermo 12y agoPython and Ruby look really nice. I read a lot of good things about Go. Choices, man....
- carbocation 12y agoI agree with grandalf: the search component will be the most challenging part of this. (The data entry may be challenging too, depending on what format your magazines are currently in.) I would start by building a tool that can do this easily at the command line or with hard-coded inputs (whether you write it in Python, Ruby, PHP, Go, etc). Once the hard part (the search) is working to your liking, you can then go building out a web interface to it. With this approach, you will work on the most interesting part of the problem first, which should be intrinsically motivating. And, when it works to your liking, you will be motivated to develop a functional interface, which will sustain your drive to finish the project.
- supster 12y agoI would start with this awesome free book on Ruby on Rails (it's designed for beginners): https://www.railstutorial.org/book https://www.railstutorial.org/book
- cageface 12y agoI'd second this. Using the Cloud9 development environment eliminates the hassle of setting up a local dev environment, which can be a major road block for beginners.
- tonyoconnell 12y agoI'd highly recommend http://meteor.com http://meteor.com for building you app. It's new and shiny and very easy to learn. Here are some reasons to develop your app with Meteor http://www.sitepoint.com/7-reasons-develop-next-web-app-meteor/ http://www.sitepoint.com/7-reasons-develop-next-web-app-mete...
- abhinovb 12y agoTrue, I started using it few days. Absolutely brilliant framework for beginners.
- zongitsrinzler 12y agoI would not recommend this for beginners at all. Not going down on Meteor but a traditional MVC framework gives beginners a much more broad understanding of web technologies that they can use with any language and most frameworks.
- ninjazee124 12y agoCheck out Spring Boot - https://spring.io/guides/gs/spring-boot/ https://spring.io/guides/gs/spring-boot/
- workingandtired 12y agoThe fortunate thing is that you have a fair amount of options when it comes to technologies for a web app. I personally have used php for years and have been working extensively with ruby and python recently. Here are some general things to consider. Language choice. For a long time PHP was the defacto standard. It has a lot of resources and tutorials plus the advantage of a huge amount of hosting options. However, I'm the last five to ten years, the field has opened up. Ruby and python both have strong communities and with app hosting solutions like Heroku, it is just as easy to get them up and running. All three are fine choices and if you're looking to make a career of web programming, you'll find plenty of jobs for all three. Frameworks. Frameworks are essentially scaffolding you can build your app around. The benefit is that you can get up and running pretty fast with them. Ruby has rails, python has django, and php has a plethora, with laravel being my favorite right now. The downside of these is that they add another level of complexity to your app. In addition to learning the basics of a programming language, you also have to learn about routes,models, controllers, etc. While this information is very beneficial to have, it could overwhelm when you're just starting out. If you want an app working fast, you can try one of the frameworks. However, if you want to understand the language more fully, at the cost of time, you may want to try your hand without a framework. If you do choose that route, php may be the best choice, since it was the only one designed specifically with web programming in mind. I'd reccomend php with mysql (using PDO for database interactions). I'm currently on mobile right now, but if you'd like any more resources I can reply when I get to a real computer.
- jagermo 12y agoThanks for the answer. Yes, the ammount of solutions is staggering, however it makes the choice a little harder.
- workingandtired 12y agoWell, if you have any additional questions or need a direction to start in, I'd be more than willing to help. From your basic description, the simplest way to be to just have straight PHP with MySQL/postgresql. And I believe you mentioned in another response thinking about using a Raspberry Pi, it looks like a LAMP stack might be easiest to set up, so another point in favor of PHP.
- romansanchez 12y agoYou could easily do this with Elasticsearch. I've created a search UI(http://www.github.com/romansanchez/calaca http://www.github.com/romansanchez/calaca) for Elasticsearch, which is what I think you're trying to do. You may want to recreate it on your own for learning purposes.
- PlzSnow 12y agoFor what you describe, perhaps an Excel spreadsheet would be best. Although if you're just looking at learning how to CRUD, then it's a good learning exercise.
- meesterdude 12y agoDepends what your goals are. if you want to learn a lot; you could write it in PHP/MySQL; if you just wanna get it done, you could do it in Rails (or some other framework). The thing is, there are really lots of ways something like that could be achieved. I use Ruby/Rails for philosophical reasons; I really love the language and framwork. I could do php - i just don't like php. Been there, done that. Others prefer JS for everything, or maybe ASP. None are "wrong". but there are differences and tradeoffs to each path; its not arbitrary by any measure. If you want some fancy search, I do favor elasticsearch quite a bit. Everything else I've used doesn't compare. (but again, largely preference (because its better))
- practicalpants 12y agoReally, front end JS frameworks don't make sense for an app like this (I would only use a JS framework if there was a significant amount of rich client interaction; in your case there is not, you're justing searching from a form). Rails or Django would be easiest, IMO, and they have a ton of libraries to make the search easy. You should absolutely not have to write any algorithms or anything... whatever you choose would probably just look like ExampleSearchLibrary.new(magazine_records).search(string_from_form) and that's it. I think the hardest part is getting all the magazine data in a DB, and designing the model layer in a way that makes sense. I'm assuming it's already digital, so it would be a matter of writing scripts to scrape & save.
- abuzzooz 12y agoNot being a web developer, I don't see any mention of Node, which makes me curious. Is Node not a good option?
- jekrb 12y agoAbove I mentioned io.js, an up-to-date fork of node. I think either are a great option.
- jekrb 12y agoI'm surprised to see so many leaning towards PHP. Personally I think it would be easier to use an embedded database such as leveldb, and build everything out with browserify, npm, and io.js. This way you can build your application as single process. The entire application can then just be streams of data and tiny modules of code that do one thing well.
- lewisjoe 12y agoHere's a book that got me started - http://www.amazon.in/Practical-Django-Projects/dp/1590599969 http://www.amazon.in/Practical-Django-Projects/dp/1590599969 Practical Django Projects got me started with a simple webapp in around 24 hours.
- Bahamut 12y agoHonestly, I'm inclined to say pick one and deal with the pains later - you're invariably going to make mistakes, so in this case, it is more important to pick a piece of tech and use it so you can learn the pain points later.
- jagermo 12y agoYou guys are fantastic. Thank you so much, you helped me a lot. This is why I love this community, so much help for newbie. I'm still sifting throug the comments, so please be patient, I'm trying to answer to all of you. It might just take a while :)
- freedevbootcamp 12y agoIt all depends on how much time you have and what your end goal is. Do you want to be a web developer for your career or just a hobby? How much time do you want to put into this web app? Python/Django/Flask or Ruby on Rails are both great choices but I would go pick up the book or search on the internet for a book called PHP Apache and MySqL web development by Wrox. They walk you through building a web app for a music collection which is just what you want anyway.
- jagermo 12y agoThis one: http://it-ebooks.info/book/1060/ http://it-ebooks.info/book/1060/ ? It'll be just a hobby, so I have the luxury of taking it slowly :)
- dxbydt 12y agowhen I read this question, I thought - let's see how long it takes for me to do this from scratch. so I got conscript, downloaded scalatra, started coding , and about 26 minutes later, I have created this webapp exactly as you specified. just another data point.
- jagermo 12y agoThat is exactly the reason why I want to do it: The task is not very complex, as some mentioned I could to it in Excel. So I'm confident that I won't run into any big problems (aka stuff I can solve with a little Google-Fu). It's not a useless app, I can see myself using it. Maybe for the magazines, maybe for wine/booze-collection It should cover a lot of basic operations like talk to a backend, add/delete/update a databasae, handle (at leaset one) user and so on.
- logn 12y agoI think you should learn the fundamentals of programming first. Choose a language, probably one commonly used in web development (JS, Ruby, Python, Java, etc), and go through tutorials on basic programming. After you master that (maybe 1+ years) then start learning web development. Most people here seemed eager to point you to various tech stacks and toolkits. But if you go down that road you'll be in over your head without understanding the most important thing, which is how software works. And you might also take time to understand how computers, electronics, networks, and compilers work before getting into web development too (i.e., a computer science approach). Your first development projects should be along the lines of number sorting, playing tic-tac-toe, or http://projecteuler.net/ http://projecteuler.net/ , not a search engine.