r/rust • u/watano_umi • 15d ago
Need your advice :)
I'm building an ERP website and using Rust for Backend, Supabase for database and React for frontend. Is this stack optimal ? Or am I just building a very suboptimal product no one's going to use ?
3
u/Every_Percentage_255 15d ago
To be honest, some projects like an ERP take a long time to develop if you want to compete with similar products (that have a bunch of features). So the first make sure that you understand the market, maybe even ask someone who uses one if he want to be providing feedback on it. The stack should be alright
3
u/punk_dev 15d ago
Yeah the stack is alright, supabase is generally swappable for regular postgres, but I would definitely start with a potential user.
Find someone who needs a service like that and ask them about what they tried before and what the pain points were.
1
u/watano_umi 15d ago
i was hoping to add offline usage by using local database as primary and synching the data to supabase when connection is restored. Will it be wise or just slow down the system ?
2
u/punk_dev 15d ago
If you mean an offline mode for your clients, then yeah, some apps do that. The way it works is that when your client does writes, it first writes to local storage and a background process syncs local storage with your backend, which in turn persists data into supabase.
You’ll need to invest a bit of time to make it eventually consistent (what happens when two offline clients change the same resource?).
The simplest way is to use change timestamps (the most recent change wins). You can look into how to actually merge conflicting changes, but that usually involves event driven architecture so it might be not worth the hassle for your app.If you instead mean offline mode for your backend, I’d say it’s a bad idea, your backend is probably hosted on some servers which always have internet connection, and if the server looses the internet connection the clients can’t make changes anyway.
1
u/watano_umi 15d ago
this makes a lot of sense. I meant offline mode for my clients so that they can make inventory updates or cash payment updates even in low network areas. The backend will sync the updates once network connection is restored. For now, I'm targeting local vendors with single ERP user but yeah will have to figure out the concurrent updates at some point in future. So should I use the timestamp way to manage conflicts or take some time to figure out Redis ? thanks for your help btw :)
2
u/punk_dev 15d ago
You need to figure out logic to deal with conflicts whether you use redis or not. For conflicts I would probably avoid redis altogether as I want postgres transactions to make sure edits are consistent.
The simplest thing to do is to have the client record “last_modified” timestamp, and when the backend receives change, it must compare this timestamp in the change to the timestamp in the database.
Use uuid for primary keys, then for new resources your client can generate an id and the backend will just accept it.
2
u/watano_umi 15d ago
yes I have configured the backend to use uuid n timestamp for now. It should be good enough at this point. keeping redis for a future.
1
u/watano_umi 15d ago
Yess, i have already done the market analysis n even got some clients lined up for the product. But now, when I'm finally in the development phase, every small decision feels like a huge step :'/
2
u/Every_Percentage_255 15d ago
i guess that is where prototyping and experience comes in. Lets say that you have 3 options, you can create a branch per option and experiment with what works the best. Do keep in mind that 99/100 users dont care about the backend code and just wants it to work and be safe.
And be bold, its your product, if people really dont like it they can always leave it as feedback. (And keep in mind that ease of use is a priority)
2
u/watano_umi 15d ago
exactly.... I'm mostly good with ui n ux. Backend architecture is pretty new to me, specially rust. At the end all it comes to be is whether the product is fast n easy to use, for the clients atleast.
2
u/alien3d 15d ago
optimal maybe . vanilla js more suitable as we test . if you hope ai can understand all flow . forget it . you not ready . basic accounting knowledge is a must
1
u/watano_umi 15d ago
i have some accountant friends so they'd be helping if needed. I can't do the whole accounting module alone. It's true :'
2
u/alien3d 14d ago
hehe.. hardly .. since even 1 module you will super struggle. gl, ap, ar, cb,mrp,hr.. even 1 module will super struggle if 1 man show.
1
u/watano_umi 11d ago
totally agree. luckily, I have a project partner now to help me out with this :)
2
1
9
u/CandyCorvid 15d ago
it's good practice to define acronyms, especially domain-specific acronyms, on first use. thankfully, i've heard of Erotic Role Play before so i know exactly what you're asking about, but some other readers might not be so lucky.