王品蓁
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # ONLINE MOBILE PHONE STORE by Gucci Gang ## Alternative Access for the code this project * GitHub: * Front-end: [Front-end of this project](https://github.com/Sophiaxiaoyu/Gucci-gang_FE) * Back-end: [Back-end of this project](https://github.com/Sophiaxiaoyu/Gucci-gang_BE) * Glitch: * Front-end: [Front-end of this project]() * Back-end: [Back-end of this project](https://glitch.com/~gucci-gang-be) ## System overview We have developed an online mobile phone store for our project. It is a full-stack e-commerce project built with Postgres, Express.js, React and Node.js. We are selling phones in 2 categories, Android phones and iPhones. A user can select from a list of available products, add items to cart and then place an order by entering delivery and payment details. The system is intended to be used by two types of users: - **Customer:** The customer can sign up to create an account or login to their existing account. They can browse through the products and add them to cart. They can then review the cart, make changes, if any and purchase the desired product by making a payment. A customer can also view the orders they have placed earlier. - **Admin:** The admin’s role is to update the inventor. They can add and remove products on sale and also update the number of available pieces of each product. We have implemented role-based access to allow users access only to the parts they are intended to such as making orders and browsing shopping carts. ## Assumptions - The user has entered correct address and contact details - The user has entered correct payment details. - All changes to the store are made by the admin and not the store. - Salespeople aren’t able to edit products and orders. Only managers have the permissions. ## Database and Relational Schema Figure 1. Database Schema Design Diagram ![](https://i.imgur.com/tVobyLP.png) Note. Specific diagram can be visited through link [Schema link](https://dbdiagram.io/d/6366f199c9abfc61117087ff)![](Aspose.Words.d4b73db1-c129-4283-8cf6-83ea07035aed.001.png) **List of Tables and attributes** 1. **Users:** This table stores information about every user of the platform, both customers and admins. **Attributes:** - **User\_id:** Primary key. Identifies each unique user. - **Username:** Unique id to log into their accounts. - **Password**: Password for account. - **Email** - **Fullname** - **Roles:** Identifies roles as Customer or Admin. - **Address** - **City** - **State** - **Country** - **Created\_at:** Timestamp of when the account was created. - **Business:** Stores the business information of customers. We have made this an enum with categories set to Students, IT and Retail. 1. **Manager:** Information of the regional manager. **Attributes**: - **Manager\_id:** Primary key. - **Name** 1. **Region:** Information about the region in which stores are present. **Attributes:** - **Region\_id:** Primary key - **Name** - **Manager\_id:** Foregign key referring to the regional manager. 1. **Store:** Information about the store selling a product. **Attributes:** - **Store\_id:** Primary key - **Store\_name** - **Region\_id:** Foreign key referring to the region in which the store is present. 1. **Salesperson:** Information of the salesperson who made the sale. **Attributes:** - **Salesperson\_id:** Primary Key - **Name.** - **Store\_id:** Foreign key of the store where the salesperson works 1. **Products:** Information of the product listed on the online store. **Attributes:** - **Product\_id:** Primary Key - **Name** - **Price** - **Description** - **Image\_url** - **Category:** Enum for product category. Our store sells Android and iOS phones. - **Inventory:** Number of pieces of product in inventory. - **Store\_id:** Foreign key referring to the store selling the product. 1. **Reviews:** User review of products **Attributes:** - **Product\_id:** Foreign key referring to the product being reviewed. - **User\_id:** Foreign key of the user who wrote the review. - **Content** - **Rating** - **Date** - **(Product\_id, Use\_id) together act as a Primary key** 1. **Cart:** Stores information about products users added to cart but didn’t purchase yet. **Attributes:** - **Id:** Primary key - **User\_id:** Foreign key of the user who added items to the cart. 1. **Cart\_item:** Products in a cart. **Attributes:** - **Id:** Primary key - **Cart\_id:** Foreign key of the cart. - **Product\_id:** Foreign key of the product in the cart. - **Quantity** 1. **Orders:** Information about a successfully placed order. **Attributes:** - **Order\_id:** Primary key. - **User\_id:** Foreign key of the user who placed the order. - **Status** - **Date** - **Amount** - **Total** - **Payment\_method** 1. **Order\_item:** Products in an order. **Attributes:** - **Id:** Primary Key - **Order\_id:** Foreign key referring to the order. - **Product\_id:** Foreign key of the product ordered. - **Quantity** ## Front-end and connection to Back-end As an e-commerce website, the webpage has to be intuitive and easy to operate with. Hence, we decided to use React, Express.js, related UI frameworks, and libraries to build our website. Windmill can be a useful library for this purpose, since it is light and handy. Meanwhile, we use Tailwind-CSS to do more customization when we find it necessary. Specific Frontend Tech Stack set is: - [React](https://reactjs.org/) - [Windmill React UI](https://windmillui.com/react-ui) - [Tailwind-CSS](https://tailwindcss.com/) - [React-hot-toast](https://react-hot-toast.com/docs) - [React-Spinners](https://www.npmjs.com/package/react-spinners) - [React-helmet-async](https://www.npmjs.com/package/react-helmet-async) ## **Significant Front-end Features:** **API Fetch Interceptor & ErrorHandle** To enhance security, we create an interceptor of all requests, which means the API was created singleton and exposed to global components. ![](https://i.imgur.com/KwVAiW8.png) Token will be added at this time. Hence, no matter what page or what history you have, your login status can not be messed. **RBAC (Role based access control) Model** We integrate all authentication related APIs and create a class as “AuthService”. After verification, the login status will be stored as global context and shared around components. ![](https://i.imgur.com/fYZ56bx.png) useContext of React. States setting exposed through Provider. **Notification Model** To provide a more accurate feedback to users operations, a notification model is utterly necessary. We choose React-hot-toast as our notification model. By importing it at the top level of our page – App.jsx. We can send out notifications easily. ![](https://i.imgur.com/iyY5QsP.png) ## Implementation ### Home page ![](https://i.imgur.com/2hhos0m.png) On the home page, it displays all products that we stored in the database. The page lists out all the products that are selling currently in out store, and all has a button to add the product into the cart. ### User Login / Signup [hashed passwords storage] ![](https://i.imgur.com/c2KJXHI.png) Our user Login/Signup page uses the AuthService model, and also has the function where it detects the user's input for the email. Username must be unique for each user which our system enforces.The passwords of each user is hashed before it is saved in the database for extra security. ![](https://i.imgur.com/seAgzt8.png) In the sign up page, new user's can create a new account. To prevent the user from inputting the unexpected words, we did a double confirm design to make sure the password matches the same, before saving it into our database. ![](https://i.imgur.com/PFPGLY2.png) ![](https://i.imgur.com/xTO5RFx.png) The shopping cart would temporarily store the products that is putted into the cart, and will be cleaned off when users are done with the shopping session. When the user's are done with the shopping session, they can go and click on checkout to pay for the whole order. Checkout and confirmation ![](https://i.imgur.com/xMeeJwq.png) ![](https://i.imgur.com/jO5T475.png) ### Inventory Management page ![](https://i.imgur.com/lcKFuBV.png) Admins can go into this page and update the inventory. Each product has a limited number of pieces in stock. A user can not order more items than present in the inventory. Our system identifies when a user exceeds this limit and notifies them. ### Dashboard For the admin, we have a page that would show the sales of different stores and different areas. ![](https://i.imgur.com/hj9pLp3.png) <a name="_89s6hrvqt4cn"></a><a name="_slwmwjk6f85c"></a><a name="_ouy9dblwf41d"></a><a name="_u9jesjc0roui"></a><a name="_mb6uvvvw1uqe"></a><a name="_egc8ss49psuo"></a>Future improvements Give store managers the ability to update products in their store. Verify user email and number through verification links. Verify payment details using a third party API. Provide search bars to customers. Add category filters to the home page. ## Team member’s contributions #### Anjnesh Sharma(ans458): Responsible for designing and implementing the DB database schema and related functionality. This involved creating the necessary collections and documents, defining the relationships between them, and integrating them with the application's server-side logic. #### Pin-Jen Wang(piw19): Responsible for designing and developing the user interface using HTML, CSS, and JavaScript. Also used frameworks React to build the application components. The webpage is a responsive and accesible website. #### Xiaoyu Xia(xix90): Responsible for developing the shopping cart functionality and implementing the necessary backend logic to support it. Also worked on implementing error handling and ensuring that the application was robust and reliable. #### Xinyu Ran(xir16): Responsible for managing the communication between the front-end and the back-end of the application using Axios. This also involved implementing the necessary APIs and ensuring that they were well-documented and easy to use. ## MVC Structure: - Models: Our models were defined using MySQL to represent our data. And we created 11 tables, which we mentioned brfore. - Views: Our views were built using React framework to create the user interface of our application. - Controllers: Our controllers consisted of the server-side logic for handling HTTP requests and responses. We used Express.js to define our server routes and handlers. Our controllers also made use of the Mongoose models to interact with the database and retrieve or modify data. Finally, we used Axios to handle client-side requests and update our views dynamically. Overall, our application followed the MVC (Model-View-Controller) pattern, where the models were responsible for representing the data, the views were responsible for presenting the data to the user, and the controllers were responsible for handling user requests and updating the models and views accordingly. We used Express.js as our framework to connect these components together and handle the overall flow of the application. ## Advanced Features * We use a `token` to authenticate the user. Only authenticated users can use the relevant features of the site. * We hash `encrypt` the user's password to make it more secure when it is stored in the database. This ensures the security of users throughout the site. * We use `RESTful style API` for building web services that are lightweight, scalable, and easy to maintain. * Admin capabilities:We categorize and manage users' permissions. Ordinary users can only perform some general operations, such as buying products, browsing products, etc. But for the administrator users, they can add, delete, and check the products, and they can also view the data of the whole warehouse and analyze the sales situation of the whole products. * We also validate and handle errors appropriately. For example, when a user logs in, an error in entering a password is indicated accordingly. Or when a user makes a successful payment, the site will also give a "payment successful" message. ## Challenges We encountered some issues with one of the libraries we used for handling authentication. It had some compatibility issues with the version of our Node.js runtime environment. We had to look for an alternative solution that was compatible with our environment. There were also some features we initially wanted to include, such as a search bar for products and wishlists. However, due to time constraints, we were not able to implement these features. Overall, we faced some challenges while developing this application, but we were able to overcome them through teamwork and collaboration. ## Future Work If we had more time, we would like to implement a feature that allows customers to save items to their wishlists. This would make it easier for them to keep track of items they are interested in purchasing and could also be used to generate recommendations for related products. ## Conclusion In terms of web technologies and standards, this course has covered a broad range of topics, including HTML, CSS, JavaScript, jQuery, Node.js, Express, MongoDB, and more. These are all important technologies that are widely used in modern web development, and I believe the course has provided a solid foundation for understanding how these technologies work together to create a web application. However, web development is a constantly evolving field, and there are always new technologies and standards emerging. In future iterations of this course, it might be useful to cover some of the latest technologies and frameworks that are gaining popularity in the industry, such as React, Angular, Vue.js, GraphQL, and more. Additionally, it might be beneficial to dive deeper into specific topics, such as responsive design, web accessibility, security, and performance optimization, as these are all important considerations for building robust and user-friendly web applications. Overall, I believe the course has provided a good introduction to web development technologies and standards, and there is always more to learn as the field continues to evolve.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully