This document outlines the requirements for the backend development of a website that includes user authentication and hosting of static and dynamic content. The goal is to create a scalable, cost-effective solution in GCP that supports user-specific content and general content accessible to all users.
Requirements
1. User Authentication
Allow users to log in via Google or Facebook.
Use third-party authentication services (OAuth2) to handle user login (no other login method is necessary)
Store user information upon successful login:
displayName (derived from login info)
decks_owned (initialized as an empty list)
Include an example of a simple js button which would initiate a popup to login the user with their Google account.
2. Data Hosting and Manipulation
Host the following data types:
users: User profile information.
decks: Information about available products.
requests: User-generated requests for new content or features.
{
"id": "string",
"solved": "boolean",
"text": "string",
"upvotes": "integer",
"upvoters": ["string"] // string is the ID of the person who upvoted
}
Data Manipulation:
Include documentation for how to access and update requests, users, and decks
3. Hosting Non-changeable Files
Host static files accessible to all users, there are three different versions of these files per product (one per module).
related_terms.json
related_terms_data.json
questions.json
incorrect_response_api.json
correct_response_api.json
4. User-Specific Files
Host user-specific terms.json files for each module. Each product has 3 modules.
learn/terms.json
understand/terms.json
apply/terms.json
5. Existing Backend for modules
The example product page is currently separated into 3 modules where each module has its own directory. Within each directory is a terms.json, related_terms.json, etc. but also an openai_integration.py file which sets up a flask server to interact with an external API and serve the data within the directory. The openai_integration.py file will need to be modified to be scalable to multiple users. This is an open topic of discussion.
5. Data requirements per page breakdown
Front Page:
Same for all users.
Needs access to isLoggedIn Boolean to render the top bar differently.
Bounty Page:
Shows the list of requests, same for all users.
Marketplace Page:
Displays available decks that can be purchased.
My Decks Page:
Shows only the decks purchased by the logged-in user. Requires access to term.json files from those products
Product/Home Page:
Same for all users except for progress bars.
Progress bars need access to the user-specific terms.json for each module.
Product/Learn Page:
Requires terms.json (unique to the user).
Requires related_terms.json, related_terms_data.json, questions.json, incorrect_response_api.json, correct_response_api.json (same for all users).
Product/Understand Page:
Same requirements as the Learn Page.
Product/Apply Page:
Same requirements as the Learn Page.
Implementation Details
Authentication
Use Firebase Authentication for handling Google and Facebook logins.
Store user information in a NoSQL database (e.g., Firestore).
Scalability and Cost
Leverage serverless architecture to minimize costs and maximize scalability.
Summary
This backend system will support user authentication, data manipulation, and the hosting of both static and dynamic content. The solution will be scalable, cost-effective, and ensure that user-specific content is correctly managed and accessible. The system will cater to various pages, ensuring that data requirements are met per the outlined specifications. Documentation on how to access the backend using the most basic possible js code is greatly appreciated. For example, to add a user suppose we need a json and a GCP function. In that case the example code in the documentation could be as simple as:
Backend Requirements Document
Overview
This document outlines the requirements for the backend development of a website that includes user authentication and hosting of static and dynamic content. The goal is to create a scalable, cost-effective solution in GCP that supports user-specific content and general content accessible to all users.
Requirements
1. User Authentication
displayName
(derived from login info)decks_owned
(initialized as an empty list)2. Data Hosting and Manipulation
Host the following data types:
users
: User profile information.decks
: Information about available products.requests
: User-generated requests for new content or features.Schema Definitions:
Data Manipulation:
3. Hosting Non-changeable Files
related_terms.json
related_terms_data.json
questions.json
incorrect_response_api.json
correct_response_api.json
4. User-Specific Files
terms.json
files for each module. Each product has 3 modules.learn/terms.json
understand/terms.json
apply/terms.json
5. Existing Backend for modules
5. Data requirements per page breakdown
Front Page:
isLoggedIn
Boolean to render the top bar differently.Bounty Page:
Marketplace Page:
My Decks Page:
Product/Home Page:
terms.json
for each module.Product/Learn Page:
terms.json
(unique to the user).related_terms.json
,related_terms_data.json
,questions.json
,incorrect_response_api.json
,correct_response_api.json
(same for all users).Product/Understand Page:
Product/Apply Page:
Implementation Details
Authentication
Scalability and Cost
Summary
This backend system will support user authentication, data manipulation, and the hosting of both static and dynamic content. The solution will be scalable, cost-effective, and ensure that user-specific content is correctly managed and accessible. The system will cater to various pages, ensuring that data requirements are met per the outlined specifications. Documentation on how to access the backend using the most basic possible js code is greatly appreciated. For example, to add a user suppose we need a json and a GCP function. In that case the example code in the documentation could be as simple as:
Miscellaneous
Testing
Once this requirements doc is agreed upon @sammybigbux will begin writing a test suite immediately to verify the efficacy of the backend.
Wireframe
Link to wireframe