Skip to content

Latest commit

 

History

History
27 lines (14 loc) · 2.23 KB

technology.md

File metadata and controls

27 lines (14 loc) · 2.23 KB

Technology

Our project is split up in two main folders; frontend and backend. The frontend is a Vite-React-Typescript based project, while the backend is a Node-Typescript based.

Frontend

The frontend utilizes the @apollo/client package to easily create graphql queries and mutations to send to the backend.

Our graphql queries can be found in mutations.ts and queries.ts.

State management for storing the currently fetched products and all filters and sorting options on the explore pages is handled using redux. This way we save the needed states between pages.

We chose to use Amazon Web Services S3 to store images, as to not store them in our own database, which would take up a lot of memory on the virtual machine. We used AWS's npm packages @aws-sdk/client-s3 and aws-sdk to easily create and delete images from the S3 bucket.

The listing page implements the react-hook-form package to cleanly store the states of the listing fields to avoid having to create a large amount of useStates custom state update functions. This makes the code more readable and easier to handle the logic for creating a new listing.

We also implemented the react-toastify package to give the user useful feedback when deleting a product or when deleting the user.

Backend

The backend is built using apollo-server together with the @neo4j/graphql package to create short and readable server code, and a seamless integration between the neo4j database and the graphql schema.

The backend also utilizes a few graphql packages like @graphql-tools/load-files, @graphql-tools/merge to load and merge the graphql schemas into one schema which is used by the server.

Database

The project uses an instance of the graph database Neo4j to store all relevant data like users and products, as well as to easily fetch and create the relations between the database nodes. Since we have a lot of data which have important relationships to other nodes, using neo4j allowed us to efficiently query the needed nodes, as well as their related nodes. Examples of this are the relationship between a user and their products, and the relationships between a chat and its messages, product, seller, and buyer.