r/node • u/draftax5 • Jul 21 '20
After a year of learning node and react native I build my first full featured app - Ledger: a workout logging and analytics app
9
u/ImprovisedGoat Jul 21 '20
I remember you posting this a while back. I downloaded it months ago (but never got to use it because I had a baby and then COVID). Did you re release it or something?
9
u/draftax5 Jul 21 '20
Hey! Congrats on the baby!
Thanks for downloading it! No, it is the same app, I did add a few bug fixes but that is about all.
I posted it in the r/react sub but didn't post it in the r/node sub. Since the entire backend is built using node I figured I would post it here too and hopefully get more people to try it out and give me feedback
5
u/ImprovisedGoat Jul 21 '20
Thanks man! Best of luck to you. When the world returns to normalcy I’ll give you my feedback haha.
9
u/_skris Jul 21 '20
Good work, it looks beautiful. I don't have an iPhone, so can't test it.
Your stack seems to be fine, I'd replace moment with dayjs. Wish you the best!
2
u/draftax5 Jul 21 '20
Thanks!
How is dayjs better than moment? Less bloated?
4
u/Akkuma Jul 21 '20
There's also moment's new version https://moment.github.io/luxon/, which might be less bloated too
7
6
u/_skris Jul 21 '20
Yes. Moment.js full minified file is 60kb+ vs dayjs's 2Kb
3
u/backdoorsmasher Jul 22 '20
If you're not shipping moment to the client and are only using it on the backend, this won't matter.
1
4
u/mctrials23 Jul 21 '20
How much time and effort were you putting into this over the year and what is your programming experience prior to this?
10
u/draftax5 Jul 21 '20
Well the whole project didn't take a year, I just started learning node and React Native a year ago. Actually, I started learning programming with virtually zero prior experience about a year ago.
The app itself took about 6 months, working on it mostly in the evenings after my day job and pretty much every weekend haha
4
u/Mr_Kill_Joy Jul 21 '20 edited Jul 21 '20
Not to be picky but i'm curious what is the realistic time estimate on the coding itself? Prior post was 10 months taken in evenings + after day job, and this was 5 months ago.
Is it now coming on 16 months?
Again not nitpicking but time taken is a good indicator to me of whether a language/framework is worth giving a shot. Looks a great app!!
4
u/draftax5 Jul 22 '20
No worries, that completely makes sense and I totally understand where you are coming from.
To clarify, I finished the app right before I posted it to the r/react sub 5 months ago. Shortly after that I did some bug fixes and added a couple features that I felt were necessary and from the feedback I got.
So, with that said I trust my memory of the event right after I finished it and I think the 10 month estimate is more accurate.
It has been awhile and I realized I never posted to r/node because back then I didn't want to spam subs with the same post. Since the backend is in node I was hoping to get more eyes on it and hopefully more feedback and discussion about the technology I used and possibly if there is anything better out there now.
But I didn't spend a ton of time thinking about it when I replied to u/mctrials23 and some of the specifics have faded and I estimated poorly.
Thanks for the compliment and thanks for giving me the opportunity to clarify!
3
Jul 21 '20
agree.
This is what I look for in the comment from the OP if a project is really well made.2
u/Mr_Kill_Joy Jul 21 '20
Yep!! It's so nicely polished the clarification request hopefully is taken as a compliment.
Sometimes find it can be a put of for others/myself who may undertake such a task under assumption such a timeline is realistic.
(as a weird side coincidence, I had a bit of a mini rant about this very thing a few weeks ago)
https://blog.grantdownie.com/blog/2020/07/this-took-me-19-minutes/
1
u/mctrials23 Jul 21 '20 edited Jul 21 '20
Great effort! Looks really good. What do you do as your day job? It’s a really nicely designed app so I was wondering if you are a graphic designer or something along those lines.
2
u/draftax5 Jul 22 '20
Actually I don’t have any design experience, I just kinda mess around until I find something I like. I am a software dev as my day job as well now
4
u/spconway Jul 22 '20
It’s one thing to code this app but it’s another to also have such a nice design too! Great job!
1
3
u/jacktheriipper999 Jul 21 '20
what do you use to make socials networks login, this is always a headache to me
2
u/draftax5 Jul 21 '20
You mean back end?
I coded it with passport, passport-bearer, to get the bearer token, and the social network API's.
If that is what you mean?
1
u/jacktheriipper999 Jul 21 '20
actually I don't know where to implement this, we have social network libs to react native and backend libs like passport, so thats why I question you what do you use, I think the right way is to implement it on backend, right ?
1
4
u/d_simoes Jul 21 '20
If you have a backend, yes. Essentially, all those "login with third party" flows are OAuth2 authorization code flow/grant. Understanding that will give you a better idea of what to use and where.
1
3
u/whatgoodisaphonecall Jul 22 '20
Where did you get the data for the exercises (bench prees, etc) themselves?
2
u/draftax5 Jul 22 '20
I scraped them and then ran them through a script that formatted them into a JSON object in the way I wanted them
2
2
u/mesoz Jul 21 '20
Thanks a lot man, this is exactly the type of app that I have been looking for when it comes to workouts. Almost went along and built it myself - now I don’t have to. Thanks again!
1
2
u/noikeee Jul 22 '20
That's an awesome, slick looking project, and also count me in as a potential user because if I ever track my workouts all I need is exactly this. Great idea.
1
2
11
u/inakineitor Jul 21 '20
This is just what I was looking for! Do you have plans to release it on Android?
6
2
u/Crisu83 Jul 22 '20 edited Jul 22 '20
Good work. The app looks dope.
I also have a few pointers about the stack:
Moment is heavily bloated; I would use date-fns instead
Lodash is usually unnecessary; I would just use what is available in ES out of the box and write my own helpers if there really is a need (not usually the case). A transpiler like Babel or TypeScript can really simplify things here
Mongo might become a bottle neck if a lot of people start using the app; you are running on AWS, so I suggest you check out DynamoDB and use the dynamo-easy client
GraphQL could be nice addition to the stack; be sure to check out Apollo if you have not already. It could simplify the server-client communication quite a bit and tooling around it is also really nice
Integration into HealthKit or similar would be nice, but I would still store the data myself
That is my 50 cents, I hope it helps.
3
u/draftax5 Jul 22 '20
Hey thanks a lot!
I really like those pointers!
As for lodash, I am really only importing a couple of their functions, but you are right, I should just write them myself and remove lodash as a dep!
I need to look into graphQL more but I have heard really good things about it!
How tough is it to switch from a REST API to an apollo server with graphQL? Can I do it incrementally?
1
u/Zheusey Jul 22 '20
Not OP, but you can totally do it incrementally. Have a set of REST APIs you call for certain things, and a graphql endpoint for other parts of the app. We have something similar at my shop, where the legacy app was built using Rails Controllers, and we are slowly moving parts of the main API to GraphQL. The experience isn't without hiccups though:
Remember that REST APIs are a well formed convention. They have worked out kinks in networking, performance and scaling. A REST API also allows for better optimized database querying. For smaller apps this might not be an issue, but make sure you are considering the trade offs.
1
u/draftax5 Jul 22 '20
Awesome, thanks for that info! Overall you are happy with your graphQL experience so far?
1
u/Crisu83 Jul 22 '20
No worries, I am glad that I could help.
You can definitely do the switch incrementally. GraphQL is basically a single endpoint that you send POST requests to and there is even an Apollo middleware available for Express that you can just drop into your app. Apollos docs are also pretty good so it should be easy to get started.
If you use TypeScript you can also try out GraphQL Code Generator which allows you to generate code for communicating with your GraphQL server based on your schema, queries, mutations and subscriptions. I would highly recommend using
.graphqlfiles for defining your schema, queries, etc.Does this answer your question?
2
u/draftax5 Jul 22 '20
Absolutely, thanks for the additional info. I am going to look into it for sure!
1
Jul 21 '20
Op, amazing project. Congrats! :)
If you don't mind, did you built the FE and BE, then you used Docker? Any good material to learn Docker?
I am almost done with my app but I have no clue if I should have started with Docker or if I can do it when I am done. :P
3
u/draftax5 Jul 21 '20
authorization code flow/grant
u/snipo gave a lot of great info!
Most of what he said I have used as well to learn about docker. digitalocean forums/guides are actually really good at explaining docker and how to deploy them.
I set up docker from the start and messed around with used docker for a dev environment but since I was the only one working on this project there were really no benefits and quite a few downsides to essentially running a VM vs just installing everything locally on your machine. I mostly did it to experiment and learn.
But you could absolutely add docker after the fact as well!
2
5
u/Snipo Jul 21 '20
It's definitely not hard to learn docker on a level that you can use to launch simple apps, the official documentation and digitalocean forums/guides were plenty enough for me to get an app running with back, frontend + a database. Also learn docker compose while you're at it, it helps a lot.
1
Jul 21 '20
Will do. Thanks!
3
u/Snipo Jul 21 '20
The only thing that caused me some headache was binding the internal and external ports of the containers, and setting up nginx to handle incoming traffic properly since it wasn't the only app running on my server. Aside from that it was a breeze using docker-compose.
2
Jul 21 '20
Hm. If I only have my app hosted in Heroku, I don't necessarily need nginx right?
2
u/Snipo Jul 21 '20
Tbh I've never bothered with heroku after a small tutorial, it would probably be better for a lot of things but at the time I also wanted to learn about linux servers and how I manage them, and just stuck to using that.
2
Jul 21 '20
So more things to check and learn now. Loved! Thanks man!
3
u/Snipo Jul 21 '20
If you for some reason decide to try out a vps hosting service (and you're located in Europe) I can't recommend hetzner enough, they're cheap, flexible and reliable.
1
u/tyler_hammer Jul 22 '20
This is great! If I may pick your brain for a moment. How did you go about building this? Is the node aspect just an API backend or is it all actually stored locally? I've been wanting to build my own app using Swift and Node, but not sure if it makes sense to create a separate backend when I could do everything locally with swift.
1
u/draftax5 Jul 22 '20
Hey, yeah so that was my struggle too, make a full backend with a DB vs just store everything locally on the phone.
I ended up deciding to store everything in a back end DB because I figured it would be easier to change the data, add features, etc if I had full control over everything and can easily change the structure if needed.
Plus, I really wanted the experience building a full featured REST backend with auth and if it was all stored locally there really wouldn't even be a reason to have login.
But there are downsides to it as well, like needing internet access, so it really kind of depends what your goals with the app are
1
1
u/campushappens Jul 30 '20
This some high quality work and it only took you one year to produce; quite impressive. I am learning RN and working on an app right and there are some things I am not 100% on. Would you be okay if I ask some questions about your deployment process?
1
2
2
2
2
u/LadyTerror666 Jul 22 '20
When reading and watchingthe video I was like "oh yes, that's what you wanted". Full of anticipation I visited the website and ... "oh no, iOS only". What a sad day. Are you planning an Android Version too? The features look so amazing, it would be a pity if not.
2
u/PatrickRNG Jul 22 '20
Really cool design and app! Nice job. How did you keep your motivation to finish the project? I think most of the developers who do side-projects have a problem with that and end up not finishing any, this includes me. And did you started upfront doing the code or you had any process before it? Like using Adobe XD/Figma or any other design software.
2
Jul 22 '20
The screen grabs alone look slick as hell. Nice work man! Building a very similar thing for the same reasons lol
1
1
u/palex25 Jul 22 '20
Hey the app looks great! Makes me wanna get into working out lol. Question, what, if any, courses did you take or do to learn node and react? I’m in the same boat, just started learning node and react and would like to know what opinions you had regarding learning.
1
u/Zheusey Jul 22 '20
This is incredible. Are you a designer in your day job? If not, how did you go about designing it and getting comfortable with the UX? I'm an intermediate developer and anytime I try to make my own thing, I feel like I end up with a design that resembles a web page from the 90s.
1
u/cmdrNacho Jul 22 '20
As someone that is probably in your target market, I can only compare to what I think is the best is the Strong workout app.
Ill give it a try but my biggest frustration with Strong is that I create a template with like lets say 6 different workouts for the muscle group I'm targeting, but ill only do what is available with time and whats available. Example if I can't do barbell squats because the rack is taken Ill substitute leg press machine with dumbbell front squats. Easily switching these things out tracking isn't so intuitive.
Also tracking exercises that they don't have listed in the pre-selected provided. I'd like to be able to add my own, right now I just find something close and add it.
1
-6
u/OmgImAlexis Jul 21 '20
Disappointed in it not having HealthKit sync or anyway to use the app before signing up. Don’t really get why we need to host our health data with you when HealthKit exists.
1
0
48
u/draftax5 Jul 21 '20
I built this out of my own frustration with the weight lifting / workout apps currently out there. I don't necessarily want to choose from someone else's pre built workouts. I want an app where I can simply create my own workouts without having to choose from pre made workouts, where I can see and follow my progress with analytics, and where the app keeps track of my overall metrics such as weight, rest time, etc.
I couldn't find anything the really fit what I wanted well enough, so I built my own, partly to solve my problem, and also to gain more experience building a full scale application.
I built a landing page for it as well since I needed to host the API anyway:
Ledger
If you are interested in the stack:
Backend:
- celebrate: validation
- cors,
- cross-env,
- dotenv-safe: better version of dot-env,
- email-templates: to style password recovery emails,
- express,
- express-rate-limit,
- jsonwebtoken,
- lodash,
- moment": to help with dates/times,
- mongoose: mongo ODM/ORM,
- morgan": for logging,
- nodemailer: email recovery,
- passport,
- passport-http-bearer,
- passport-jwt,
- pug: for email templating,
- uuid,
- winston: for logging
DB:
- MongoDB
- I usually work with SQL databases and wanted to try out NoSQL. I figured the structure of a workout app with workout logs would make sense to use a NoSQL structure. It worked pretty well especially using the mongoose ODM.
Everything for the backend is dockerized and hosted on AWS
Using travis for CI which builds my images on successful tests pushes to my registry. I am fairly new to devops so I have a lot to learn here.
Frontend:
- I wanted to focus on custom Components so nearly everything is built from scratch. I wanted a smooth feel so I tried to focus heavily on animations.
- In my opinion one of the big benefits React Native has is their animations API so I heavily utilized that.
- Another focus was on charts and analytics, I custom built many of the charts using forked react-native-svg-charts Components.
Any questions just ask!