Chapters of From Frontend to Full-Stack Backend

Week 4 - Capstone + NestJS + System Design + DrillChapter 23 of 282 min read

Capstone part 1 - auth, roles and core CRUD

Building the foundation in the learned pattern, reusing old code, finishing the main journey

Today's good news is - almost nothing new has to be learned. Auth was built in week 1, validation is known, structure is known. Today's job is building the capstone's foundation in that familiar pattern: auth, roles and the main (core) CRUDs. In exactly the same sequence as you built the earlier project.

The order of work

  • Set up the project structure - routes, controllers, services, middlewares
  • Set up the database - Prisma schema, migration, remembering week 2's index judgement
  • Set up auth - signup, login, refresh rotation, logout (bringing week 1's code and adapting it is the smart move)
  • Separate admin and normal user paths with role middleware
  • CRUDs of the main resources - with validation, in the same response format

Be aware of one thing: bringing code from an old project is not something to be ashamed of, it is professional behavior. In a real job too, nobody writes auth from zero every time. But do not paste it blindly - adapt it to this project's roles and fields, and whatever part you want to do differently this time (like naming or error format), change it deliberately.

The end-of-day check: can the main journey be walked by hand? Sign up as a new user, log in, do the main job (placing an order / applying to a job / sending a message) and see. If it gets stuck somewhere in the middle, that is today's real bug - fix it before tomorrow's complex features.

The mistake everyone makes

Jumping into complex features without finishing the foundation. If you try to put cache on top of a hole in auth, in the end both stay half-done. The rule: until the main journey runs fully, you cannot move to the next step.

Today's practice

Finish the capstone's foundation - auth, roles, core CRUD, with validation. At the end, run the main journey once from start to finish by hand, noticing whether anything has to be done manually anywhere.

How to say it in an interview

Test yourself: 'In the capstone I moved forward in a familiar, tested pattern - the same structure, the same auth flow, the same validation layer. I kept novelty only in the project's own problems - I did not reinvent the foundation wheel.'

All chapters of From Frontend to Full-Stack Backend