r/learnprogramming • u/heydasrat • 3d ago
How do you actually learn to design software architecture from scratch?
I'm a self-taught full-stack developer comfortable with the MERN stack, but I struggle with one particular skill: turning requirements into a well-structured application architecture.
I can build APIs, authentication and CRUD functionality, but when starting a project from scratch, I often get stuck thinking:
- Which things should become separate database models?
- How should those models relate to each other?
- When should I use references versus embedded documents?
- How do I divide responsibilities between different modules?
- Where do I even start?
I don't want ready-made architectures or code. I want to develop the ability to think like an engineer and make these decisions myself.
For experienced developers: How did you develop this skill? What practical methods, exercises or resources helped you learn to design scalable and maintainable applications?
5
u/ftranschel 3d ago
Build something that you care about enough to finish it. Then refactor it completely.
1
u/cyb3rstrik3 3d ago
I am also self taught, scalable and maintenance you learn as you go. Business requirements you just sort of do? Strong opinionated frameworks like NestJS, Laravel, and Rails, help extremely because they force you to structure your code. Start small with a single feature and then add more features as you go. Then find another interesting app like Uber or door dash and build that.
2
u/shipitcodes 3d ago
A practical way to get unstuck on the data model is to write down user stories first, like "a customer places an order with several items", and underline the nouns. Each noun is a candidate model, and the verbs tell you how they relate. A simple MongoDB rule: embed data when it is always read with its parent and stays small (an order's line items, an address), and use references when the child is shared, grows without limit, or is queried on its own (users, products). Before coding, sketch your top five queries, like "show a user's last 10 orders", and shape the models so those are easy. For modules, try one folder per feature with routes, a service layer for the business logic, and the model, so each piece has one job. Expect the first design to be a bit wrong and refine it as requirements show up.
1
u/aqua_regis 3d ago
Just a day ago: https://redd.it/1xzhj19
A little effort in searching goes a long way.
1
u/dahiya_xa 2d ago
what helped me was starting from the screens and actions, not the models. list what a user can do, then ask what data each screen needs to read and write. for mongo the rule of thumb i use: embed when the child is always read with the parent and doesn't grow forever (like addresses on a user), reference when it's shared, queried on its own, or can grow without limit (like orders or comments). then build the ugly version first, and when something is painful to change, that's usually a module boundary showing up. reading the code of an open source app similar to yours helps a lot too
0
u/Objective_Buy_7235 3d ago
Read a book on modern software architecture.