1.
Database Imagination / Structure
a. First figure out all the entities of the app database
b. Then write attributes of each entity.
Note: As we are working in NoSQL Environment (Firebase or other like it),
we don't need to define relations but if we are working with sql (Supabase etc), we
will need to define relations accordingly.
2. Database Optimisation:
1. Salon/Barber Shop
a) id > String (Unique)
b) name > String
c) location > Location
e) about > String
g) discount > int
h) rankTag > Function (Based on Rating + Services Sold)
i) teamMembersName > List<String>
j) rating > Function(field: Calculated from reviewsIds)
k) reviewsIds > List<String>
l) mainImage > String(Link)
m) helperImages > String<Links>
f) sevicesList > List<Services>
q) bookingIds > List<String>
o) workingTimeDetailList > arr<WorkingDetail>[7]
p) memberSince > Long
Location:
b) nameCity > String
b) nameStreet > String
c) latitude > double
d) longitude > double
Service:
b) name > String
c) price > int
d) duration > Long
e) genderSpecific : String
f) image : int/String
Working Detail:
a) id > String
b) dayName > enums
c) startTime > List<Long>
d) endTime > List<Long>
2. Customer:
a) id > String (Unique)
b) name > String
c) gender > String
d) email > String
e) phoneNumber > String
f) profileImage > String
g) reviewsIds > List<String>
h) bookingIds > List <String>
Review
a) id > String (unique)
b) rating > float
c) comment > String
d) dateTime > Long
f) likes > Long
g) dislikes > Long
h) customerId > String
i) salonId > String
3. Booking:
a) id > String
b) userId > String
c) salonId > String
d) price > int (Calculated and stored at the time of ordering)
e) dateTime > Long
g) servicesList > List<Service>
h) statusFlag > boolean (iscompleted , iscancelled)
3. Cost / payment Calculations (Average Case)
Let us consider that an X app has 10M downloads then its users might be
0.1Million (100,000).
Monthly active users might be (10K-100K)
Daily active users might be (0-3K) avg = 1000
Average booked services fee/price = Rs.150
Dialy Revenue : 150 x 1000 = Rs.150,000
Monthly Revenue : 150000 x 30 = Rs.4,500,000
Now Start Cutting the Costs:
BookNStyle tax/fee : 10% / service
Remaining Revenue1 = Total Revenue * BookNStyle Fee
= Rs.450,000
Transaction amount as the automated fee for transactional service handlers
(just say bank) = 0.2%
Remaining Revenue2 = Remaining Revenue1 - Remaining Revenue1 * 0.2%
= 450000 - 900
= Rs.449,100
Now cut your 40% tax
Remaining Revenue3 = Remaining Revenue2 - Remaining Revenue2 * 40%
= Rs.269,460
Firebase database calling requests cost:
Daily active users might be (0-3K) avg = 1000
Daily active users requests avg = 100
Average daily reads = 1000 * 100 = 100,000
Cost per 100,000 reads = Rs.17 ($0.06 for fireStore)
Monthly Read Cost = 17 x 30 = Rs.510
Remaining Revenue4 = Remaining Revenue3 - Firebase Cost
= 269,460 - 510
= Rs.268,950