7 ms·
Hi all! I wrote this code, and for educational purposes, I’d be more than happy to answer any questions. A gentle reminder that the whole history is here for s
by andremedeiros 3y ago
Hi all! I wrote this code, and for educational purposes, I’d be more than happy to answer any questions.
A gentle reminder that the whole history is here for show. This is very vulnerable — you can see the times I was in a rush, or when I took my time. You’ll find my mistakes. Either way, all I ask is please be kind. I know there are 50 things I could have done better, but this is a product of the reality at the time — a balance between something that works and something that was cost effective for Christian.
- rovr138 3y agoIt’s hard to put oneself out there like that. Christian is very visible in the community, but I want to say thank you to you too. Thank you for all the work you did! This made a lot of our experiences great.
- andremedeiros 3y agoThis right here is why I did it. To see a friend succeed, and to help make a community happier <3
- yard2010 3y agoThat's really wholesome which makes this incident much worse IMHO - it's the evil greedy corpo growth bs mindset vs the good will of few people that care about their community.. dystopic world
- rovr138 3y agoThis sentiment is what made Reddit a great community for smaller and specific subs. It’s just people talking around a topic and helping each other. Subreddit mods doing everything they can to keep their area clean for people reading. I’ve been on Reddit over for over a decade and this is the power behind it. Just wanting to help and bring good member. Thank you Andre. For your work and commitment to Christian, Apollo, and the community.
- cassianoleal 3y agoThanks for your work. Apollo made using Reddit a decent experience, and clearly you had a very large part in that. User rapnie mentioned the code in the repository doesn't have a license [0]. You might want to review that. [0] https://news.ycombinator.com/item?id=36256566 https://news.ycombinator.com/item?id=36256566
- andremedeiros 3y agoI’ll check in with Christian and see what he wants to do. Got any particular recommendations?
- orta 3y agoYou probably want MIT
- andremedeiros 3y agoGot it, thanks!
- bee_rider 3y agoThe advice in https://news.ycombinator.com/item?id=36256665 https://news.ycombinator.com/item?id=36256665 is more thorough, I wouldn’t just skip to this one.
- brettwilcox 3y agoYou may want to also check out Apache. Here is a good comparison of licenses. https://gist.github.com/nicolasdao/a7adda51f2f185e8d2700e1573d8a633#3-main-types-of-open-source-licenses https://gist.github.com/nicolasdao/a7adda51f2f185e8d2700e157...
- cassianoleal 3y agoThis gist doesn't even mention AGPL which as other users mentioned is much more appropriate for server-side apps than GPL.
- MarcoZavala 3y ago[dead]
- that_guy_iain 3y ago> A gentle reminder that the whole history is here for show. This is very vulnerable — you can see the times I was in a rush, or when I took my time. You’ll find my mistakes. Either way, all I ask is please be kind. I know there are 50 things I could have done better, but this is a product of the reality at the time — a balance between something that works and something that was cost effective for Christian. The way I took Reddit's comments were there were things that could be optimised to reduce costs. I've not seen a codebase yet where that isn't true. Sadly, in the hands of Redditors who think you can host an API on AWS for $1 per million requests comments like come across as "Oh they did shoddy work". What I think is we're seeing production quality code like the majority of us have running.
- rovr138 3y agoChristian talked about this. A payload of 25 comments vs a payload of 100, takes less time to generate and deliver. So sometimes, to optimize his users experience, he might request 25 to show something quick to the user and then do a request for 100 and append it. He also mentioned that he’s being compared to other apps, _not_ to the API limit (which he was under anyway). So, can it be less?, of course. Heck, he could make it 1/minute or even 1/day. But his quota was 60/min. So why not use the 60?.
- andremedeiros 3y agoThe Reddit API usage is as efficient as it can be, server wise, although I’d like to be proven wrong by them. As far as the app goes, an average of ~330 reqs/user/day is pretty good, considering they built the platform budgeting for 86,400.
- TX81Z 3y agoYeah, every time I see that number trotted out I’m just like “and the point is…?” If there’s an issue with the cost to process that many calls I’m much more suspicious of inefficiency on the API side than the client. Those numbers seem very reasonable.
- 3y ago
- Aachen 3y agoMaybe a description of what we're looking at in the Readme would be helpful. Why wouldn't the Apollo client just directly call reddit? Or does it partially do that and this server component is additional for certain functionality? What functionality does this offer?
- andremedeiros 3y agoThat’s great feedback. Any particular areas I can walk you through?
- Aachen 3y agoSince I have no idea what's even here, I can't really answer that. Maybe just a few sentences on what this code does in general?
- andremedeiros 3y agoI’ll be happy to once I sit down in front of my computer.
- Gunnerhead 3y agoA naïve question, but why is a backend needed and why couldn’t the app call the APIs directly? Just curious to learn!
- joezydeco 3y agoSibling comment above says it was mostly for notification, but flowing calls through their server also meant they didn't need to resubmit to Apple most of the time when something broke on Reddit's side.
- TX81Z 3y agoYeah. I’d imagine the less client side code the better when you have somebody getting paid $1/hour to randomly reject apps as the final step in hour launch process.
- irisgrunn 3y agoThat's just the reality of writing code, we all make mistakes and they haunt us all :)
- irisgrunn 3y agoWouldn't it be possible to change it to use Lemmy or some other alternative?
- andremedeiros 3y agoHonestly, Lemmy would probably not need half this code. We wrote this to work with an entity that exists in a “come and get it” model. Lemmy being open source means we could build the features right in the server and slash this code to a bare minimum (mostly the watcher stuff at this point.)
- revskill 3y agoAre you proud of your code ? Which design patterns do you use ? Any lessons that you've learned to be shared ? Thanks.
- andremedeiros 3y agoI’m never proud of my code haha. This could always be better. No specific design patterns either. The one fun thing I learned was about databases. Given enough records, a query planner might decide to start doing things very differently and you will get woken up at 3am with a CPU usage alert. That was a fun one to debug for sure…
- seanalltogether 3y agoSo am I right in thinking that the backend was needed to poll the user account in order to generate notification? Was that one of the issues that reddit had with how apollo was using their apis?
- andremedeiros 3y agoThat’s how it worked, yes, but we went to great lengths to ensure that call had minimal impact on their end. The TLDR here is that we only ever requested new notifications (give me anything that came after this thing I know about), which funnily enough then broke for some users, because if a reply you got notified about gets deleted and you use it for reference, Reddit will never return anything new to you, so I had to go and write a 2nd service that runs much more infrequently but does some checks on each account to make sure this isn’t the case.
- re-thc 3y ago> Was that one of the issues that reddit had with how apollo was using their apis? I doubt reddit had any actual issues other than it impacting profits and no optimization to Apollo would fix it.
- Waterluvian 3y agoYou made something that people got a lot of value out of. That’s incredible. The actual code and commits are just the journey. They’re not the product. I’m rather delighted every time someone shows a realistic journey full of all the things we all experience, but some of us pretend don’t happen. Thanks for being vulnerable and sharing this.
- andremedeiros 3y agoThis is an amazing way to look at it. Thank you for your perspective <3
- LeSaucy 3y agoAny developer should be proud of the value that code/backend provided millions of users.
- napsterbr 3y agoAmen to that. When I first started coding (some 15 years ago) I wrote the ugliest, buggiest and "owasp-ridden-est" PHP spaghetti code. Turns out that code went viral and was used by millions of users for a few years. Yet, I came to the conclusion that that's the best code I've ever written, for it's been the most used code I released so far. Real software development is far different than the ideal one.
- gabereiser 3y agoSoftware managers take note… Your MVP isn’t necessarily your perfect code. It’s the messy, “get it out the door”, value it brings to others. This is your product, refine it from there but don’t hold it back for sake of polishing a turd. Myth busters proved you can indeed, polish a turd. Don’t waste the sprints.
- 411111111111111 3y agoNo, that's just wrong. It's totally fine to put scrappy code up to get a product going, but that time has long since passed if you're already at a scale to have dedicated managers. At that point you're likely going to cause more damage to the brand/corp with the half-assed implementation then the value you're providing with said code.
- Grimburger 3y agoDon't be ashamed of code you wrote that wasn't intended for an audience. Most would hate to see what a sausage gets made out of, but nearly everyone will eat that same sausage.
- andremedeiros 3y agoI would demolish a couple hot dogs right about now…
- footlose_3815 3y agoSorry you feel on the defense. Developers can be very aggressive with feedback and I know the feeling. To echo others, "Build something that works first", and you have something that works :) IMHO the gesture of releasing the code shows how much integrity there is behind the devs, and I could care less if there's not-best-practice in there.
- dakial1 3y agoSo, too much work to adapt it to hackernews? Would love to have a decent client for this site…
- andremedeiros 3y agoHN is a whole other beast. A notification server would have to keep track of any replies to any of your comments / submissions in order to determine what to notify you about, purely because they don’t have a notification model.
- trustingtrust 3y agoI’m a long time paid customer of apollo. I have only used Reddit because apollo exists. What an amazing app. Thank you for all the hard work.
- carlmcqueen 3y agoHaving to ask people be kind about your code on HN is such a shame of reality to me. Half of brilliance is having your working version, used by many people. You had working code that brought reddit to so many reddit users every day that was better than what the official app of reddit provided. Some of the 'code' running massively profitable departments in finance are spreadsheets, on shared drives, with thousands of linked cells thought up by a brilliant employee who left the company five or six years in the past. I wish I was kidding. Thanks for how great you kept apollo.
- graypegg 3y agoI would love if we all agreed to value the joy of building on here. Not saying it needs to be nauseating positive, but just a default expectation of comments like “wow! This is cool, here are some things I might have done differently” Show HN is always really close to to that ideal. One of the reasons I like this place.
- alickz 3y agoYour code was production ready for millions of users, that's all that matters Do you think Christian would be willing to open source the app (under a non-commercial license) and allow us to build it with our own Reddit API keys? That way we could still use Apollo, but pay for it ourselves
- mrweasel 3y agoMaking the code available is a wonderful thing to do. I love being able to see how others managed and structured a Go project that was actually meant to run in production. Thank you.
- andremedeiros 3y agoKeep in mind that this isn’t rooted in any specific best practices. It just felt right.
- internetter 3y agoI'm curious if ya'll have any plans to support a reddit alternative, like Tweetbot -> Ivory and other twitter clients. I love Lemmy. I think it would be an excellent middle finger to reddit, but I understand if you are ready for the next thing
- hu3 3y agoYour commit messages [1] are better than of many projects and seniors I have worked with. Nothing to be ashamed. You made something that "just worked" and delivered value. You should be proud! Sample of latest commit messages: batch size wants to be smaller for less locking time, not higher increase scheduler batch size bump locks again make pool sizes customized increase prefetch [skip render] remove old redis from infra increase poolsize a bit bring new redis up to line in blueprints reduce pool size bump pg client count tweak pool sizes and consumer count double the amount of consumers small tweaks [ci skip] update pgbouncer github url clean allow lists add new redis instances make connections to the correct redis url envs add new env variables spam prevention update reddit http client feat(ops): add distributed tracing (#109)
- chris37879 3y agoYou wrote code that works and powers an app for millions every month and any bugs or 'bad' ways of doing it are clearly sufficient to maintain a large, healthy user base, so you should feel nothing but pride! Also, thank you for making this code available, but would it be possible for you and Christian to choose a license for it so people can use it? I don't think which license matters all that much, personally, but I can also understand wanting to keep it proprietary, either way, thank you again for all your (and the rest of the Apollo teams') work.
- newZWhoDis 3y agoYou might want to put this in the readme
- chaostheory 3y agoYou shipped and found market fit on your own. A lot of funded teams haven’t been able to achieve what you’ve done.
- marginalia_nu 3y agoFWIW, that just sounds like real code to me. You can spend your time polishing code until it shines and jerking off over the perfect crystal of logic you've created, or you can spend your time building something impressive that does cool stuff. Especially when you're solo or on a small team, technical debt is actually something you can lean into. In this domain, refactoring is cheap and cutting corners can help you get where you need to go faster. It's a too common mistake to think that because technical debt is a tar pit that kills many large products that this is universally true. The real trick is lowering the tolerance for flaws as the project grows and matures.
- TheNewsIsHere 3y agoAs another who will stop using Reddit when Apollo goes dark, I wanted to say thank you for your work with Christian! Apollo saved my Reddit use after they bought and killed Alien Blue. I have gotten so much out of and out so much into the more obscure technology subreddits. It’ll be missed. I appreciate all your work. For what it’s worth, I’ve never had server-side issues with Apollo (that I’ve noticed anyway!) Edit: typo
- jspdown 3y agoI was diving into your code and noticed you were using golang-migrate for running your migration queries. I never heard of it before and the number of databases they support sounds interesting! How was the experience overall with this tool? If you have experience with Flyway, how does it compare?
- sirspacey 3y agoThank you for your contribution. This is a heroic act.
- TX81Z 3y agoMy friend, that’s ALL of our code!
- raylad 3y agoWhy not point Apollo at a Reddit alternative, or use the open-source code for Reddit (or code like this https://github.com/libertysoft3/saidit https://github.com/libertysoft3/saidit) instead of shutting it down? If Apollo's users (or a good percentage of them) moved over to an alternative platform, that would be poetic justice, at least. To go even further, all the app devs should get together and create a new platform or pick one Reddit alternative and point all their apps at it. That way it would be even more likely to get critical mass quickly. 3 weeks should be enough time to come up with a coordinated plan. Don't let Reddit push you out -- push them out and let your users stick with the app they love. Reddit is only its users, nothing else. They don't own the users' loyalty -- the apps do. Take advantage of that and teach them a lesson by pointing the apps and users elsewhere!
- irthomasthomas 3y agoWhy don't you and Christian ask Apple for a small donation, and replace the reddit API with your own? You must have talked about the idea? I am waiting on delivery of an iPad pro, my first apple device in 10 years. And, even though I hate reddit, I was excited to check out Apollo, if for no other reason than to see what a great ios app looks like. I know that reimplementing reddit API from scratch will take more than a few weeks. But, I'm sure loyal Apollo users will be happy with a much scaled-down version. Maybe, to begin with you put the app in Read Only mode, and point it to a reddit archive. Then work on making one sub read/write again and expand from there. I mean, even just a good reddit archive browser has TONS of value. I'd happily pay a small sum for an awesome reddit archive explorer. "Chatgpt, build the back end for this API: $(cat reddit_api_docs)"