Best Flask open-source libraries and packages

Cs50 project

📁 CS50 project - Flask web application ✔️Rate-limiting middleware ✔️Salted password authentication ✔️Integration tests
Updated 9 months ago

Flashcards

This web application, built on Flask framework, is designed to allow users to create customized study cards. With the ability to create collections and associated study cards, the user can conveniently test their knowledge by accessing the cards without the content at first.

In addition to the core functionality, there is a secure registration and authentication system, and a password-changing option.
The authentication mechanism has been implemented with rate-limiting, salted passwords, and testing to ensure robust security.

The application is backed by a relational database that utilizes SQLite.
On the client side, AJAX has been implemented using the jQuery JavaScript library.

YouTube Demo

Alt text

Getting Started

Clone the repository:

git clone https://github.com/hanit-com/cs50-project.git

Install the required packages:

pip install -r requirements.txt

Running

python3 app.py
flask run

Testing

pytest

Database

Interact with the local DB:

sqlite3 project.db

Alt text

API

All parameters are required

Get the login page

  GET /login

Returns rendered template of "login.html".

Log into the app

  POST /login
Parameter Type
username string
password string

Saves user ID in sesison and redirects to initial page.

Get registration page

  GET /register

Returns rendered template of "register.html".

Register to the system

  POST /register
Parameter Type Description
username string
password string
confirmation string User input for new password confirmation

Redirects to initial page.

Get initial page

  GET /

Returns rendered template of "index.html" if logged in or "login.html" if not.

Getting user collections

  GET /collections

JSON response. Internaly usses the session for user ID, no parameters needed.

Create new collection

  POST /createCollection
Parameter Type Description
name string Name for the new collection.

JSON response.

Delete a collection

  DELETE /deleteCollection
Parameter Type Description
id string Collection ID.

JSON response.

Get collection page

  GET /collection
Parameter Type Description
id string Collection ID.

Returns rendered template of "collection.html".

Get collection cards

  GET /cards
Parameter Type Description
id string Collection ID.

JSON response.

Delete a card

  DELETE /deleteCard
Parameter Type Description
id string Card ID.

JSON response.

Create a new card

  POST /createCard
Parameter Type Description
title string
content string
collection_id string The collection the card is related to.

JSON response.

Get password changing page

  GET /changePassword

Returns rendered template of "change_password.html".

Change password

  POST /changePassword
Parameter Type Description
current_password string
new_password string
confirmation string

Redirects to initial page.

Log out of the app and redirect to the initial page

  POST /logout

Clears the session and redirects to intial page.