KAHIBARO
Discord Login Register

32.1. Planning the Application

Defining the Problem Before Writing Code

Before you open your editor or create a Git repository, you need to know exactly what you are building and why. Planning your final project as if it is a real-world product will guide your technical choices later in the course and reduce expensive refactors.

In this chapter you will not design the database, API, or deployment. You will focus on the problem space and the shape of the application at a high level. Think of this as writing the “product brief” for your backend.


Clarifying the Purpose of the Application

Every good backend exists to solve a concrete problem for real users. Start by answering three questions in plain language.

1. Who are the users?

List the main kinds of people or systems that will use your application. These are your “personas.” For each, describe their goals, not their technical details.

Example for a project management backend:

You might also have machine users, such as:

Keep this list short. Two to four personas is usually enough for a focused final project.

2. What problem are you solving?

Write a short paragraph that describes the problem in everyday language.

Example:

Small teams use chat and spreadsheets to manage tasks. Work gets lost, people forget deadlines, and no one has a clear picture of progress. We want a simple backend that stores projects, tasks, and comments, and exposes a clean REST API that any frontend can use.

Avoid any mention of specific technologies at this stage. You are describing what you solve, not how.

3. What is in scope and out of scope?

Define the borders of your project. Many projects fail because they try to do too much.

Create two lists:

In scope (MVP):

Out of scope (can be future work):

Clearly defining what you will NOT build is as important as defining what you will build. It keeps your project realistic and finishable.


Defining Core Features and Use Cases

Once you know the problem and users, move to concrete actions. A use case describes how a user interacts with your system to achieve a goal.

Identifying Core Features

Your core features should map to your problem statement. For a typical backend-heavy application, you might have features like:

Pick a small set that represents real value. For example, for an e-commerce style backend:

FeatureDescription
Product catalogStore and retrieve product details
Shopping cartAdd, update, and remove items from a cart
OrdersPlace orders and track their status
User accountsRegister, login, manage profile
Basic admin operationsCreate or update products, view user orders

Writing Use Cases

A simple template:

As a <type of user>, I want to <do something> so that <achieve a goal>.

Examples:

Make a short list of the most important use cases. You will translate these into endpoints, database tables, background jobs, and so on in later chapters.

Grouping Use Cases into Modules

Group related use cases into logical modules. This will later influence your backend architecture and project structure.

Example grouping:

ModuleRelated Use Cases
AuthRegister, login, logout, reset password
UsersView and update profile, change email, list users (admin)
ProjectsCreate project, list projects, archive project
TasksCreate task, assign task, change status, list tasks
CommentsAdd comment, list comments on a task

These modules will often become Python packages, FastAPI routers, and database schemas.


Non-Functional Requirements

Non-functional requirements describe how well your system should work, not what it does. They strongly influence your backend design and your production setup.

Performance

Decide on reasonable performance expectations. For a learning project you do not need extreme scalability, but you should still define realistic targets:

These numbers do not have to be perfect. Their main role is to guide decisions like caching, indexing, and background jobs.

Reliability and Availability

Define how important uptime is and what failure looks like.

Example for a student project:

Later, in the “Production Backend Engineering” and “Deployment” chapters, these expectations will influence your choice of backup strategy and rollout method.

Security and Compliance

You will deal with authentication, authorization, and basic web security. For planning the application, decide:

For your final project, avoid real payment data and highly sensitive personal data. Focus instead on implementing secure patterns for common data such as usernames, email addresses, and internal domain data.


Mapping Users to Responsibilities

Once you have personas and modules, sketch who can do what. This is not yet a full authorization system, but a simple matrix of responsibilities.

ActionRegular UserManagerAdmin
Register accountYesYesNo
Login / LogoutYesYesYes
Create taskYesYesNo
Assign task to another userNoYesYes
View own tasksYesYesYes
View team tasksNoYesYes
View all usersNoNoYes
Deactivate a userNoNoYes

Later, this matrix will feed directly into your authorization rules and tests.


Planning the Project Phases

Your final backend will be built in stages. Planning these stages early makes your work more manageable and easier to debug.

A simple phase breakdown:

  1. Phase 1, Core domain and authentication
    • Define core entities conceptually (no schema details yet).
    • Implement user registration and login with basic validation.
    • Implement simple CRUD for the main resource, for example tasks, products, or orders.
  2. Phase 2, Validation and authorization
    • Add stricter input validation.
    • Enforce ownership rules, for example users can access only their own resources.
    • Add simple role-based access, for example admin endpoints.
  3. Phase 3, Background work and integrations
    • Add background jobs, for example sending emails or cleaning up old data.
    • Integrate Redis if needed.
    • Add file storage integration if your project uses uploads.
  4. Phase 4, Production hardening
    • Add logging and monitoring endpoints such as health checks.
    • Improve error handling and error responses.
    • Prepare configuration for multiple environments.

You do not need to implement all phases at once. For now, it is enough to decide a rough order so that you do not overcomplicate the first iteration.


Writing a Short Project Specification

Bring everything together in a short written spec, one to two pages. This is your reference document for the rest of the final project.

A simple structure:

  1. Overview
    • One paragraph problem statement.
    • One paragraph summary of the solution.
  2. Users
    • List of personas with their goals.
  3. Scope
    • In-scope features for the final project.
    • Out-of-scope features that you explicitly will not build.
  4. Core Features and Use Cases
    • Short list of modules.
    • Key use cases in “As a … I want to … so that …” format.
  5. Non-Functional Requirements
    • Performance targets.
    • Availability expectations.
    • Security considerations, at a high level.
  6. Phases
    • A simple step-by-step plan of what you will implement first, second, and so on.

Do not skip writing this specification. A few hours of clear planning can save you many days of confused coding and refactoring.

Keep this document in your repository, for example as docs/specification.md. Update it only when the product changes, not for every technical detail.


How This Planning Connects to Later Chapters

The work you do here will drive specific technical decisions in the coming chapters:

By taking planning seriously now, you give yourself a clear target for the rest of the final project and practice how real backend engineers structure their work before they start writing code.

Views: 7

Comments

Please login to add a comment.

Don't have an account? Register now!