12 ms·
Mern: Build JavaScript apps using React and Redux
- mintplant 11y agoWhy MongoDB?
- pedalpete 11y agoMongo is often quick to get people started and simple to work with. No migrations, or joins, etc. etc. It's not for every project, but quite nice for prototyping.
- runholm 11y agoNot only prototyping. If the final product will have a moderate amount of users generating a moderate amount of data, there is really no drawbacks with mongoDB. The real cost is development time.
- pedalpete 11y agoOf the mongoDB projects I've been involved with, I've always wanted to do large complex joins and filters which was just didn't perform as well as relational databases, and there is no support (as far as I know) for geo-coded data. That's why I suggest it's good for prototyping, maybe it will work for some projects long-term, but I don't think it's the norm as mongoDb would suggest. However, most prototypes don't end up as successes, so that's where I figure it's worth the switching cost once a go-nogo decision is made.
- joepie91_ 11y agoThere are many drawbacks when using MongoDB, especially in the development time department: http://cryto.net/~joepie91/blog/2015/07/19/why-you-should-never-ever-ever-use-mongodb/ http://cryto.net/~joepie91/blog/2015/07/19/why-you-should-ne... It's a completely fallacious argument. Using MongoDB doesn't save you time, it just shifts the effort towards a later point, where it will require several times as much effort to fix shit, which may not even succeed and you may end up with corrupted data. It's really not worth it.
- danielrhodes 11y agoIt's not that you don't have migrations, it's that you move that logic to your application code. I personally find that to be a terrible trade-off. People make the same arguments in favor of mutable data structures: you benefit initially from having everything mutable, but then you start writing code to compensate for the flexible nature of it and suddenly you have a whole new set of issues.
- p_l 11y agoExcept people have bad tendency to not throw out prototypes and are unwilling to do the work to deal with bad decisions from the prototype time...
- nkg 11y agoThat sentence should be written someplace where everyone can see it everytime a project starts.
- joepie91_ 11y agoMigrations don't actually take more time than defining the schema implicitly in your application, and you don't even need to think about joins at all if it's only going to be a prototype. MongoDB is far from "simple to work with". This is 100% marketing bullshit (along with dubious claims like it being "fast" when it never has been), trotted out by MongoDB's marketing department. Let's not forget that it has always been a commercial project. EDIT: And to clarify, relational databases and document stores are not interchangeable. You need to pick the one that reflects your data model most accurately. Usually that's going to be "relational", sometimes it will be "documents" - but even if it is, there are better options than MongoDB.
- runholm 11y agoMongoDB plays very well with the rest of the javascript based stack, which mean development and testing is simpler. For many use cases the development time is the real cost, and the database itself is simple enough that what it is running on does not really matter much. Most people are not building Big Data systems.
- realusername 11y agoWhy not rethinkdb or couchdb then ? Mongo is not the only Javascript friendly document oriented database.
- joepie91_ 11y agoMongo isn't even "Javascript-friendly". It just accepts JSON for queries, that's all. JSON is approximately as related to Javascript as Javascript is related to Java.
- threeseed 11y agoActually MongoDB is used quite a bit in big data systems. It has very good integration with Hadoop, Spark etc.
- joepie91_ 11y ago> MongoDB plays very well with the rest of the javascript based stack Every major database does. This is in no way exclusive to MongoDB.
- cookiecaper 11y agoBecause people hate the constraints put in place by SQL. It doesn't really matter that they'll spend dozens of hours re-implementing stuff they would've gotten for free with SQL in a RDBMS (not to mention the benefit of serious stability), what matters is that the initial effort to make a change is much lower, and thus developers feel like they're saving a lot of time/hassle. They don't seem to connect the cost on the backend with its cause, or they just don't mind it.
- EvanPlaice 11y agoWith NoSQL you do have to reimplement all of the constraints in the application but this will likely be necessary even for SQL code because you'll need to provide both server and client side validations on user input. SQL can be even more of a pain because you'll need additional checks to handle the SQL server's particular blend of error handling if/when something goes wrong. In both SQL and NoSQL, any decent ORM should provide models, validations, sane error handling, and constraint checks so none of those really matter. Unless, for whatever reason the business logic is defined in SQL SPROCS. Then, good luck if/when they don't work properly.
- StavrosK 11y agoWhy would an SQL ORM provide validations? The database itself already does. Additionally, user data isn't the only data that needs to be validated. The vast majority of our data is generated by the program itself, and schemaless databases have given us endless headaches with this.
- EvanPlaice 11y agoClient-side validation are much more important that server-side validations. Preventing a user from sending bad data to begin with avoids the poor usability of having to send bad a failed request and reset the form for editing. Database constraints only avoid bad data in the database. They still have to be duplicated for error checking in the server and client. Is JS is used on both the server and client, it makes a lot more sense to have ORM models that act as the single source of truth for structure (ie model/schema), condtraints, testing, and validations. Issues with unstructured data come either from laziness (ie not using schemas in production code) or mismanagement (ie not handling migrations properly between schema changes). Having the ability to use completely schema-free, unstructured data doesn't mean schema/validations should be ignored altogether. You wouldn't blame the gun if you shot yourself in the foot, would you?
- Kiro 11y agoI use MongoDB because I can instantly save down a JavaScript object and later retrieve it in the same state. I don't have to worry about anything else. No configuration, nothing. That's all I need but if there are better options I'm all ears.
- rewask 11y agoIt's nice with zero configuration. Especially the no password by default thing. Why bother with limiting your database with host access and passwords ;)
- Kiro 11y agoI use environment variables so the configuration is basically setting up the host/username/pw in the Heroku interface. But ok, almost no configuration then...
- imaginenore 11y agoYou can do that with almost any language and any storage. JSON.
- joepie91_ 11y agoYou're not "saving down a JavaScript object", as MongoDB does not speak JavaScript. What you're doing is passing an object to your database driver, which then converts it to JSON, and sends it to MongoDB. JSON is an entirely separate language from JavaScript, and it can be used from just about any language. This "convert a native object into the query format" thing is also literally what almost every database driver in almost every language does. This has precisely zero to do with either MongoDB or JavaScript.
- Kiro 11y agoOk, so I'm saving it down as a JavaScript Object Notation which looks exactly the same as JavaScript. I think that's very convenient and don't see how it's the same as converting for example PHP to MySQL where I'm bound by a schema which looks nothing like my data structure in PHP.
- baconizer 11y agobecause mongo queries are in JSON style, plays well with Javascript
- phelm 11y agobecause MongoDB is web scale
- q-base 11y agoNot that it has any practical implications, but I grew up next to a tiny tiny town in Denmark that was called exactly Mern. Famous for being full of people who wanted to fight.
- tfgg 11y agoThe page keeps mentioning 'isomorphic apps' but I have no idea what those are. From googling, they appear to be JS code that can run client and server-side? Not what I would have guessed!
- iraldir 11y agoAn isomorphic app is basically a Single Page Application (think Angular / React / Ember application) with the special ability to be rendered server side. The interest vs a simple SPA is that on the first page load, instead of loading just javascript, and having to wait for XHR request and JavaScript rendering to draw the data, you get the page properly rendered in the first place. But when you navigate to go to a different page, you use javascript to repopulate the data. It's the best of both world for the users. But for the developers it usually means extra work.
- MasterScrat 11y agoAlso it's better from an SEO point of view, since depending on how you implement your SLA Google may be unable to read it.
- tomelders 11y agoIt's one of those instances where developers went looking for a word that perfectly articulates what it's doing, but is so esoteric as to be useless. > being of identical or similar form, shape, or structure I call it fronty-backy-samey-samey and everyone knows what I'm talking about.
- mbrock 11y agoIt's not really esoteric... it just kind of has the wrong connotations, because it's used rigorously in mathematics, and here it just means "portable between different JavaScript runtimes," pretty much. To me the word makes me imagine a web application that can parse its own rendered HTML and get back the application state. Which sounds kind of interesting...
- hayksaakian 11y agohow does this work with existing tools like webpack? how does this work with es6?
- prank7 11y agoIt uses Webpack along with Babel to compile ES6.
- kang 11y agodemo page seems broken
- franxoois 11y agoLooks like some folks have fun with XSS
- juretriglav 11y agoYour demo needs fixing, it's open to XSS and that has been tried and tested, as expected for this crowd. :)
- g_delgado14 11y agoAs a curious noob, could u explain what is the source of the XSS vulnerability in this case? Is it simply that the site isn't being served over tls/ssl?
- rohanprabhu 11y agoNot sanitizing input, by either scrubbing out any <script> tags, or escaping those characterst to html entities.
- kolme 11y agoPlease don't "sanitize" input, just escape accordingly. "<script>" might be a legitimate input.
- eterm 11y agoYou need both. Sometimes the legit input is HTML such as from rich text editors. In those cases if someone types a bold <script> then the form should submit the escaped <b><script><b> but also needs to sanitise to make sure that other HTML element types are not present. If you escape one step further you'll lose formatting or the message, so sanitisation is important too, it is reductive to say "always escape never sanitise".
- windsurfer 11y agoI think your first problem is whitelisting HTML entities. Unless you're composing HTML-formatted email, it's usually better to use a different markup syntax like a minimal markdown or asciidoc that can safely be escaped.
- deleted 11y ago[deleted]
- runholm 11y agoSo mean.io with React instead of Angular.
- alongtheflow 11y agoHow do you handle sessions and user auth?
- prank7 11y agoThis is just a boilerplate, you can add auth on top of it like any other app. Anyway, soon we will add another example which uses auth and handles sessions.
- revelation 11y agoI don't think isomorphic means what you think it means.
- andybak 11y agohttps://en.wikipedia.org/wiki/Linguistic_prescription https://en.wikipedia.org/wiki/Linguistic_prescription vs https://en.wikipedia.org/wiki/Linguistic_description https://en.wikipedia.org/wiki/Linguistic_description You might dislike it but it's become common usage in the js community so by any reasonable non-prescriptive definition of 'means' it 'means' what this author says.
- fapjacks 11y agoRight! One of my favorite instructors (a computational linguist) in one of my favorite classes (linguistics) always used to say "We as linguists do not prescribe language, we describe language".
- pluma 11y agoI don't think "means" means what you think it means.
- bijection 11y agoFWIW 'isomorphic javascript' was pretty much supplanted by 'universal javascript' last year per this medium post [1]. You might consider changing the copy. Edit: At the very least Dan Abramov (Redux creator) is ok with universal [2] [1] https://medium.com/@mjackson/universal-javascript-4761051b7ae9 https://medium.com/@mjackson/universal-javascript-4761051b7a... [2] https://github.com/gaearon/react-redux-universal-hot-example https://github.com/gaearon/react-redux-universal-hot-example
- thecopy 11y agoBut isomorphic sounds cooler...
- patates 11y agoMany people still don't agree, neither do I. There's no doubt that the term "universal" is more correct, however, languages don't work that way. In the JS land isomorphic has a very specific meaning. Universal is a flexible word. "A universal api for observables" means something (works across libraries), "An isomorphic api for observables" means something else (works across environments) .
- ch0wn 11y agoI was under the impression that the community as a whole had agreed to switch to that term as well. :( Given your name I reckon you feel strongly about this, too.
- prank7 11y agoLets not get caught in 'war of words'. There is no standard to it and I don't think it matters as long as you understand what it means.
- egwynn 11y ago> There are only two hard things in Computer Science: cache invalidation and naming things. > -- Phil Karlton
- 11y ago
- drinchev 11y agoSo this is a repo that is being cloned on your computer [1]. I have a couple of questions : 1. Why not just creating yeoman generator? 2. Don't you think it is too opinionated and inflexible to be useful? 1: https://github.com/Hashnode/mern-cli/blob/master/lib/main.js https://github.com/Hashnode/mern-cli/blob/master/lib/main.js
- progx 11y agoNIH Syndrom?
- Kiro 11y agoI much rather clone than use yeoman. What is the benefit?
- shocks 11y agoWell yeoman can be configured to ask you questions about the setup you want. Think "less or sass?"
- elliotec 11y agoWhy would something that is opinionated and inflexible not be useful? See Rails.
- antihero 11y agoI'm not sure I like the trend of tethering an application to a specific backend, especially regarding databases. I think it would be more interesting to, if we're looking to be isomorphic, generate a front-end template and an API gateway . I say this because often when you're not working in tiny startups, your backend is handled by a different team and is loosely coupled.
- ascorbic 11y agoCould I suggest the title is changed to something like "MERN: Build isomorphic JavaScript apps using React and Redux" which is the page title, rather than just the domain which tells us nothing.
- dang 11y agoSure. Edit: I forgot that isomorphic is a trigger word. Took that out.
- andrewingram 11y agoFrom what I can see, this is a boilerplate project with a fancy command line installer. So if you don't plan on using their exact stack, remember there are hundreds of other boilerplates you could use that are no more difficult to install.
- batat 11y agoFRAMEWORK (shitty tragedy in one act) Dramatis Personae PROGRAMMER, programmer HIPSTER, hipster * * * ACT I Small room. There are a table with paper stacks, opened "Perrier" bottle, two huge monitors and a programmer sitting behind. Programmer reads papers, looks on first monitor, then on second and typing something. From time to time he says "damn idiots". Number of "damn idiots" is divided equally between papers, first and second monitor. Door opens loudly PROGRAMMER: Who's there? Hipster runs into waving his hands HIPSTER: Framework! New awesome framework! Just look, it's awesome! Just look! Programmer looks into hipster's iPad @moccachino.render() helloWorld({ view: "myProject.sample.view.Hello", div: "myContainer", data: { message: "Hello World!" } }); then takes a "Perrier" bottle and smashes on hipster's head. Hipster falls on the floor. PROGRAMMER: Damn idiots. Exeunt. (sorry for my English)
- deleted 11y ago[deleted]
- Stamy 11y agoI don't see the reason why would you apologise for your english when you use the words like 'Exeunt' ... Otherwise good joke.
- isomorph 11y agoI understand your point, but 'Exeunt' is Latin! :P
- omk 11y agoProbably because the author was compelled to choose his words wisely to comply with forum policies. In essence "damn idiots" is a toned down version of something far more expressive.
- dang 11y agoWe don't give a shit if you swear. We care about how people treat each other.
- ilanco 11y agowindow.__INITIAL_STATE__ immediately made me think about __VIEWSTATE
- deleted 11y ago[deleted]
- raffomania 11y agoWhat happened to yeoman? Wasn't it supposed to do exactly this and even more?
- nullified-vga 11y agoI just don't understand the motivation for the cli. Isn't it much easier to just clone the mern boilerplate repo, rather than npm installing some cli, then running a command. If there are no options, what's the point? Admittedly, I might be missing something.
- dbla 11y agoI think a cli tool is usually easier because you don't have to rm -rf .git in order to set up your own repo.
- addandsubtract 11y agoYou can use the following git command to move everything except for the .git files to a new location [1] git checkout-index -f -a --prefix=/path/to/folder/ [1] http://www.tekkie.ro/methodology/use-git-checkout-index-initialise-project-from-boilerplate-repository/ http://www.tekkie.ro/methodology/use-git-checkout-index-init...
- meow_mix 11y agoThis was a really bad time to post this framework, the disillusionment for javascript is at an all time high right now. That being said why Mongodb? NoSql are advantageous for write speeds, which as far as I know isn't particularly important for new applications. I understand that you want "javascript everywhere" but is that really worth the cost of losing the speedy and convenient join statements? I think postgres might have been a better choice.
- xhrpost 11y agoCan be worthwhile if you take advantage of embedded documents. Storing your data in the same form that you use it in your application, can at appropriate times be very helpful. I recently started using an ORM that does not support embedded documents when using Mongo and found I essentially had all of the problems of a NoSQL DB with none of the advantages.
- dceddia 11y agoI can't say if they considered other databases, but "MERN" is a play on "MEAN" (Mongo, Express, Angular, Node) -- I imagine they were aiming for a React-centric version of the popular MEAN stack.
- mawburn 11y agoOr just really big fans of Tyler Perry movies.
- iamdave 11y agoBringing the total number to 1?
- CodyReichert 11y agoNo, it's two. Don't forget Tyler Perry.
- pygy_ 11y agoWaiting for the NERD stack. Node, Express, React, $DataBase.
- officialchicken 11y agoAre there any isomorphic frameworks or examples that aren't tightly coupled? I can't understand how to get a development team starting with something like this to something like a microservices API without a complete/major rewrite or painful decoupling/transition sprint(s). Or am I missing something here?
- elliotec 11y agoI think what you're missing is that this is the opposite of having decoupled microservices by design. Their point is no configuration, seems like they're trying out the "monolithic" convention-based architecture with the modularity of react components, etc.
- eximius 11y agoYou keep using that word. I don't think it means what you think it means.
- sebringj 11y agoNelly came up with that already.
- rvdm 11y agoI think it's a great idea to try and bring some of RoR's developer happiness to JS. Universal React + Redux is a great stack but I could see why beginners, unfamiliar with starter repos, could get overwelmed reading the respective docs. This project is a good attempt at lowering entry. My 2 cents, I've been enjoying using websockets and redis with this stack. And +1 for considering the term Universal in the tagline.
- sotojuan 11y ago> I think it's a great idea to try and bring some of RoR's developer happiness to JS. That's been around for a while: http://ember-cli.com/user-guide/#using-ember-cli http://ember-cli.com/user-guide/#using-ember-cli
- rvdm 11y agoYep! Love Ember. I think it's good that this project it trying to bring some of the RoR and Ember ideas to the React Redux stack.
- jamespitts 11y agoOk, here's some helpful criticism (not that all of this is unhelpful): Overall the presentation of your system is great. However, the documentation needs work, particularly on how to create a complete mini-MVP. Examples, even if dinky, help a lot. Many developers will just download an example and start messing around and see how it feels. An important note on app structure: I noticed how the approach you take involves maintaining lot of file structure, all reflecting the underlying conceptual framework. IMO, even when generated, complex file structures draw away from our developer productivity. Think about "flattening" some of that. Think about organizing the system around the aspects of the implementation, even if it is at the cost of (for lack of a better word) consistency. The framework should serve the primary concerns in the mind of the developer: user, group, post, item, etc. rather than the primary concerns in the mind of the framework maker :) Hope this helps, and good luck in Dodge City! https://en.wikipedia.org/wiki/Dodge_City_(1939_film) https://en.wikipedia.org/wiki/Dodge_City_(1939_film)
- visarga 11y agoGreat response. I read the one page presentation and looked at the source files and it feels like one of the hundreds of skeleton repos for React. Why is this different, why should we use this one instead of another? The whole point is to make it easy to work with this full stack framework, so, that means to have excellent docs and StackOverflow support.
- logicrook 11y agoWay to spoil the fun with thoughtful and pertinent comments.
- cphoover 11y agodoes anyone else think the whole LAMP/MEAN... and now MERN is a bit contrived. Why do we need acronyms for everything? Why can't technologies be used independently of one another when they are useful. Why do need to cargo-cult tech trends?!