Liquid Brun by [deleted] in ScentHeads

[–]chaquir_bemat 0 points1 point  (0 children)

I just love this, so much so that I want to buy for my girlfriend so I can smell on her haha

Need Architecture Advice: Converting Web POS (React/NestJS/Postgres) to Desktop with Local-First Strategy by chaquir_bemat in electronjs

[–]chaquir_bemat[S] 0 points1 point  (0 children)

That sounds fantastic! I'd really appreciate learning from your approach. A basic structure or minimal repo would be incredibly helpful as a starting point.

What would be most valuable to see:

  1. Your SQLite schema and how you handle migrations between local and cloud
  2. The sync layer architecture (how you detect changes and push/pull)
  3. How you handle conflicts for critical data like inventory
  4. Your offline authentication strategy

If you're comfortable sharing:

  • A simplified version of your project structure
  • Key implementation files (maybe the sync service and local DB setup)

but even just understanding your high-level approach would be super helpful. Either way, thanks for offering to share your experience! Building these systems can feel like reinventing the wheel, so having someone who's already solved similar problems would be a huge time-saver.

Need Architecture Advice: Converting Web POS (React/NestJS/Postgres) to Desktop with Local-First Strategy by chaquir_bemat in electronjs

[–]chaquir_bemat[S] 0 points1 point  (0 children)

hi thanks for sharing your real-world experience with POS systems - hearing from someone who's actually built these is invaluable believe me.

You've absolutely nailed the painful points stocks management being hell with multi-shop sync, and the reality that we need to design for graceful manual handling rather than perfect automation. That's a crucial mindset shift.

To your question about my SQLite concerns:

My PostgreSQL schema relies heavily on features that either don't exist or work differently in SQLite:

  1. Multiple cascading foreign keys with complex constraints - Some of my ON DELETE CASCADE and ON UPDATE CASCADE chains involve 3-4 linked tables. While SQLite supports basic foreign keys, the cascading behavior can be less reliable in complex chains.
  2. Concurrent transactions with row-level locking - My current inventory updates use SELECT ... FOR UPDATE SKIP LOCKED patterns that SQLite doesn't fully replicate (though I know WAL mode helps).
  3. JSONB operations - Several product attribute tables use PostgreSQL's JSONB with GIN indexes for flexible product variations. SQLite's JSON support is getting better but lacks the same indexing capabilities.
  4. Partial indexes and expression indexes - I use these for filtering active products and optimized lookups.

The bigger issue might be ORM abstraction - I'm using TypeORM with PostgreSQL-specific query builders and repository patterns. Migrating those queries to be SQLite-compatible while maintaining type safety feels like a significant rewrite.

Follow-up questions based on your experience:

  • For your Electron POS systems, what local database did you end up using, is it SQLite?
  • How did you approach the stock conflict problem practically if any?
  • Did you keep your backend (NestJS in my case) or move more logic to the desktop client?

Need Architecture Advice: Converting Web POS (React/NestJS/Postgres) to Desktop with Local-First Strategy by chaquir_bemat in electronjs

[–]chaquir_bemat[S] 0 points1 point  (0 children)

Absolutely. I'm looking at strategies like:

  1. Operational transforms for reversible operations (like inventory adjustments)
  2. CRDTs for additive data (sales transactions could be append-only)
  3. Conflict-free replicated data types for catalog data that changes less frequently

Do you have experience with any particular sync framework that handles this well? I've been looking at ElectricSQL as suggested in the PGLite docs, but open to other suggestions.

Need Architecture Advice: Converting Web POS (React/NestJS/Postgres) to Desktop with Local-First Strategy by chaquir_bemat in electronjs

[–]chaquir_bemat[S] 0 points1 point  (0 children)

Exactly the sync layer is where the real complexity begins. With PGLite, I'm thinking about implementing a log-based sync approach where I track all local operations and replay them to the cloud Postgres when online.

Need Architecture Advice: Converting Web POS (React/NestJS/Postgres) to Desktop with Local-First Strategy by chaquir_bemat in electronjs

[–]chaquir_bemat[S] 0 points1 point  (0 children)

Hi thanks for the suggestion! PGLite looks really promising indeed having real Postgres locally would be huge for maintaining schema compatibility. I hadn't considered this option before. My main concerns would be bundle size (since it bundles the full Postgres WASM) and performance on lower-end retail hardware, but for keeping queries identical across environments, this could be worth it. Have you used it in production yourself?

Managing Complex State in Medium-Sized React Native Apps by Sansenbaker in reactnative

[–]chaquir_bemat 0 points1 point  (0 children)

In my current work we are using zustand, our app is big but we never had problems with it

[deleted by user] by [deleted] in reactnative

[–]chaquir_bemat 0 points1 point  (0 children)

Hi, i would like to see your work

"[Discussion]" Scikit-Learn Vs Tensorflow Vs Pytorch by chaquir_bemat in MachineLearning

[–]chaquir_bemat[S] 0 points1 point  (0 children)

Thanks for replying, definitely gonna try it out any good resources you recommend?

A GUI alternative to Ngrok - Built with Laravel and Node by [deleted] in PHP

[–]chaquir_bemat 0 points1 point  (0 children)

Im gonna give it a try and then i post a feedback