Square Open Source
square.github.io · Company blog · on HN since 2013
Square's engineering team hosts documentation and announcements for its open source projects, including OkHttp, Retrofit, Dagger, Keywhiz, and Crossfilter.
What HN saysHN commenters praise OkHttp as worth studying and Retrofit as one of the best Java libraries, though one questions the many similar secrets systems.
63HN people shared it
50linked it in comments
14stories submitted
300story points
4 years agolast shared
2013people per year2026
Most-shared posts
- 1Crossfilter: explore large multivariate datasets in the browser14 people · 4 points · first shared 2013 · discussion on HN
- 2Keywhiz: Square's system for distributing and managing secrets11 people · 252 points · first shared 2015 · 31 comments on HN
- 3Dagger: super lightweight DI framework for Java and Android6 people · 1 points · first shared 2013 · discussion on HN
- 4Retrofit6 people · first shared 2016
- 5Cubism: A D3 Plugin For Visualizing Time Series5 people · 2 points · first shared 2013 · discussion on HN
- 6Okhttp5 people · first shared 2015
- 7Intro to D34 people · 33 points · first shared 2014 · discussion on HN
- 8Keywhiz is a system for managing and distributing secrets3 people · 4 points · first shared 2016 · discussion on HN
- 9Cube: Time Series Data Collection and Analysis2 people · 1 points · first shared 2013 · discussion on HN
- 10Distributing instrumentation tests to all your Androids2 people · 1 points · first shared 2014 · discussion on HN
- 11Otto2 people · first shared 2015
- 12PySurvival: An open source Python package for Survival Analysis modeling1 people · 2 points · first shared 2019 · discussion on HN
- 13OkHttpClient.Builder1 people · first shared 2021
- 14Homepage1 people · first shared 2014
- 15Okio1 people · first shared 2021
What HN people wrote when they linked it
traviscj · 2022-03-21
I’ve learned a TON from the [okhttp3](https://square.github.io/okhttp/) codebase, highly recommend studying it.
hota_mazi · 2021-05-17
Agreed.
It's a lot easier for full blown languages to offer servicey-like interfaces like Jolie than the other way around.
And as a matter of fact, most modern programming languages offer interfaces/traits/stubs/etc... that do just that.
A great example of a successful approach to this is Retrofit: https://square.github.io/retrofit/
igorlev · 2018-09-14
Retrofit(https://square.github.io/retrofit/) is probably one of the best Java libraries I've ever used, missed it a lot when working in Python. Cross-pollination is awesome.
clay_to_n · 2016-10-13
Not sure the easiest way to get a list of the top Android libraries on GitHub, but here's a sample of some that are Apache 2.0:
https://github.com/ReactiveX/RxJava
http://square.github.io/retrofit/
http://jakewharton.github.io/butterknife/
FWIW, my Android app's codebase has 18 Apache 2.0 dependencies, 1 MIT and 2 BSD. Maybe since the large libraries mostly use Apache 2.0, the smaller Android devs just follow suit?
adrtessier · 2015-12-12
There sure are a lot of these systems these days. While I'm always happy to see innovation in this area, I'm personally beginning to get confused as to why I might prefer to use (and probably then contribute to) one of these projects over another. After all, there's this, and Lyft's Confidant [1], and Square's Keywhiz [2], and plenty more that don't come to mind right now. They all have nice documentation about what they do, but none of them sufficiently explain to me what architectural differences they have, their pros and cons. I think it would be great to see that added to these products' pages at best, or at least some guy write a blog post about it.
[1] https://lyft.github.io/confidant/
[2] https://square.github.io/keywhiz/
nwenzel · 2015-05-16
D3 can do DOM manipulation a. It's more well known for its charting (SVG) functionality. But I've used it to build tables and other data-based DOM structures.
It's not ideal for all use cases. But for updating the DOM based on changes to the data, I find it to be a useful option.
Square built and fast library on top of D3 called Crossfilter. Speed is pretty amazing when you see the data source. http://square.github.io/crossfilter/
rmetzler · 2015-04-28
I know it is very new, but I would love to read a Vault vs Keywhiz [1] article.
[1] https://square.github.io/keywhiz/
cageface · 2014-09-27
Start with the stuff from Square:
http://square.github.io
And also GSON from Google.
couchand · 2014-08-11
You could also simply work with Crossfilter [0] and D3 [1] directly. They're both great libraries, and learning their APIs independently seems more valuable.
[0]: http://square.github.io/crossfilter/
[1]: http://d3js.org/
awjr · 2014-06-09
I posted this as I've spent the last month with this library and it has made the creation of a multi tab dashboard a breeze.
Once you get your head around http://square.github.io/crossfilter/ and the manipulations you can do with groups, dc.js really makes rendering the data very simple.
1.7 has just been released and 2.0 is 'around the corner'.
It's a fantastic library and massive kudos to the people working on it. You make me look awesome :)
zenocon · 2014-06-09
Consider this example: https://square.github.io/crossfilter/#charts and this example https://dc-js.github.io/dc.js/#yearly-bubble-chart -- sure, you could probably do this without dc.js and crossfilter.js but it would be _a lot_ of work, and likely not re-usable.
If you don't need interactive charts that you can drill-down into, don't use it. If you do, this is the best of breed right now for this kind of thing. dc.js doesn't abstract away the d3 api -- you can still use it to your hearts content, but it sure makes these kinds of examples really easy to spin up with minimal code.
wheaties · 2013-04-09
Wow, these interactive charts are great. Can't wait to pay for something like this unless there's already wonderfully interactive charting libraries out there like nvd3 (http://nvd3.org/), dc (http://nickqizhu.github.io/dc.js/) crossfilter (http://square.github.io/crossfilter/) or even anything from d3's website (https://github.com/mbostock/d3/wiki/Gallery)
McDev · 2020-01-26
I'm a self taught programmer and started developing for Android in 2012. It took me a while before I realised that you needed third party libraries to do absolutely anything useful as the platform APIs were so poor and undocumented. There were gaps everywhere and you needed to write tons of boilerplate code to do things properly.
Image loading was often a huge source of crashes due to out-of-memory errors and doing it properly wasn't trivial [0]. Libraries like "Glide" and "Picasso" solved this.
Using the camera hardware was awful. Device manufacturers would implement things differently, and break the camera API unexpectedly. Only recently [1] are we starting to see sane, consistent camera APIs.
Making network requests felt extremely clunky, and the platform JSON implementation wasn't performant, or easy to use as you had to manually parse everything. Retrofit [2] made talking to REST services much easier.
I could go on and on, but I'm sure there's plenty others here who can do that here. These days Android development is much, much more enjoyable. Kotlin has pretty much replaced Java in the Android ecosystem, and there's great reasources around on how to architect your app to make everything testable and easily scalable such as the architecture samples [3]. I've worked on a few React Native projects in the last year. I'm not a fan of it, but I definitely see the industry heading to some cross platform solution eventually.
[0].…
monfera · 2016-11-30
> Leave data processing and business logic to the back-end, on the server
In general, this is not good. Of course there are specific applications where it's useful but in the general space of applications it would be very limiting.
For example, go to http://square.github.io/crossfilter/ and do the filtering on the 5MB data such that you wait for the histograms to be updated from the server. Instead of the tens of milliseconds, it might be seconds or tens of seconds if the server is loaded, i.e. orders of magnitude slower, not to mention unpredictable.
You can think of the network as a data flow constraint. It constrains latency, throughput, privacy and security; the constraints can be unpredictable (network outage; DoS, MiM attack etc.). There can be many good reasons for wanting part of your domain specific logic to fall on the client side.
In particular, dynamic media e.g. interactive data visualization, games and most interactive things that use data or modeling are best partly in the browser.
We're past the point where the rule of thumb was to do business logic on the server and the client only did the presenting of the view and acted as a controller.
swanson · 2014-03-28
I've found that the much more annoying and difficult to deal with fragmentation bugs are carrier specific. You will find things like Samsung has changed how you launch the default browser from your app or HTC doesn't follow the spec for getting an image from the camera. These are the kind of bugs that drive me crazy.
My current project runs a test suite (as well as some light adhoc testing) on 6-7 devices (across screen densities and carriers) and that seems to catch most of the issues without spending $20k on a device lab. (We use the excellent Spoon library by Square: http://square.github.io/spoon/)
Screen sizes are not an issue for anyone that's shipped a non-toy app. API levels are not so bad - though you will find yourself using the Support Libraries even in cases when they shouldn't be needed.
BTW: Android provides a weekly report of OS/screen sizes etc that access the Play Store: http://developer.android.com/about/dashboards/index.html Use this (not a random blog post) to make informed decisions for your clients on your minSdkVersion.
Now if you want to talk about a real headache for Android developers, let's talk about Fragments - not fragmentation :)
cbsmith · 2022-05-05
Odd name... no relation to KeyWhiz? https://square.github.io/keywhiz/
judge2020 · 2021-05-05
FYI to find the table, ctrl-f 'top 10 most frequently ' (or, if you use Chrome/your browser supports text fragments, https://me2ba.org/school-mobile-apps-student-data-sharing-behavior/#:~… )
I also don't see how OkHttp[0] or Okio[1] are 'medium' risk. Are they secretly sending data to Square? The code is auditable on GitHub.
0: https://square.github.io/okhttp/
1: https://square.github.io/okio/
jonas21 · 2021-05-05
They seem to consider any use of an SDK or library to be "data sharing". For example, if an app uses OkHttp (an open-source HTTP client library) [1] then it counts as data sharing. That doesn't seem right...
[1] https://square.github.io/okhttp/
gwright · 2019-01-08
Retrofit is another example: https://square.github.io/retrofit/
SureshG · 2018-12-04
We use https://square.github.io/keywhiz/. It provide secrets as files in a directory, securely. So no special API, client libraries required to access it.
jzymbaluk · 2018-03-23
I've been self-learning d3 recently and I found Square's guide to be very helpful. It takes you through enough of the concepts that you're able to understand code snippets and understand what's going on
https://square.github.io/intro-to-d3/
sciyoshi · 2018-02-06
I'd also be interested in some performance comparisons with a library like CrossFilter [1]. Does the improvement outweigh the penalties of crossing the JS/WebASM boundary?
[1] http://square.github.io/crossfilter/
zie · 2017-09-26
* AWS has one built in KMS along with EC2 Parameter Store.
* Vault(http://vaultproject.io/)
* Keywhiz (https://square.github.io/keywhiz/)
* Blackbox (https://github.com/StackExchange/blackbox)
I personally use Vault, because it's not tied to a particular infrastructure, and it's much more general purpose.
jstandard · 2017-08-26
Thanks, that's helpful as an upfront approach. How about if a contract is already in place and the company is okay with the methodology being published, as long as they retain rights to it.
Is there a licensing vehicle that allows for publishing while remaining an asset of the company?
For example, Square built their Dagger library and uses the Apache license. http://square.github.io/dagger/
My impression is that Dagger is still an asset of Square, but you can use it as long as you meet the licensing requirements.
Is there an equivalent to this for a modeling approach or work done by a consultant?
sratner · 2017-05-10
Some of the fault for this lies with client libraries. Many, including popular ones[1], either don't provide a way to get the body of error responses at all, or make it particularly cumbersome to do so. For example, success bodies might be parsed automatically by registering the right parser for the content type, but to parse an error response you need to manually instantiate a parser and deserialise the body. Until error responses are first-class objects in client http libraries, devs will continue being lazy.
[1] Not to pick on retrofit -- it is generally awesome -- but http://square.github.io/retrofit/2.x/retrofit/retrofit2/Response.html
Natales · 2016-08-21
It's always good to see options out there. But honestly, having being working with Hashicorp's Vault for a while (https://www.vaultproject.io/) I really don't see the need for it. Vault is extremely simple to setup and has many more advanced features without sacrificing functionality. There is also Keywhiz (https://square.github.io/keywhiz/single_page.html) which also provides a nifty FUSE abstraction.
stevehaz · 2016-06-24
I can't speak to ECG's, but rather like an animated time series except in the reverse direction.
As you say, the norm is right to left, highest priority (now) on the far right, like this: https://square.github.io/cubism/
It must be an acquired taste, or contextually dependent, because even though I do plenty of metrics visualization which is right-to-left, left-to-right for a high-level view of behavior feels fine to me.
dragonshed · 2016-06-03
Interesting project! It's nice to see some better examples for this sort of thing. At work I've helped build something similar using javascript. We needed something that works in-browser, and have since made sure it also works within web-workers as well as node.
It's not as nice as directly running calculations from a magically scalable and performant spreadsheet black box, but importing data and formulae from various spreadsheets has gotten quite easy.
Closed source, but imagine using the core and expressions support from mathjs [0] and crossfilter [1] together to display both raw and calculated data in various contexts, and you wouldn't be too far off the mark.
[0] http://mathjs.org/
[1] http://square.github.io/crossfilter/
[edit for grammar]
Joeri · 2016-01-16
You should check out crossfilter: http://square.github.io/crossfilter/
You import your records, define dimensions, and can then slice and dice your datasets to your liking.
Very impressive is dc.js, which adds some magic on top of crossfilter and d3 to build interactive charts.
https://dc-js.github.io/dc.js/
nodesocket · 2015-12-04
Lots of cool projects around secrets lately:
* Vault (by Hashicorp) [go] https://hashicorp.com/blog/vault.html
* Confidant (by Lyft) [Python] https://eng.lyft.com/announcing-confidant-an-open-source-secret-manage…
* Keywhiz (by Sqaure) [Java] https://square.github.io/keywhiz/