sammybigbux / TechDocs

A place to keep files pertaining to projects
0 stars 0 forks source link

Frontend Redesign #2

Open sammybigbux opened 2 hours ago

sammybigbux commented 2 hours ago

DeckHub Frontend Development Guide

Welcome to the DeckHub project! This project is an interactive platform designed to help students prepare for certification exams using modern cognitive research techniques. DeckHub offers multiple-choice and open-ended question formats, with real-time feedback to guide learners through exam content.

Issue Overview

DeckHub is undergoing a UI redesign to improve user experience. Your task as the frontend developer is to implement the new UI based on the wireframe provided in Figma and apply it to the existing platform.

Key Resources:

You can test your changes by either running the project locally (setup instructions are provided later in this document) or by pushing to the staging branch to deploy the updates to our cloud environment.

The following sections will guide you through the project structure and the steps required to set up and deploy the project.

Local Setup

Secure files from Google Drive are required to host this locally but if you push to staging branch the Github Actions will deploy to Google Cloud.

  1. Install dependencies:

     npm install
  2. Set up a .env file in the main directory:

     LOCAL=True
     OPEN_API_KEY=(your OpenAI key)
  3. Set up a .env file in the backend directory:

     STRIPE_SECRET_KEY=(your Stripe secret key)
     WEBHOOK_SECRET=(your webhook secret)
  4. Navigate to the backend directory and install Python requirements:

     pip install -r requirements.txt
  5. Place the firebase_key.json file into the backend directory:

    • This is a secret file located in the Google Drive and needs to be requested from the project owner.
  6. Create an OpenAI assistant and update the assistant ID:

    • Visit OpenAI Playground, create an AI assistant, and use the prompt provided in the Google Drive.
    • Update the assistant_id at the top of the app.py file to the assistant you created. You will need to replace the current assistant ID with the one generated from the assistant you're using:
      assistant_id = "asst_your_new_assistant_id"
  7. Run the backend:

    • From the /src/backend directory, start the backend server:
      python app.py
  8. Run the frontend:

    • Go back to the main directory, and start the development server:
      npm run dev

Project Structure

You can find a guide to each section in the README.md files in their respective directories. The project consists of the following main components:

Front end overview

The frontend of the platform is built using Svelte with TypeScript and utilizes Svelte stores for state management, Firebase for authentication (userId, isLoggedIn), and Skeleton UI for components like Avatars and ProgressBars. It interacts with a backend hosted on either localhost or a cloud server (base_url).

Key Pages and Functionality

1. My-Cards Page (my-cards.svelte)

2. Search Page (search.svelte)

3. User-Info Page (user-info.svelte)

4. Chat Pages (Learn, Understand, Apply)

The chat pages (e.g., learn-multiple, learn-open, understand-multiple, apply-multiple) are built on similar structures with differences based on the mode (multiple choice or open-ended).

Learn-Multiple Page (learn-multiple.svelte)

Learn-Open Page (learn-open.svelte)

General Components

Across all pages, common components include:

Firebase Integration

Svelte Lifecycle Hooks

Conclusion

The frontend of the platform is a combination of Svelte’s reactivity, store management, Firebase authentication, and backend interactions. Each page is structured around a core set of stores (decks, userDecks, messageFeed) and functions (retrieveQuestion, sendMessage, updateStatus) that ensure a dynamic and interactive learning experience for users. The UI is cleanly structured with Skeleton UI components to enhance visual consistency across the platform.

Backend Structure Overview

The backend primarily consists of:

Application Workflow

app.py

The app.py file defines the main Flask application that handles various endpoints. It handles:

Key components include:

  1. Firebase Setup:

    • Firebase Admin SDK is initialized with either local or cloud credentials (depending on environment).
    • Firestore is used for storing user data, while Cloud Storage is used to store and retrieve the terms.json files for each user.
  2. Data Loading:

    • The backend loads static data from learn_data.json, understand_data.json, and apply_data.json from the static_data directory. These are used in various term-based operations.
  3. User and Term Management:

    • The backend relies heavily on UserManager and TermManager for managing user sessions and interacting with terms.json.
    • UserManager handles downloading/uploading the user’s terms.json from/to Cloud Storage and initializing sessions.
    • TermManager handles loading the user's terms data, providing questions, and updating the status of terms.

Helper Classes

UserManager

TermManager

Firebase Initialization Files

firebase_admin_init_cloud.py

firebase_admin_init_local.py

GitHub Actions CI/CD System Summary

The project uses GitHub Actions to automate the deployment of both the backend and frontend. Separate workflows handle deployments to the production and staging environments for both the backend and frontend.


1. Backend Deployment to Production (deployment-production-backend.yml)

2. Frontend Deployment to Production (deployment-production-frontend.yml)


3. Backend Deployment to Staging (deploy-staging-backend.yml)

4. Frontend Deployment to Staging (deploy-staging-frontend.yml)


ffshreyansh commented 2 hours ago

Hi @sammybigbux

Shreyansh this side, Can you please provide access to the Figma. Would love to have a quick meeting with you over the Ui revamp plan.

I have mostly worked with NextJs(React) & TailwindCSS. This is an ideal project for me as per my expertise. Let's collaborate.

ffshreyansh commented 1 hour ago

@sammybigbux saw your google drive's video, If the Ui shown in the video is the expected output I will convert the UI into pixel perfect frontend, ensuring responsiveness in layout across all devices. With expected frontend functionality with clean code.

Let me know if we can connect!

Best Regards Shreyansh www.shreyanshkr.com www.tellcrow.com