TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Implementing Anonymous User Sessions – Firebase or Local IndexedDB?

1 点作者 wentin超过 1 年前
Hello fellow developers!<p>I am currently engrossed in the development of a new feature for my app, [Typogram](https:&#x2F;&#x2F;typogram.co), that aims to support anonymous user sessions of the app. I’m at a crossroads and could use some wisdom.<p>Quick background:<p>- For authentication and data storage, I use Firebase.<p>- Upon account creation, user data automatically finds its home in Firestore.<p>- I&#x27;ve also implemented local IndexedDB storage which is for offline usage and the storage of bulky data chunks like undo&#x2F;redo history that are not cloud-bound.<p>So, here lies the fork in the road: *Should I implement anonymous user sessions using Firebase anonymous accounts or should I lean on the local IndexedDB?*<p>*Firebase Anonymous Accounts*<p>- Operates much like a full-fledged account except no user information.<p>- User data would be stored in Firestore as usual, that comes with its own set of fees.<p>- ChatGPT says the Firebase anonymous session ends when browser closes, which is not ideal.<p>*Local IndexedDB*<p>- This route is financially free, storing user data locally in the user’s browser.<p>- I already laid the groundwork prior, so development time is shorter.<p>- The data is persistent even when browser is closed and reopened<p>Firebase tips the scale when it comes to data insights, offering a clearer perspective on the number of anonymous users and allowing for a nuanced tracking of their behaviors. But, it’s important to mention that to harness this, a decent investment of development time is necessary.<p>I’m eager to hear your valuable opinions, experiences, or insights on choosing the most effective path. Your input will be immensely helpful in navigating this decision!<p>Thank you in advance!

1 comment

jollyllama超过 1 年前
Sounds like a no-brainer for IndexedDB since it&#x27;s free and gets you the persistence you want. In terms of visibility, it shouldn&#x27;t be to difficult to add some telemetry regarding anonymous users that you could cache and push to Firebase periodically.
评论 #38029085 未加载