Git Product home page Git Product logo

kenttrann2302 / studyhub-backend Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 5.99 MB

This repo is for StudyHub (a full-stack web app that helps student to find the study group that fits their needs!) server development. This involves of all streaming APIs that help building and maintaining the application's server!

Python 99.17% HTML 0.42% Mako 0.19% Dockerfile 0.23%
flask aws-lambda aws-dynamodb aws-ses postgresql-database sqlalchemy-orm docker python server

studyhub-backend's Introduction

StudyHub-Backend

Table of Contents

Overview

StudyHub is an online tool that facilitates the development of efficient and productive study groups. It strives to bring together students who have similar study preferences, courses, and locations in order to improve collaborative learning experiences.

Built With

Architecture

  • Below is the snippet of the UML Diagram of our server:
Screenshot 2023-05-16 at 10 09 30 PM

Features

  • User Registration and Authentication: StudyHub provides a user-friendly registration process and secure authentication mechanism, allowing users to create accounts and access the platform securely:
Screenshot 2023-05-15 at 10 58 04 PM
  • User Profiles and Preferences: Users can create personalized profiles, including study preferences, courses, and availability schedules. This information is used to match users with compatible study groups:
Screenshot 2023-05-15 at 11 03 18 PM
  • Study Group Matching Algorithm: StudyHub employs a neural network-based matching algorithm that analyzes user preferences and behavior to suggest the most suitable study groups. This algorithm ensures optimal group formations based on compatibility factors.

  • Google OAuth 2.0 Integration: StudyHub integrates with Google OAuth 2.0 for seamless user authentication, enabling users to sign in using their Google accounts:

Screenshot 2023-05-15 at 11 04 29 PM
  • Email Verification: To ensure the authenticity of user accounts, StudyHub incorporates email verification functionality. Users receive email notifications to verify their email addresses during the registration process, this is done by using AWS SES and Twilio SendGrid:
Screenshot 2023-05-15 at 11 07 29 PM Screenshot 2023-05-15 at 11 07 06 PM
  • API Security: StudyHub implements API security best practices, including JWT tokens and bcrypt hashing, to protect sensitive user data and ensure secure communication between the client and server.

  • Docker Containerization: The application is containerized using Docker, providing an isolated and portable environment for seamless deployment and scalability:

Screenshot 2023-05-15 at 11 09 38 PM
  • AWS and GCP Integrations: StudyHub integrates with AWS services such as DynamoDB, Lambda, and SES for email delivery, along with GCP Geolocation API for address verification:
Screenshot 2023-05-15 at 11 12 53 PM
  • Unit Testing: The codebase includes comprehensive unit tests for the REST APIs, ensuring functionality, reliability, and maintainability.

For development purpose:

Note: If you're using Windows, please clone this repo in WSL and run the docker commands in there.

To clone and run this application you'll need:

Then on your terminal, run the following from the root of this repository:

# Build the images and containers then run the containers
docker compose up -d --build

In order to test the APIs of each endpoint at http://0.0.0.0:8080/, use Postman collections.

To stop the containers and to start the containers after the initial build:

# For stopping and removing the containers created above
# Use the -v flag to remove the associated volumes
docker compose down

# For creating and starting the container
# after the initial build
docker compose up -d

Good-to-Know Commands

Run command in a container

To run shell command in any of the two containers:

docker compose exec <service-name> <command> <list-of-args>

# Example: Running SQL commands in the container
PGPASSWORD=<password> psql -U <username> <database>

# Example: Make backend migrations with Flask Migrations
docker compose exec backend flask db init
docker compose exec backend flask db migrate -m <migration-message>
docker compose exec backend flask db upgrade

We recommend creating alias(es) to shorten the above commands

Common Issues

Database is not up to date after running migration scripts

# By running this command, the database will be up to date with the latest migration
docker compose exec backend flask db stamp head

Import "{framework/library-name}" could not be resolved error from Pylance

If you're using VSCode and see this error. This mean the framework/library was not installed globally or installed in the virtual environment you're using. We highly recommend setting up a new virtual environment. So remove your existing environment in the root of this repository. Then run the following commands

# Ensure you are in the root of this repository
python3 -m venv env # Our gitignore assumes the virtual environment name is env
source env/bin/activate
pip install -r backend/requirements.txt

Then select the interpreter in env/bin/. The issue should disappears.

Note: We assumed you're using MacOS or Linux. For Windows, please find the corresponding command for setting up Python virtual environment.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.