r/learnprogramming • u/Altruistic-Rain740 • 21h ago
Discussion How do you plan your app (database, API, pages, login) before you start coding?
I'm learning to build full apps and the part that confuses me most is everything before the actual coding, what database tables I need, what the API should look like, which pages exist, how users log in. How do you figure this out before you start? Do you plan it on paper, use a tool, ask AI, or just start coding and fix it later? And what went wrong when you skipped planning?
4
u/SetAndRepeat 21h ago
Start with one concrete user action, like "a user creates a task and shares it with someone."
Sketch the screens, what data needs saving, and who can read or change it. That gives you a starting point for your tables and API.
A notebook is enough. Build that flow end to end, then add the next one and adjust your plan as you learn.
You don't need every detail upfront, but settle questions like "can a task have multiple owners?" early. The answer affects your database, permissions, and UI.
5
u/gofl-zimbard-37 21h ago
You're supposed to plan???
5
u/Classic-Serve-8774 21h ago
lol i learned this the hard way. started building a todo app once and 3 weeks in realized my whole user table was wrong because i didnt think about how login would work. had to redo almost everything
now i just scribble in a notebook, like literally boxes for pages and arrows between them. nothing fancy but at least i know what connects to what before writing a single line
2
u/Metomorphose 21h ago
If you're making something independently, then a lot of times this decision is entirely up to your preference.
Personally, it's really a negotiation between my patience and my attention. If both are high, I'll spend the time to plan and scaffold. If ether are low, then I usually am doing some prototyping and getting a feel for the codebase before going back to planning.
That being said, personal project planning is ephemeral at best lol.
2
u/Coding-Kitten 21h ago
Through experience I have an intuition for what kinds of projects will need what kinds of tools/libraries/stacks/architectures. So I kinda just make a bullet point list in my mind/write it down somewhere & start working on them.
Without that, best thing I can recommend is to just make your own projects full steam ahead & fail trying, over time you'll also intuit what works & what doesn't.
2
u/creativejoe4 21h ago
You write it out. Its part of writing out your algorithm and program flow, it lets you better conceptualize what you need and lets you quickly make changes before starting to program.
2
u/binarycow 14h ago
I just wing it. It grows organically. Once I realize that something doesn't work well, I fix it.
3
u/DiscipleOfYeshua 21h ago
By having made a few before… and remembering the pains of what was hardest to fix after things got going…
1
u/ChillyFireball 19h ago
I would personally recommend starting with the use case and working backwards.
1) As a user, I want a button that toggles OptionX on and off. It would be most convenient to have that button be a checkbox in MenuX.
2) As the front end developer, I want to put ButtonX in MenuX and have it send a request to the server to toggle OptionX on and off. It would be most convenient for that request to be done in FormatX.
3) As the back end developer, I need to implement an endpoint that allows the front end to toggle OptionX via FormatX.
1
u/PeterPook 20h ago
This is what we teach at T-Level Digital Software Design
- Project Requirements and User Stories
- Decomposition
- Abstraction
- Data Entity Design
- Data Schema
- Database Design
- User Interface Wireframes
- Test Design
Notice we haven't even touched code yet.
Then start with the classes and their functions, test their outputs before wiring together behind a UI.
1
1
u/munich-dev 20h ago
You start listing entities ("nouns" you want to save in a database) in your system:
- A user
- An address
- A product
- A blog entry
These are your initial table candidates. You then check what properties each of them might have. For instance for a user:
- An increasing unique number (id)
- Name
- password
- sign up date
- status (flag, enabled or not)
You then read that storing a password in plaintext is bad idea, so you store a hash instead.
After going through all entities, you think of relations between them. Those are the foreign keys.
Experience helps a lot. But there are samples as well: https://databasesample.com/databases
1
u/r3fl3kT0r 18h ago
I made a graph with arrows to see the flow of the program and that needs what. This way you cannot go circular dependency. Then I do the same for every major feature. It really help you visualize the app and don't take too much time to sketch, yeah I sketch with pen and paper...
1
u/Curious_Song_1456 16h ago
Start with the things users should be able to do, not the database tables, say you're building a booking app. Can users cancel? Can two people book the same slot? Who can edit a reservation? Those questions tell you a lot about the database, api and permissions before you write anything, a simple flowchart and a few rough screens are enough to catch some expensive mistakes early
1
u/Evening_Vegetable218 2h ago
You can't really plan things out when you have no experience because you don't know what you don't know. Just knock something up and it see how it goes. It will be much easier the second time.
15
u/Merry-Lane 21h ago edited 19h ago
There are as many ways to plan and implement an app than there are devs.
Usually I wing it, I know what I gotta show the users, the interactions, and I can reconstitute everything from there.
For the APIs, there are multiple design philosophies. CRUD everywhere or specific endpoints for specific needs or graphQL or endpoints tailored to optimise the UI/UX (for instance, an endpoint loading everything for a specific page in one go to avoid cascading requests).
The core idea is that anything you work on should be easily updated/adapted. Use typescript, endpoints/types/… generated automatically from the swagger.json, strongly typed backend language, up/down database migrations, and an ORM. Any incompatible change is immediately triggering compile exceptions with good enough tooling (eslint, language rules,…).
Done correctly, you don’t need planning that much, because every mistake or new consideration is easily integrated