Git Product home page Git Product logo

kenttrann2302 / studyhub-backend Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.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%
aws-dynamodb aws-lambda aws-ses docker flask postgresql-database python server sqlalchemy-orm

studyhub-backend's Issues

Dockerize development environment

What's the purpose of this issue?

We have 6 developers contributing to StudyHub at the moment, with 6 different machines with variety of dependencies installed, different OS, ... To ensure we do not run into any problems related to setting up development environment, we need to containerize our backend to avoid "but this works and runs on my machine". See this article: https://devopswithdocker.com/part-2/section-4

Containerization of development environment also allows us to mirror production as much as possible to avoid unexpected issue showing up when deploying, despite everything working well during development. We will use Docker for containerization, everyone would needs to install Docker desktop on their machine.

Side Note

You must use the requirements.old.txt file, bad name I know but the current requirements.txt has too much unused libraries in there that will make the Docker image heavier than needed. If requirements.old.txt does not contain all requirements needed, then I shall pray to GPT the Revered God

You must always run Flask related command in the container, you can use Docker Desktop for this, or use docker compose (how to do this can be easily found by Google)

Instructions can be found in the useful resources below

Code Complete

  • I can start the development environment with just one command, something like: docker compose up -d --build -f docker-compose.dev.yaml
    • The Flask server as well as development database should be setup

Checklist

  • Create Docker image for Flask server
  • Create docker-compose.dev.yaml file in the root of the repository to manages the 2 containers (Flask server and dev db)
  • Non-blocking: Add debugger for debugging the containerized Flask server

Related Issues

  • #17 can be done later

Useful resources

https://www.freecodecamp.org/news/how-to-dockerize-a-flask-app/

https://medium.com/@lassebenninga/how-to-debug-flask-running-in-docker-compose-in-vs-code-ef37f0f516ee

Registration Database

Need to finish the registration form and database with authentication for users to create an account at ScholarSavings

Streamline development environment

What's the purpose of this issue?

Right now, we need to run two instances of Flask to handle registration flow, and CRUD operations for UserProfile. This is fine if we're building microservices, but there's no reason for them to be microservices when they are this small. To ensure a smoother development process, we will need to unify the two separate apps into one instance of Flask. We will also need to have a way to ensure the database is initialized right when we run the command to start the application.

Code Complete Criteria

  • I can start the development environment with just one command
    • It should initializes the database
    • It should allows me to go through the login flow and perform CRUD operations for UserProfile without having to run another command to start another instance of Flask
    • It should automatically restart the server whenever there's a code change (similar to how nodemon restarts Node.js server whenever a code change)

Related issues

This issue is blocked by #18. We need that issue to be completed first before we start on this issue

Configure migration script for db running in the docker container

The problem I'm facing right now is when I delete a specific user from the Users table, the information of the other relational tables were still kept and hence, it violates the constraints of non-null user id. Therefore, I made some changes in the SQLAlchemy model to set all the others tables to ondelete='CASCADE' so it will also be deleted when the user id is deleted. However, I need some help on running migration script in the dockerize environment.

Restructure files and directories

What's the purpose of this issue?

Our backend directory structure is a bit disorganized right now. We want to have a proper structure so that adding new features and/or changing existing one can be done smoothly. We also want to have a convention so developers familiar with other technologies such as Django and Express can quickly navigate through the codebase and know where to put new code.

Ideally we'd utilize the Blueprint structure here: https://github.com/app-generator/tutorial-flask/blob/main/flask-project-structure.md, but the other structure in there works as well.

Lastly, we need to have proper structure for this issue: #17. It'd be much easier to setup configuration and necessary initialization with properly structured files and directories

Code Complete

  • Codebase structure is organized
  • Existing functionalities must not break! Ensure imports are updated correctly

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.