<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Adam Pietrasiak on Medium]]></title>
        <description><![CDATA[Stories by Adam Pietrasiak on Medium]]></description>
        <link>https://medium.com/@pie6k?source=rss-cacc68bac9aa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_VMCNOemCJ_zpIJ9ttedKw.jpeg</url>
            <title>Stories by Adam Pietrasiak on Medium</title>
            <link>https://medium.com/@pie6k?source=rss-cacc68bac9aa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 06:59:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pie6k/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How creating a productivity app ruined my own productivity]]></title>
            <link>https://medium.com/@pie6k/how-creating-a-productivity-app-ruined-my-own-productivity-62ac160fa4f2?source=rss-cacc68bac9aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/62ac160fa4f2</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[depression]]></category>
            <category><![CDATA[perfectionism]]></category>
            <dc:creator><![CDATA[Adam Pietrasiak]]></dc:creator>
            <pubDate>Sat, 14 Mar 2020 17:38:38 GMT</pubDate>
            <atom:updated>2020-03-14T17:50:13.944Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*97gMM84lSEW5e7CKWJX6_A.jpeg" /></figure><p>It all started a few years ago. I always liked to look for unusual solutions for problems and I always dreamed of achieving something big. One day, I had an amazing idea, which was supposed to revolutionize the way we plan our time. I still believe in it, but then — I was in blind love with it.</p><p>It’s like with the girl you’ve fallen in love with back in school. She never wanted to go on a date with you. In the end, you fall in love with your thoughts about her. And thoughts can lose connection with reality. After a few years, you meet her in the shopping center by accident and after few minutes you think “what the heck was in my head back then and why have I lost so much time thinking about her”</p><p>I’d like to tell about the process, not about the app, but to give some context, let me briefly describe my idea.</p><p>Timpler (this is the name) allows you to plan your time in a new way. I thought that in general, when you have something to do, you almost never know when it’s the best moment to do it. Only with a few things you can be certain about it. If you go to the doctor, you know the date and the time. It’s clear. But if you want to call your family, read a book, water your plants or go on a date with your wife — you obviously want to do it, but the question “when” is not so obvious.</p><p>Timpler allows you to describe the “rhythm” of your tasks instead of due dates. “Rythm” like “on a sunny day”, “when I and my wife both have 2 free hours” or “at least 3 times a week”. After you describe your rhythm, you can be sure that everything will be properly planned, even if your mom will visit you without letting you know earlier destroying your beautiful weekend plan. You’ll just click “reschedule” on Monday.</p><p>Little spoiler — this idea and dream meant severe depression for me in the end.</p><p>So, when trying to release it for the first time, I was around 22. I had no idea about creating large apps. I was making some websites. However, I was so over-confident and proud, that I thought it’s not a problem. In general, my first approach was a total failure, but it didn’t impact my mental health in any way. In the end, I’ve created a few broken prototypes.</p><p>Years were passing, and I was always doing something about it. The irony is, that while creating a productivity app I was often late on meetings with someone. I was not replying to emails I’ve promised to reply to. When someone was asking me about the app, I was saying — pretty soon.</p><p>Then, I’ve met my wife. I was making quite good money and we’ve saved a bit. I’ve decided to leave my work and live from savings for 6 months, while finally being able to work on Timpler full time.</p><p>In the beginning, it was great, but pretty quickly things have changed in a very bad way. I think I was nothing more than a bunch of constant frustrations. Not because I didn’t know how to write code. I knew it. It was because I didn’t understand how to work when no one is watching and paying you.</p><p>When you work full time — it’s different. You’re home after 8–9 hours and you’re still full of energy to work on your dream product. At least it’s what you think. Reality is, that if you’re perfectionist — like me — every other day you discover new beautiful technology and start writing your app from scratch. But you feel the energy. You think — “if only I could stop working for someone else”.</p><p>I didn’t see one thing — I had huge problems with motivating myself. I haven’t noticed it when working for someone, because motivation there was “external”. Also, it’s always different, when someone is next to you. In general, I think people I’ve worked for were happy about my work.</p><p>Now I think, that if you’re not able to organize your life rhythm and self-discipline on a fundamental level, big things will never happen in your like. I was always thinking — I’d like to start going to the gym and eat better food, but I was never able to start doing it.</p><p>Besides that, I’ve understood that all this planning app idea became one big excuse to delay my life plans and goals. I thought back then that I’ll start doing things when Timpler will be ready. No other app will schedule my plans so well. Manually moving things in my calendar was annoying — and it still is and I still want to change it, but then it was just an excuse.</p><p>It’s so ironic — while working on a productivity app, I had no idea what a mess my own approach to productivity is.</p><p>Going back to me leaving my work. After around 2 months I was not able to work productively for more than 2–3 hours a day. However, I was angry when someone wanted to go out with me. I felt like they’re stealing my precious time. I wanted more hours in my days, instead of more days in my hours.</p><p>In the end, savings were shrinking and I’ve released a version of the app that was barely used by anyone. I was so in love with my idea, that I ignored all feedback and I simply lost contact with reality. I was polishing button animations for hours, while not thinking about the general usability of it.</p><p>I knew this idea for so long, that things that new or weird for others, were obvious for me.</p><p>After I’ve released it, I almost instantly abandoned it. I was not replying to feedback. I was too “tired” to create marketing materials. I think the metaphor about school love is accurate here — I achieved something, but what was turning me on was dreaming about the goal, not the goal itself. I was in love with dreaming.</p><p>After another year I’ve tried once again. I’ve started from scratch. I’ve tried to think more. I was already experienced a bit with creating products. I’ve worked in a few startups. In general, I did it. I’ve released a new version that was downloaded by 2500 people pretty quickly. It has a 4.8 rating in the app store. It’s not as awesome as the initial idea, but I’m proud I was able to limit my own expectations. I’ve released an app with missing features, but it was working well.</p><p>Nevertheless, I was again working on many things at once: my full-time work, Timpler and some freelance projects here and there. And then something I didn’t expect happened.</p><p>Things started to become harder and harder for me. Even going out to buy something for breakfast in the morning. Finally, things became so hard, that I was just laying in my bed looking at the wall.</p><p>I’ve started to under-deliver in my work. It felt terrible because even tho I was never fully satisfied with working for someone else, I’ve always tried to be honest. I’ve told my boss about it, and he was very helpful to me.</p><p>I had a trip to the USA planned. We were supposed to work with the team together for a few weeks. Yet I was not even able to work. I thought that it’s time to accept something is stronger than me and I need to see a doctor. He prescribed me some pills and gave a phone number to the psychotherapist. Time in New York was really hard. I was in the city of my dreams, yet taking 5 minutes to walk around my place was a huge challenge for me.</p><p>Working in person with other people was helpful. Chronic depression (this is how I see it now looking back) is not so great if you work remotely.</p><p>I wanted to lower my salary, but my boss said something I’ll never forget. “I understand, but please don’t do it. If you’re the owner of some building and you’re renting it, you’ll not lower the price when someone destroyed the street next to it, because it’s not your fault”</p><p>And here we are today. I’ve come back from the US recently. The app is growing slowly, but constantly. And yet… I’m trying to work on it as little as possible. Not because I don’t want to, but because I think I can’t do it in a healthy way. I just hope good things are still ahead.</p><p>I think I’ve finally understood that if you cannot maintain your diet without an app — it means you should not try to change the world yet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZBIebxfnI6BF8nVgI4ZzCQ.png" /><figcaption>…and this is Timpler — <a href="https://apps.apple.com/us/app/timpler-to-do-list-planner/id1432739728">https://apps.apple.com/us/app/timpler-to-do-list-planner</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62ac160fa4f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jak praca nad aplikacją do produktywności zrujnowała moją produktywność?]]></title>
            <link>https://medium.com/@pie6k/jak-praca-nad-aplikacj%C4%85-do-produktywno%C5%9Bci-zrujnowa%C5%82a-moj%C4%85-produktywno%C5%9B%C4%87-977fce7859a6?source=rss-cacc68bac9aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/977fce7859a6</guid>
            <category><![CDATA[życie]]></category>
            <category><![CDATA[produktywność]]></category>
            <category><![CDATA[programowanie]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Adam Pietrasiak]]></dc:creator>
            <pubDate>Sat, 14 Mar 2020 16:06:45 GMT</pubDate>
            <atom:updated>2020-03-14T19:50:26.021Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*97gMM84lSEW5e7CKWJX6_A.jpeg" /></figure><p>Wszystko zaczęło się wiele lat temu. Zawsze lubiłem szukać nietypowych rozwiązań, zawsze marzyło mi się osiągnięcie czegoś wielkiego. Wpadłem na pewien pomysł, który miał zrewolucjonizować sposób planowania czasu. Nadal w niego wierzę, ale kiedyś byłem jego fanatykiem.</p><p>To trochę jak z sympatią z liceum, z którą nigdy nie udało Ci się umówić na randkę. Fantazjujesz i idealizujesz. Zakochujesz się na końcu nie w niej, ale w swoich myślach o niej, a one są wolne i mogą wystrzelić w niebo. Mogą zupełnie oderwać się od rzeczywistości. Po kilku latach spotykasz ją przypadkiem w kawiarni i po 15 minutach myślisz sobie “co ja miałem we łbie i po co straciłem na nią tyle czasu”.</p><p>Chciałbym opowiedzieć bardziej o procesie, niż o aplikacji, ale żeby to miało jakikolwiek kontekst — parę słów -</p><p>Timpler, bo tak się nazywa — pozwala usprawnić sposób w jaki planujemy czas. Generalnie chodzi o to, że gdy mamy coś do zrobienia, to prawie nigdy nie wiemy, kiedy będzie na to najodpowiedniejszy moment. Tylko w kilku przypadkach, takich jak wizyta u lekarza, sprawa jest jasna. Data, godzina, musisz tam być. Ale telefon do rodziny, poczytanie książki, wyniesienie śmieci, podlanie kwiatków i zabranie żony na randkę — chcesz to wszystko robić, ale pytanie o to kiedy jest bardzo płynne.</p><p>Timpler skupia się na tym, aby opisać “rytm” zadań, a nie terminy. Np “w słoneczny dzień”, albo “kiedy i ja i moja żona mamy wolne 2 godziny”, czy tam “co najmniej 3 razy w tygodniu”. Gdy opiszesz ten rytm, możesz być spokojny, że wszystko będzie zaplanowane jak trzeba, nawet jeśli niespodziewanie odwiedzi Cię ciocia z ameryki i rozwali Ci cały weekendowy plan. Po prostu w poniedziałek klikniesz “zaplanuj od nowa” i już.</p><p>Robiąc mały spojler — dla mnie Timpler skończył się dość poważną depresją.</p><p>Ale po kolei. Przy pierwszym podejściu miałem jakieś 22 lata. Nie miałem tak naprawdę pojęcia, jak zrobić skomplikowaną aplikację. Robiłem strony i podobne rzeczy. Byłem na tyle pewny siebie i zuchwały, że pomyślałem, że to żaden problem. Pierwsze podejście obyło się generalnie bez konsekwencji dla mojego zdrowia. Efekt był taki, że poza pięcioma prototypami, nic z tego nie wyszło. Ale mi też nic wielkiego się nie stało. Generalnie pracowałem na etat tu i tam i to bardzo rozciągało wszystko w czasie.</p><p>Minęły lata, a ja ciągle coś skubałem. Robiłem aplikację do planowania czasu, a jednocześnie ciągle spóźniałem się na umówione spotkania i zapomniałem odpisać na maila, kilka dni po tym, gdy to komuś obiecałem. Ciągle mówiłem tym, którzy pytali o aplikację, że niedługo.</p><p>Później poznałem moją żonę. Zarabiałem nieźle i udało się odłożyć trochę pieniędzy. Postanowiłem rzucić robotę i żyć z oszczędności około pół roku. Żona mi ufała i zawsze mnie wspierała.</p><p>Początek był świetny, ale po jakimś czasie sprawy zupełnie się rozjechały, a ja generalnie myślę, że byłem kłębkiem frustracji. Nie dlatego, że nie umiałem pisać kodu. Umiałem. Ale dlatego, że zupełnie nie rozumiałem, jak solidnie pracować, gdy nikt cię do tego nie zmusza.</p><p>Gdy masz etat — jest inaczej. Wracasz po 8 godzinach i masz ciągle pełno energii, żeby pracować nad swoim produktem. Tak ci się przynajmniej wydaje. Tak naprawdę, gdy jesteś perfekcjonistą, jak ja — co kilka dni znajdujesz nową świetną technologie i piszesz wszystko od nowa. Ale czujesz power. Myślisz sobie — “gdybym tylko nie musiał pracować dla innych”.</p><p>Nie zauważałam pewnej rzeczy — miałem ogromne problemy z motywowaniem samego siebie. Nie widziałem tego w pracy, bo motywacja była zewnętrzna. Zresztą to zawsze jest inaczej, gdy ktoś siedzi obok ciebie. Generalnie chyba ci, którzy mnie zatrudniali byli względnie zadowoleni.</p><p>Ale dzisiaj widzę, że jeśli w swojej głowie fundamentalnie nie uporządkuje się dyscypliny i rytmu życia, to wielkie rzeczy nigdy się nie wydarzą. Myślałem sobie — chciałbym więcej chodzić na siłownie i zrobić jakąś dietę, ale nigdy mi to nie wychodziło.</p><p>Po pewnym czasie zrozumiałem, że cały ten pomysł na aplikację był dla mnie jedną wielką wymówką i powodem do odwlekania własnych planów w życiu. Ciągle myślałem — będę to robił lepiej, gdy Timpler będzie działał. Żadna apka, którą znam nie zaplanuje tego tak fajnie. Wkurzało mnie ręczne przenoszenie wydarzeń w kalendarzu — i dalej mnie wkurza i dalej chcę to zmienić. Ale wtedy to po prostu była wymówka.</p><p>To trochę ironia. Chcąc zmienić świat produktywności nie widziałem, jak wielki chaos panuje w mojej własnej.</p><p>Tak czy inaczej, po ok 2 miesiącach nie umiałem pracować skutecznie więcej niż 2–3 godziny dziennie. Mimo tego, wkurzałem się, gdy ktoś chciał się ze mną umówić, bo czułem jakby kradł mój czas. To była studnia bez dna — chciałem więcej godzin w dniu, zamiast więcej dnia w tych godzinach.</p><p>W końcu oszczędności się skurczyły, a ja wydałem wersje, której prawie nikt nie używał. Byłem tak zakochany w tym pomyśle, że zupełnie nie skupiałem się nad zbieraniem feedbacku i kontakcie z rzeczywistością. Potrafiłem dłubać animację jednego guzika przez kilka godzin, nie zastanawiając się, czy cała aplikacja jest w ogóle zrozumiała dla kogokolwiek.</p><p>Znałem ten pomysł tak długo, że rzeczy, które dla innych były nowe lub dziwne, dla mnie były oczywiste.</p><p>Gdy ją wypuściłem, to w zasadzie natychmiast ją porzuciłem. Nie chciało mi się odpisywać na feedback, którego i tak nie było zbyt dużo. Nie chciało mi się robił grafik promocyjnych. Myślę, że metafora z licealną miłością tu pasuje — coś udało się osiągnąć, ale tak naprawdę to marzenie o celu mnie kręciło, a nie sam cel. Byłem zakochany w marzycielstwie.</p><p>Po mniej więcej roku spróbowałem jeszcze raz. Zrobiłem wszystko od nowa. Starałem się lepiej przemyśleć, jak się za to zabrać. Pracowałem już w kilku start-upach, widziałem jak robi się produkty. Generalnie udało mi się. Wypuściłem wersje, którą dość szybko ściągnęło 2500 osób. Średnia ocen 4.8 w App Store. Obecna wersja nie jest tak wystrzałowa jak pomysł, który opisałem wcześniej — wiele rzeczy trzeba jeszcze zrobić, ale cieszę się że udało mi się trzymać samego siebie na smyczy. Wypuściłem okrojoną wersje, która działa w miarę dobrze.</p><p>W każdym razie, przed długi czas znów robiłem kilka rzeczy na raz: pracę na etat, Timpler, a na boku brałem takie albo inne zlecenie. I tu się stało coś, czego się troche nie spodziewałem.</p><p>Nagle, stopniowo coraz bardziej — wszystko było trudniejsze. Wszystko, nie wyłączając powieszenia prania i skoczenia po bułkę do sklepu. W końcu nawet to było zbyt trudne, generalnie leżałem w łóżku i gapiłem się w sufit.</p><p>Zacząłem zawalać pracę, czułem się z fatalnie, bo mimo że nigdy nie satysfakcjonowała mnie w pełni praca dla kogoś, starałem się być pracowity i uczciwy. Powiedziałem o tym szefowi, był dla mnie naprawdę w porządku.</p><p>Miałem zaplanowany wyjazd do USA do firmy w której pracowałem, a ja czułem, że nie jestem w stanie zrobić niczego. Pomyślałem, że pora skończyć kozaczyć i poszedłem do psychiatry. Dostałem piguły i namiary na psychoterapeutkę. Czas w stanach był naprawdę trudny, czułem że jestem w mieście moich marzeń, w Nowym Jorku, a przejście się jedną alejkę od domu było dla mnie ogromnym wyzwaniem.</p><p>Znów pomogła mi praca z kimś ramię w ramię. Przewlekła depresja (bo tak patrzę dzisiaj na kilka poprzednich lat) połączona ze zdalną pracą może się kiepsko skończyć i generalnie nigdy nie funkcjonuje świetnie.</p><p>Proponowałem szefowi obniżenie swojej wypłaty — czułem, że nie dowożę tyle, ile chcę. Powiedział wtedy, i bardzo jestem mu wdzięczny, coś takiego — “Rozumiem, ale nie róbmy tego. Jeśli jesteś właścicielem kamienicy i wynajmujesz mieszkania, a budowlańcy rozwalili drogę dojazdową, to nie obniżasz czynszu, bo to nie jest Twoja wina. Rozwiązanie problemu nie polega na obniżeniu standardów”.</p><p>I tak dochodzimy do dnia dzisiejszego — niedawno wróciłem. Aplikacja się rozwija, a ja… staram się pracować nad nią jak najmniej. Nie dlatego, że nie chcę, ale dlatego, że nie umiem jeszcze robić tego w zdrowy sposób. Boję się znów wpaść w studnię bez dna. Staram się poukładać swoją głowę i mam nadzieję, że wszystko przede mną.</p><p>Myślę, że zrozumiałem, że jeśli nie umiesz zorganizować swojej diety bez pomocy aplikacji, to nie jest czas, aby brać się za wielkie rzeczy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZBIebxfnI6BF8nVgI4ZzCQ.png" /><figcaption>Oto Timpler — <a href="https://apps.apple.com/us/app/timpler-to-do-list-planner/id1432739728">https://apps.apple.com/us/app/timpler-to-do-list-planner</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=977fce7859a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I’ve created an app that solved my productivity problems]]></title>
            <link>https://medium.com/@pie6k/ive-created-an-app-that-solved-my-productivity-problems-e841731b12da?source=rss-cacc68bac9aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/e841731b12da</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[startup-lessons]]></category>
            <category><![CDATA[tools]]></category>
            <dc:creator><![CDATA[Adam Pietrasiak]]></dc:creator>
            <pubDate>Sat, 25 Jan 2020 20:31:41 GMT</pubDate>
            <atom:updated>2020-01-25T20:43:05.612Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yy_L1m0x5xRVupWNQryp5Q.png" /></figure><p>It was the year 2014 when I had this idea for the first time. It might seem obvious, but it stayed with me since then.</p><blockquote>Most of the things we do in our life doesn’t have to be completed at a very specific moment in time</blockquote><p>Yet, most of the “productivity” tools assume that.</p><p>Calendars assume that if you put your ‘to-dos’ there (which so many people do). To-do lists assume that by requiring you to put specific due dates on your tasks.</p><p>And if you don’t put a due date on your tasks — you risk that you’ll forget about them forever, because they’ll be at the end of the list you never actually check.</p><p>Even if you want to build some routine, most of to-dos apps has only basic repeating features like “every 2nd day”. But I don’t know if I’ll be running on Wednesday or Thursday!</p><p>So, this idea stuck to me. During all those years, I’ve created 3 versions of this app (<a href="https://twitter.com/timplerhq/status/1216839514620121095">screenshot</a>). Previous ones failed badly. I’ve learned a lot and it became my personal goal to finally release the version I can be proud of. I wanted to do it last year and I did it on Dec 31st.</p><p>So, there are basically two groups of things we do.</p><ol><li><strong>Events</strong>. Something that simply has to be done at a very point in time. Eg. Doctor appointment</li><li><strong>Everything else</strong>.</li></ol><h3>Well… so what is this app actually doing?</h3><p>Timpler app (this is how it’s called) schedules everything it can, so you can focus on actually doing it. You also don’t have to worry if your grandma visits you and you have to re-schedule everything. With Timpler it actually requires just a few taps, even if you have 50 overdue tasks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GPTkkKFaNVVh_PUJEkstLw.png" /><figcaption>Here it is. 🙄</figcaption></figure><h4>Automatically scheduled habits and routines</h4><p>I think those are the most flexible things we can “plan”. It’s not important when exactly you do meditate, read, run or call your relatives. It’s important that you follow some basic schema.</p><p>When you create a habit in <a href="https://apps.apple.com/us/app/timpler-to-do-list-planner/id1432739728">Timpler,</a> it’ll instantly schedule it for you, trying to find the perfect spot. If you’ll decide to pick specific date for some of your running sessions, you, of course, can, but when you’ll finish — it tries to schedule the next sessions automatically, again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*24SHa3ZQQ78oPAC8DWGKEA.png" /><figcaption>Mark your task as a habit, set the rule, have it scheduled.</figcaption></figure><h4>Planning your day and week</h4><p>I think it can always happen that we’ll simply fall behind the schedule sometimes. I think it is OK and it should be easy to “start again” with a blank page, yet without worrying if we forgot about something.</p><p>If your daily schedule starts to get messy, you can use the “Plan my day” button.</p><p>It’ll allow you to quickly “clean up” overdue tasks, then it’ll allow you to review your current plan and add new tasks with smart task suggestions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lf4z4jPaCYN_Ml4abReuKQ.png" /><figcaption>Quickly decide about old tasks and find new tasks</figcaption></figure><h4>…and way more other features</h4><ul><li>Smart lists, eg. “frequently rescheduled tasks” or “stale tasks”</li><li>Detailed statistics</li><li>Focus mode (aka. Pomodoro 🍅)</li><li>Reminders for tasks and routines</li><li>Dark Mode 🎭</li><li>Offline support</li><li><strong>👌 it’s free! (no premium features, no subscriptions). It might change at some point, but I want to appreciate early adopters, and they’ll not have to pay.</strong></li><li>…and (I hope!) great design.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5ygZjyNcEOQDjXMhTp-rzA.png" /></figure><p>Thank you for your <strong>Time</strong>.</p><p><strong>App Store link: </strong><a href="http://timpler.com/ios"><strong>https://timpler.com/ios</strong></a></p><p>Website: <a href="https://timpler.com/">https://timpler.com</a> (note it’s slightly outdated and I’ll update it soon)</p><p><em>(Android version will be available around March 2020)</em></p><p><a href="https://twitter.com/timplerhq">Follow Timpler on Twitter</a> if you want to know what coming or just to know when the Android version is out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e841731b12da" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chaining React Native Animated Values]]></title>
            <link>https://medium.com/@pie6k/chaining-react-native-animated-values-e352bc18d928?source=rss-cacc68bac9aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/e352bc18d928</guid>
            <category><![CDATA[animated-api]]></category>
            <category><![CDATA[promises]]></category>
            <category><![CDATA[timing]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Adam Pietrasiak]]></dc:creator>
            <pubDate>Wed, 21 Nov 2018 04:25:00 GMT</pubDate>
            <atom:updated>2018-11-21T04:25:00.655Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EN_5mAGJLbPiI7hEjeJWQw.jpeg" /><figcaption>Animated values can get ‘chainy’</figcaption></figure><p>React Native Animated api is very powerful, but it can become pain, if you need to compute complex values (eg. during dragging, when element needs to get smaller the further you drag it away)</p><p>With built in set of tools you could do something like</p><pre>const newAnimated = Animated.add(oldAnimatedA, oldAnimatedB);</pre><p>It looks fine, but can get hairy quickly.</p><p>For case with making element smaller when dragged away futher would be nice to be able to write something like</p><pre>const { panDistanceX, panDistanceY } = this.animated;<br>const itemScale = panDistanceX.add(panDistanceY).divide(200).diffClamp(0.6, 1);</pre><p>This is exactly what lib I’ve created, called react-native-animated-manager is doing. You <a href="https://github.com/pie6k/react-native-animated-manager">can check it out here</a>.</p><h4>Calling animations as promises</h4><p>Beside that, you can call animated value spring or timing as promise</p><pre>animatedManager.spring({toValue: 1}).then(someCallback);</pre><pre>or</pre><pre>async function() {<br>  await animatedManager.spring({toValue: 1});<br>  console.log(&#39;animation done&#39;);<br>}</pre><p>Here is full list of possibilities</p><pre>// allowed input for AnimatedManager class and methods<br>type AnimatedValueInput = number | boolean | Animated.Value | AnimatedManager;<br><br><br>// return raw react natvie Animated.Value<br>value.getValue(): RawAnimatedValue;<br>// inverts value that is in 0-1 range.<br>// example: const animatedOpacity = isHidden.invert()<br>// it&#39;s shortcut of .interpolate({ inputRange: [0, 1], outputRange: [1, 0})<br>value.invert(): AnimatedManager;<br><br>// basic mathematical operators - under the hood it just use raw Animated.add etc but in chainable way<br>// also every valid AnimatedManager input can be used eg. someValue.add(new Animated.Value(2), 50, true)<br>value.multiply(...inputs: AnimatedValueInput[]): AnimatedManager;<br>value.subtract(...inputs: AnimatedValueInput[]): AnimatedManager;<br>value.add(...inputs: AnimatedValueInput[]): AnimatedManager;<br>value.divide(...inputs: AnimatedValueInput[]): AnimatedManager;<br><br>// Works the same as raw Animated.spring etc, but doesnt need .start() to be called and returns promise that is resolved when animation is finished<br>value.spring(config: RawAnimated.SpringAnimationConfig): Promise&lt;this&gt;;<br>value.timing(config: RawAnimated.TimingAnimationConfig): Promise&lt;this&gt;;<br><br>// works exactly as native interpolation function<br>value.interpolate(interpolation: RawAnimated.InterpolationConfigType): AnimatedManager;</pre><p>I hope it might be useful for you.</p><p>My name is Adam and I’m open for freelance work.</p><p>Check out my <a href="https://twitter.com/pie6k">twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e352bc18d928" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GraphQL + Typescript = strongly typed api schema]]></title>
            <link>https://medium.com/@pie6k/graphql-typescript-best-way-to-write-type-safe-schema-88d3c302ad19?source=rss-cacc68bac9aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/88d3c302ad19</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Adam Pietrasiak]]></dc:creator>
            <pubDate>Fri, 20 Apr 2018 10:56:22 GMT</pubDate>
            <atom:updated>2018-04-20T11:03:03.051Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zMG-dAiGipVPF8SxlDuE4w.jpeg" /><figcaption>Everything you might read below is basically included on this photo.</figcaption></figure><p>Instead of defining GraphQL schema and THEN resolvers code, let’s write both as one thing.</p><h3>Let’s learn by example</h3><p>We have Product entity written as TypeScript class with id and price fields. We also have computed field isExpensive that returns true if price &gt; 50.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/56679f2b0fd782d8868253057d3174e5/href">https://medium.com/media/56679f2b0fd782d8868253057d3174e5/href</a></iframe><p>Everything is strongly typed here. It’s important, as it will allow inferring GraphQL schema out of it.</p><p>Let’s move forward. Code above would give us fully functional GraphQL object type. Now let’s create schema that is using it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b9004dd3c01225b0b4a068c72712a83b/href">https://medium.com/media/b9004dd3c01225b0b4a068c72712a83b/href</a></iframe><p>We’ve added some root Query field called findProductById. It have some argument and it returns Product object defined previously.</p><p>Again everything (including arguments) is strongly-typed, so it’s possible to guess how GraphQL schema would look like and to generate it automatically.</p><p>Let’s generate such schema and start some Express GraphQL api server.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a44ac797f9d0afcb31e6535857b1bdf8/href">https://medium.com/media/a44ac797f9d0afcb31e6535857b1bdf8/href</a></iframe><p>That’s all. Now, when we’d start server, it’ll handle query like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a09ed2a88833675f6350d7a2f14bf6fc/href">https://medium.com/media/a09ed2a88833675f6350d7a2f14bf6fc/href</a></iframe><p>As you’ve probably seen, I’m using library called typegql. It’s lib I’ve created with <a href="http://www.prismake.com/">Prismake</a> to help with 3 main things:</p><ul><li>have graphql schema type-safe</li><li>have single source of truth for schema types (instead of separated graphql and resolvers definitions)</li><li>have types and business logic as close to each other as possible</li></ul><p>You can check it out <a href="https://github.com/prismake/typegql">here</a>.</p><p>More examples with typegql:</p><ul><li><a href="https://github.com/prismake/typegql/blob/master/examples/basic-express-server">Basic Express example</a></li><li><a href="https://github.com/prismake/typegql/blob/master/examples/typeorm-basic-integration">Typeorm integration example</a></li><li><a href="https://github.com/prismake/typegql/blob/master/examples/forward-resolution">Forward resolution — eg. query only needed db fields</a></li><li><a href="https://github.com/prismake/typegql/blob/master/examples/nested-mutation-or-query">Nested mutations or queries</a></li><li><a href="https://github.com/prismake/typegql/blob/master/examples/serverless">Serverless eg. AWS Lambda</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*jVQHlsHzeJgkUWywqcqZYw.gif" /><figcaption>A to Z process of creating hello world api</figcaption></figure><p>Thanks for reading.</p><p>Follow me on <a href="https://twitter.com/pie6k">twitter</a>.</p><p>Check out <a href="https://github.com/prismake/typegql">typegql</a> library.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88d3c302ad19" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Better way to create type-safe Redux actions and reducers with Typescript]]></title>
            <link>https://medium.com/@pie6k/better-way-to-create-type-safe-redux-actions-and-reducers-with-typescript-45386808c103?source=rss-cacc68bac9aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/45386808c103</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Adam Pietrasiak]]></dc:creator>
            <pubDate>Wed, 31 Jan 2018 18:04:52 GMT</pubDate>
            <atom:updated>2018-02-07T11:54:26.657Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7-9LI12vXAcqlu4qdkl9aQ.jpeg" /></figure><p>For last few days, working on some React/Redux application, I was trying to figure out how to properly type redux actions and reducers.</p><p>I was not really satisfied with defining action names as independent strings like you’d usually do:</p><pre>const LOGIN_REQUEST = &#39;LOGIN_REQUEST&#39;;</pre><p>It leads to action names being independent from given action allowed payload. My goal was to create types that ‘knows’ what data can be sent with every action.</p><p>For sake of example, let’s consider we’re creating simple user login in store part.</p><p>Let’s see how everything is defined. There are 2 files — <strong>actions.ts</strong> and <strong>reducers.ts</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/29de8b68c6a6e75abb41dce50bc31677/href">https://medium.com/media/29de8b68c6a6e75abb41dce50bc31677/href</a></iframe><p>Beside not defining action names as exportable const, I’m also ‘kind of’ repeating writing action names as strings. While that’s true, everything is type-safe, meaning I’ll not be allowed to write wrong string, we have great IDE suggestions and few really nice takeaways:</p><ul><li>As actions are tied together with their allowed payload, it’ll never allow action creator to pass wrong data. Let’s try to add error to LOGIN_SUCCESS action</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lPgMVVRUQAuW-7QV1ORSCg.png" /></figure><ul><li>Also, it’ll knows what part of payload is missing for every action</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*73tYXQgq3EJ1cCDUK4RRRg.png" /></figure><ul><li>It’s able to suggest action names so there is, in fact single source of truth, even thought I’m not using single const definition of action name string.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HXQlTQBAJYZxDQPwVAF1ig.png" /></figure><ul><li>It’ll never allow action with incorrect name to be returned</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nbL8C37rHD1vRm2CkVE7jg.png" /></figure><h4>Also, working with reducer is now much easier:</h4><ul><li>Basing on <a href="https://www.typescriptlang.org/docs/handbook/type-inference.html">type inference</a>, inside reducer switch, it is able to ‘pick’ only needed part of payload</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*voFc6ssazsduRTjUeBR_Yw.png" /><figcaption>It knows we’re inside LOGIN_FAILED action, so there is only error string present here</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A6LtljgOhuLgDcmQ8ND45g.png" /><figcaption>It’ll detect we’re trying to access payload property that is not allowed for given action name</figcaption></figure><ul><li>Also, it makes writing reducers a bit faster, suggesting action names:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S0XdxUJPwPmfiSvJo1woQg.png" /><figcaption>Since action.type is strongly-typed, we know exactly what can be there</figcaption></figure><ul><li>…and will never allow wrong action name:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GYLzib11k13k35yIAIaq6g.png" /></figure><p>Let’s modify payload type of LOGIN_FAILED by renaming error field to errorData.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fuyqVn0I4ZdnsjO1DQ0Z4g.png" /></figure><p>Now, we instantly see errors caused by this change, both in action creators and reducer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KdyAKe-Y2VD6VyDQhb0ILg.png" /><figcaption>Action creator is aware of missing field</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NzwI0B4KpOhhWvT5pc0SiQ.png" /><figcaption>Reducer knows that LOGIN_FAILED payload has changed and detects we want to access wrong field</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3o7WIva13237Dnwi7S%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3o7WIva13237Dnwi7S%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F3o7WIva13237Dnwi7S%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f7a8d1cae1f228edab86a2335008a76/href">https://medium.com/media/2f7a8d1cae1f228edab86a2335008a76/href</a></iframe><p>Glad if it’d be helpful for you. Thanks for reading.</p><p>Follow me on <a href="https://twitter.com/pie6k">twitter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45386808c103" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From iCloud to Dropbox and from Dropbox to Google Drive]]></title>
            <link>https://medium.com/@pie6k/from-icloud-to-dropbox-and-from-dropbox-to-google-drive-8e262f117b0a?source=rss-cacc68bac9aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e262f117b0a</guid>
            <category><![CDATA[google-drive]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[icloud]]></category>
            <category><![CDATA[dropbox]]></category>
            <category><![CDATA[cloud-storage]]></category>
            <dc:creator><![CDATA[Adam Pietrasiak]]></dc:creator>
            <pubDate>Thu, 04 Jan 2018 18:07:12 GMT</pubDate>
            <atom:updated>2018-01-04T18:07:12.746Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*24yrt6K8ttjxhk1TIMkgCA.png" /><figcaption><a href="https://unsplash.com/@lionelabrial">https://unsplash.com/@lionelabrial</a></figcaption></figure><p>Not a big deal that makes a big difference.</p><h3>I’ve started with iCloud</h3><p>I’m heavy iPhone and Mac user. It seemed natural. All my document synced between devices with great support and system integration. And it’s true. That works great and no other cloud solution will have so good Apple ecosystem integration</p><p>Yet, few key features were missing and that made me resign</p><ul><li>There is no easy way to share your photos or documents. No way to simply get shareable link to open on my grandma old Windows laptop. iCloud requires anyone to have an iCloud account in order to see your content.</li><li>Web interface feels really bad for me. It tries too hard to be iOS-like while basic features like renaming folders have really awful UX</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*071vdFDxdbyfDlUW0deA-g.png" /><figcaption>Took me 5 minutes to find out how to rename empty folder</figcaption></figure><p>In general, lack of solid sharing made me migrate from iCloud. And it was sad choice for Apple user.</p><h3>Dropbox is beautiful and it was so close…</h3><p>Dropbox is solid sharing service. It has 1 click sharing, solid photos browser, good integration with Desktop and Phone. Also, Dropbox is really well designed and it simply looks beautiful. It was important for me.</p><p>Another thing is quite fresh Dropbox Paper —medium.com like text editor. I must say I was really impressed by it. If you haven’t — you should <a href="https://www.dropbox.com/paper">give it a try.</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fj5dHMB1eCmY%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dj5dHMB1eCmY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fj5dHMB1eCmY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba01f5e28583a327f00fa77ece03910d/href">https://medium.com/media/ba01f5e28583a327f00fa77ece03910d/href</a></iframe><p>It offered amazing text writing experience. Had covered integrations with every social media or service you can imagine.</p><h4>There was just one thing…</h4><p>I consider entire cloud services things as easy-access reference system. I’m a huge fan of GTD (Getting Things Done) metodology and it says:</p><blockquote>For the Reference Material to be really useful it must meet two things: first, it should always be within reach, and secondly, it should both allow storing as well as finding and retrieving the information we need quickly and easily.<br>[…]<br>If your filing system isn’t fast, functional, and fun, you’ll resist the whole process</blockquote><p>If I’m not able in under 20 seconds to:</p><ul><li>Find anything I need and I know I have in my reference material</li><li>Decide where I want to put new piece of material and start creating / uploading it</li></ul><p>I’ll stop using it with time and make it a black hole.</p><p><a href="https://facilethings.com/blog/en/organize-reference-material">How to Organize Your Reference Material</a></p><p>So the thing with Dropbox is that <strong>Dropbox Paper is not really integrated with Dropbox itself…</strong></p><p>You’re not able to create folder, add few files there and then create ‘Paper’ there and write something there.</p><p>Such constraint makes you keep related pieces of information in 2 separated places (paper files and dropbox files) and that was single thing that made me migrate again.</p><h3>And Google Drive…</h3><p>I really didn’t want to use it. The reason was <strong>I don’t like Material design</strong>. I didn’t want to use Google apps on daily basis on my phone and desktop just because of that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*D_RZTHzwG0QjHnW8PgxUAA.png" /><figcaption>For me, Material Design looks nerdy and it seems Google likes it this way.</figcaption></figure><p>But in the end, I had to agree it had all I needed:</p><ul><li>Solid one-click sharing with photos galleries</li><li>Great integration between storing and creating. While I consider Dropbox Paper to have much better UX than Google Docs, Google let’s you integrate it with your files system and that’s very important for personal, usable references system that is enjoyable to use.</li></ul><h3>Would I return to Dropbox?</h3><p>Maybe Dropbox will integrate their satellite services with Dropbox itself somewhere soon. I’m not sure if it’d make me return</p><ul><li>Migration process of hundreds of GB’s is pain in the a**.</li><li>While using Google Drive, I’ve discovered other products like Google Photos and they seems to be good</li></ul><p>What are your thoughts? Do you care a lot about usability of your cloud storage? Are you able to find and store whatever you need to (travel tips from Europe, your grandma cake recipe) in seconds?</p><p><a href="https://twitter.com/pie6k">Follow me on twitter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e262f117b0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up synchronized GraphQL and Typescript workflow]]></title>
            <link>https://medium.com/@pie6k/setting-up-synchronized-graphql-and-typescript-workflow-8440790cc641?source=rss-cacc68bac9aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/8440790cc641</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Adam Pietrasiak]]></dc:creator>
            <pubDate>Sat, 18 Nov 2017 13:18:09 GMT</pubDate>
            <atom:updated>2017-11-20T11:13:23.621Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-wKd4pMnuQVNIT8acJ62hg.png" /></figure><p>Switching from Javascript to Typescript is one way ticket. I’ve started using it around 2 years ago — now it feels really weird to write code without types.</p><p>Many will say writing typescript takes more time as you need to manage all type annotations too. Keep in mind, however, that if done well, with typescript you’ll forget about those for good:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qHyzbeC-r4gObWHJu177-g.png" /><figcaption>How many thousands of those have you seen?</figcaption></figure><p>Next to typescript, GraphQL feels as natural choice for type-safe, modern way to deal with data. I’m pretty sure someday, we’ll have next-generation IDE’s and tools, but for now, we don’t.</p><h4>Note for `<strong>flow`</strong> users</h4><p>Example I’ll cover is focused on <strong>Typescript</strong>. It should be *not that hard* to convert it to flow-types, but I’ll not cover it in this article.</p><h3>Goal</h3><ol><li>Being able to <strong>see all potential errors on frontend in my code every time schema will change</strong> on the backend</li><li>Having <strong>data interfaces created and updated automatically</strong> for all queries on frontend after every file save. Having those interfaces easily accessible from every place in frontend codebase.</li></ol><h3>Plan of attack</h3><ol><li>We’re going to write scripts that will fetch schema from given GraplQL endpoint.</li><li>Then, we’ll look for all queries and mutation definitions in codebase and define proper typescript data interfaces somewhere in root of project so they’re easily importable</li><li>We’ll watch for file changes and repeat step 2 when changes are detected</li></ol><h3>Fetching schema from GraphQL endpoint</h3><p>For fetching schema, we will use great package from Apollo called apollo-codegen. Add it to your project with yarn add apollo-codegen -d.</p><p>Then, we’ll use it to fetch schema and save it in our project with:</p><pre>apollo-codegen introspect-schema <a href="http://localhost:4000/graphql">&lt;</a>GRAPHQL_ENDPOINT_HERE&gt; output src/schema/schema.json</pre><p>I’ve chosen src/schema/schema.json to be place where I keep schema file.</p><p>If you need some <strong>authorization headers</strong> to fetch schema, you’ll need to add something like--header “Authorization: Bearer &lt;token&gt;” to console command. Checkout <a href="https://github.com/apollographql/apollo-codegen">https://github.com/apollographql/apollo-codegen</a> for more details.</p><p>You should probably add this script to scripts section of your package.json file like:</p><pre>&quot;scripts&quot;: {<br>    &quot;gql:schema&quot;: &quot;apollo-codegen introspect-schema &lt;GRAPHQL_ENDPOINT_HERE&gt; output src/schema/schema.json&quot;,<br>  },</pre><p>Test it by running yarn run gql:schema. scr/schema/schema.json file schould be created.</p><h3>Creating type interfaces basing on schema.json file</h3><p>Now, as we have our schema fetched, we can create type interfaces for all mutations and queries in our project.</p><p>There are two basic ways they’re defined:</p><h4><strong>.graphql files somewhere in project</strong></h4><p>For .graphql files, you’ll have to simply run:</p><pre>apollo-codegen generate **/*.graphql --schema src/schema/schema.json --target typescript --output src/schema/types.ts</pre><h4><strong>template literals like:</strong></h4><pre>imoport gql from &#39;graphql-tag&#39;;</pre><pre>const myQuery = gql`<br>  query MyQuery{<br>    allPosts {<br>      id<br>    }<br>  }<br>`;</pre><p>For those, we’ll need to run:</p><pre>apollo-codegen generate $(find ./src -name &#39;*.ts&#39; -o -name &#39;*.tsx&#39;) --target typescript --output src/schema/types.ts</pre><p>This by default assumes that tag you use is gql. If you use something else, add —-tag-name &lt;TAG_NAME_HERE&gt; to command above.</p><p>Note I’m using find as apollo-codegen doesn’t support multiple files extensions by default (like ts and tsx).</p><p>Now you can add this script to your package.json scripts section too.</p><pre>&quot;scripts&quot;: {<br>    &quot;gql:schema&quot;: &quot;apollo-codegen introspect-schema &lt;GRAPHQL_ENDPOINT_HERE&gt; output src/schema/schema.json&quot;,<br>    &quot;gql:types&quot;: &quot;apollo-codegen generate $(find ./src -name &#39;*.ts&#39; -o -name &#39;*.tsx&#39;) --target typescript --output src/schema/types.ts&quot;<br>  },</pre><h3>Watching files and updating types on every file change</h3><p>Here you have many options. I’m using watch-run (<a href="https://www.npmjs.com/package/watch-run">https://www.npmjs.com/package/watch-run</a>), but you could use anything that is able to run certain action after file change. With watch-run final command is:</p><pre>watch-run -p &#39;./src/**/*.ts, ./src/**/*.tsx&#39; &quot;yarn run gql:types&quot;</pre><p>Note that watch pattern depends on if you use .graphql files or gql etc. template literals for defining queries and mutations.</p><p>Let’s add it to package.json too. Also, let’s add another script that will run all of them and start watching.</p><pre>&quot;scripts&quot;: {<br>    &quot;gql:schema&quot;: &quot;apollo-codegen introspect-schema &lt;GRAPHQL_ENDPOINT_HERE&gt; output src/schema/schema.json&quot;,<br>    &quot;gql:types&quot;: &quot;apollo-codegen generate $(find ./src -name &#39;*.ts&#39; -o -name &#39;*.tsx&#39;) --target typescript --output src/schema/types.ts&quot;,<br>    &quot;gql:watch&quot;: &quot;watch-run -p &#39;./src/**/*.ts, ./src/**/*.tsx&#39; &quot;yarn run gql:types&quot;<br>    &quot;gql&quot;: &quot;yarn run gql:schema &amp; yarn run gql:types &amp; yarn run gql:watch&quot;<br>  },</pre><p>Last script is:</p><pre>yarn run gql:schema &amp; yarn run gql:types &amp; yarn run gql:watch</pre><p>so it is simply: fetching schema, generating types and starting watching files to generate them again on every file change.</p><p>Now, after running yarn run gql you should be ready to start working on it.</p><h3>Final notes</h3><p>There are few things that could be improved here:</p><ul><li>Re-generating types only for those files, that has changed</li><li>Adding possibility to automatically detect schema changes (right now you need to manually re-run script and know from your backend friend that schema has changed). As schema is not likely to change often it should not be *that* big deal.</li><li>Scripts we created could be moved to separated .sh files to avoid noise in package.json file.</li><li>Generated files could be included in .gitignore file to exclude them from repository. I’m actually not sure if it’d be good practice. Feel free to commend telling what you think about that.</li></ul><h4><strong>Follow me on </strong><a href="https://twitter.com/pie6k"><strong>twitter</strong></a></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8440790cc641" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>