News for hackers. Stuff that matters.

Please help me with my Database choice

I am planning to make an mobile app (no web apps) for ios and android. It is a flashcard app and I am going to use swiftui and kotlin.

The flashcards are around a million in number, organised into 19 subjects, 5-10sections each, 10-20chapters under each section and several subtopics under each chapter.

An user will study daily from multiple chapters and subtopics from various subjects. I need to store that data and use it to run a spaced repetition algorithm and give dailycards for review. this will help them achieve spaced recall for effective memory. I may achieve 50,000 MAUs soon after launch. In future I will also be adding question banks to the app.

I am confused about going with mongo + realm or postgres + sqllite. Please help me choose. My users will be primarily from asia.

( 15 comments | on HN )
Re:Please help me with my Database choice by jruohonen on Saturday December 09, 2023 @02:53AM (#38579688)
> The flashcards are around a million in number, organised into 19 subjects, 5-10sections each, 10-20chapters under each section and several subtopics under each chapter.

I am not sure whether Sqlite scales, but that would be my first suggestion.

Re:Please help me with my Database choice by appalam on Saturday December 09, 2023 @10:49PM (#38588874)
Thank you. I am gonna go with firebase.
Re:Please help me with my Database choice by jruohonen on Sunday December 10, 2023 @01:14AM (#38589558)
> I am gonna go with firebase.

Go ahead, but remember that it is a bad choice privacy-wise.

Re:Please help me with my Database choice by brudgers on Saturday December 09, 2023 @01:20PM (#38584244)
It doesn't matter.

Stop planning and start building.

Then solve the problems one at a time when they matter.

Good luck.

Re:Please help me with my Database choice by appalam on Saturday December 09, 2023 @10:49PM (#38588873)
Thanks for the advice. WIll try to build the MVP asap.
Re:Please help me with my Database choice by leros on Saturday December 09, 2023 @02:28PM (#38585037)
50k users accessing 1M records is actually not a very big number from a scaling point of view.

Use whatever tech you know best and feel more comfortable using.

Re:Please help me with my Database choice by appalam on Saturday December 09, 2023 @10:48PM (#38588870)
Thank you for the comment. Firebase is gonna be my choice

I just have one concern though, the user will be interacting heavily with the flashcards while studing and I want to store that info for the algo. Should i go with an on-device database for it? or Firestore can handle it?

Re:Please help me with my Database choice by leros on Wednesday December 13, 2023 @12:41PM (#38631046)
If you can query for the flashcards once and save it on device, that would cut down your reads quite a bit and make your app work offline.
Re:Please help me with my Database choice by fragmede on Saturday December 09, 2023 @02:39PM (#38585152)
Just use Firebase and be done with it, and half the other steps it takes to build an app. For what you're describing, database operations isn't going to be a core competency or product differentiator, so it doesn't make sense to spend any more time on it than necessary.
Re:Please help me with my Database choice by appalam on Saturday December 09, 2023 @10:47PM (#38588863)
That's true. The users have a high motivation and a lack of resources, so they wouldn't worry about app size or installing the app. However, the UI has to be friendly and non-fatiguing. As you said, I will focus on the frontend now and use firebase to avoid complications in the backend.

I just have one concern though, the user will be interacting heavily with the flashcards while studing and I want to store that info for the algo. Should i go with an on-device database for it? or Firestore can handle it?

Re:Please help me with my Database choice by gtirloni on Saturday December 09, 2023 @03:10PM (#38585484)
PostgreSQL (+PgBouncer) will be more than enough and actually can reach higher transaction numbers than MongoDB since I doubt you need horizontal scaling for such workload.

It has the added benefit of doing a lot for you. With MongoDB you'll need app logic to do certain things. MongoDB improved ACID support but it's not as smooth as just starting PostgreSQL and use it right away.

But that all doesn't matter. Pick what you're comfortable with.

Re:Please help me with my Database choice by appalam on Saturday December 09, 2023 @10:46PM (#38588855)
Thank you for the reply. From other comments, I have decided to go with Firestore because that's faster and I am comfortable with it too.

I just have one concern though, the user will be interacting heavily with the flashcards while studing and I want to store that info for the algo. Should i go with an on-device database for it? or Firestore can handle it?

Re:Please help me with my Database choice by lgkk on Saturday December 09, 2023 @06:52PM (#38587485)
Use firebase firestore.

Use firebase auth.

Ship your app (checks watch) by tonight.

Good luck! Sounds like a cool app.

Re:Please help me with my Database choice by appalam on Saturday December 09, 2023 @10:48PM (#38588866)
Thank you veryyyy much. I am doing it solo and I am not a CS major. This comment made my day!

I just have one concern though, the user will be interacting heavily with the flashcards while studing and I want to store that info for the algo. Should i go with an on-device database for it? or Firestore can handle it?

Re:Please help me with my Database choice by lgkk on Sunday December 10, 2023 @01:29AM (#38589606)
Yeah. And firestore is real-time so you could do some cool stuff with that. Try their sdk out it’s really easy.