Feedback on the structure of a simple sql database

I’m writing a simple personal project where the goal is to let users create their own nutritional tables (what you plan to eat in a day with a recap of the macro/calories).
The underline database should be relatively simple but as a newbie I’ll like some feedback on a certain aspect.

I plan to have these two main tables:

  • “users”, where I save the data provided during sign in
  • “diet plans”, where I save a name and description (user input) and a reference to the user ID which said plan belongs to

Now, what are the elements of each diet plan? I plan to fetch data with an api based on the element requested by the user. For example, if they want to add a banana I’ll provide choices from which to select a definitive product, based on the results of the api so that users don’t have to input the macro by themselfs.
That’s not all tho, because I want to let users create their own “meals”. For example, if they want to eat a slice of ownmade cake, it makes sense that they first have to create said meal by specifying its ingredients (fetched again through the api)…

To recap, the “diet plans” entries can either be a simple ingredient fetched through the api, or a combination of these that must be already saved in the database through a dedicated form.

My doubts regards how and what to save in regards to the ingredients and relative macros.

For sure there must by a table “recepies”, where I at least provide an ID, name and description, and a reference to the creator/user

What to do for everything regarding the single ingredients tho? The simplest solution would be to not store any hard data but only their unique reference for direct retrieval from the api everytime they’re needed.
In this scenario I’ll have to add two additional tables to the database (so 5 in total):

  • “diet elements” where as columns I would have a reference to the diet, the identifier for the api, the reference id for the corresponding recipe, maybe other generic data like portions/grams and specific meal they belong to (dinner, breakfast etc..). The catch is that every row would either have the api id or the recipe reference blank.
  • “recipe elements” which would be very simple because I’ll only need the api id for said element, a reference to the meal they are part of, quantity/portions.

Another option is to save somewhere some data regarding the macros without having to fetch, and compute them so many times for basically anything done inside the app/website. For example, “diet elements” could have additional columns where I save the macros of each element, where, remember, the latter is an item from the api or a personal meal created by the users as I already explained.
The catch? Well, if the api changes the macro for an item then the updated values wouldn’t be reflected on the app/website for already existing diet. Granted, I’m not sure how often that happens

Toughts?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật