At work, I just start working on the backend development of a new application, which is basically a Management Information System (MIS) for a globally known Organisation.
The first thing I do is begin reading the Software Specifications and Requirements document to have a basic idea of what is needed.
In modern backend APIs, the basic requirements usually are:
- token based authentication
- CRUD of models such as products
- authorisation or role management depending on admin or regular user
From the UI document, the screen prototypes gives an idea of what type of data is needed for the application. Their purposes are also described in the specification document.
To begin with a first draft, I create a new spreadsheet and write down tables names and their respective columns I can deduce from the UI screens. At this stage, I don't try to optimise the tables to 3NF (third normalisation form) because I don't know all the models yet - plus the database schema will most probably change. For instance, I prefer keeping columns such as country a varchar.
Once done, I write down a SQL script to setup the database structure. I then send the spreadsheet and the script to the Technical Lead and/or Project Manager for validation.
An interesting online tool for drawing Entity-Relationship Diagrams (ERD) is Db Diagram. A colleague used it to improve the SQL structure I initially worked on. This tool helps visualise the relationship between different models.
In addition, among the features available, you can transform your diagrams into SQL statements and integrate directly in your databases. This tool can also generate schema.rb or models.py file for Web Frameworks such as Rails or Django.
Existing Libraries & Frameworks
Before coding any feature from scratch, other senior developers and myself communicate on how we can integrate the company's existing libraries and frameworks into the new project.
Several features have already been implemented such as session management and payment modules. We therefore need to gradually include them.
Waiting for the team to validate or give feedback on the database structure, I start adding APIs on postman, such as:
- User Management
- CSV File Imports
These are features that are needed by most CRUD types of application.
Once done, I try looking at the company's previous projects and scaffold the services, that is, write down functions that are going to be used for the APIs, such as List of Users. At this point, I only write down the function names and return true as requirements will most likely change.
Meanwhile, the other full stack developers are developing the front end part, which is easier to validate with the user.