6 ms·
Show HN: I Built a Metasearch Engine with React, Redux, Express and TypeScript
- sovietmudkipz 8y agoThis is a neat project. I would encourage more development be done to have the type cover more of the front end code. Your development environment must not be of much help due to the heavy use of the "any" type throughout the codebase, which essentially escapes out of the type system.
- JoshuaScript 8y agoThanks, it started out as regular, valid JS, then I figured I might as well convert it to TypeScript, and I did so (perhaps too) quickly. I do plan to add stronger typing later.
- eksemplar 8y agoWhat advantages did you get from typescript? Seems like type safety is a huge trade off from what you lost by adding those amounts of complexity, especially when you’re not really utilising it.
- h1d 8y agoYou'd get more benefit if you're developing API where random others are consuming your code for them to use API properly. But still, it can still save you from obvious mistakes even for a one man project.
- eksemplar 8y agoI agree but I’d pick graphql for that instead of typescript.
- jeremychone 8y agoNot sure TypeScript and GraphQL are mutually exclusive.
- eksemplar 8y agoThey aren’t, but graphql would give you safer types in your api than typescript.
- jeremychone 8y agoNot sure one gives you safer typing than the other in absolute. They both have a different context/purpose. TypeScript is great for typing a code base for function calls type of APIs, whereas GraphQL is great to express types for inter-system communication (usually over HTTP). Using GraphQL to type your in-process API would be overkilled and would require quite a bit of contortionism, and while you can share same TypeScript types between your end-points interfaces (and can be a good first step), inter-process communication is better expressed with something like GraphQL or Protobuf.
- JoshuaScript 8y agoHonestly, I'm using it for it's marketability. I haven't yet found it particularly useful.
- catacombs 8y agoNice to see a project using React, Typescript and Redux in the wild.
- fastball 8y agoHeh. Wait, you're joking right?
- xab9 8y agoWell, typescript is nice. But. The amount of boilerplate I write with redux is downright annoying, add typescript to the mix and the interfaces, typedefinitions, enums, various scattered exports, actioncreators and typehelpers are just mind-boggling - I don't like it. Heck, I already have huge livetemplates in my ide to generate most of these stuff, but it feels wrong. And while we have fun writing "enterprise quality code", routing falls apart, load indicators are missing, form validators are a mess, error handling is broken, etc.
- acemarke 8y agoHi, I'm a Redux maintainer. We're currently working on a package called `redux-starter-kit` that contains some utilities to help simplify common concerns about Redux, including store setup, generating action creators, and writing reducer logic and immutable updates: https://github.com/reduxjs/redux-starter-kit https://github.com/reduxjs/redux-starter-kit I'd appreciate it if you could take a look, try it out, and give us some feedback. It's currently JS-only, but we're planning to convert it to be written in TS in the near future. As for as Redux and TS in general... I know I've seen comments similar to yours ("duplicating action constants and enums", etc). Unfortunately, I don't use TS myself, and don't know enough to offer meaningful suggestions there. If you've got specific pain points with Redux and TS, please go ahead and file an issue for discussion, and perhaps we can work on some solutions.
- Yuioup 8y agoI know this is going to sound like blasphemy, but is the TS version also going to support Angular?
- voltagex_ 8y agohttps://github.com/JoshuaScript/spresso-search/blob/master/server/routes/search.ts#L25 https://github.com/JoshuaScript/spresso-search/blob/master/s... - this will be blocked by Google if used at any kind of scale.
- astonex 8y agoYou mean you built a frontend for Google, not a search engine.
- JoshuaScript 8y agoThat's literally in the title. It says METASearch engine, not search engine. I have never claimed it was a search engine. https://en.wikipedia.org/wiki/Metasearch_engine https://en.wikipedia.org/wiki/Metasearch_engine
- thomasfoster96 8y agoOP is being bit dismissive, but IMHO the key feature of a metasearch engine is the processing of results, not the interface. Filtering Google’s results is technically a metasearch engine... but it’s a fairly trivial example.
- sbr464 8y agoI see that you are scraping the results directly, curious if you’d tried out Google’s json search api? Any thoughts about it? I was about to need it or similar for a project.
- JoshuaScript 8y agoI haven't tried it, I'm afraid.
- joshschreuder 8y agoI've tried it with the C# wrapper library, so using plain old methods and C# objects rather than touching the JSON directly. It's not too bad, but not free as far as I'm aware and the result snippets they give you are quite limited in length. Also I found it a little tricky to get good results on some queries when I tried it out.
- gitgud 8y agoGoogle's json search api gives you a consistent easy to parse api. However it requires a Google API key, which limits free usage. Client-side scraping scales effectively, as it distributes the reads onto all the clients. But it's also more brittle, as Google could change a small implementation of their search and break all the scraping functions.
- abhishekjha 8y agoI was looking into how google was implemented initially with the pagerank algorithm and I think I am getting closer. Do they still use the same algorithm? I ahve no concept of how things behave when they scale or how to scale for that matter.
- giancarlostoro 8y agoWell now they're baking in things like piracy and fake news into the mix and I've noticed a loss in quality for regular search results over the years.
- tdevito 8y agoI think they just use BrainRank for search now. It still incorporates the basic premise of pagerank, but the rules are not hand written anymore, it's all done with Tensorflow.
- ike0790 8y agoThis is cool...