Code By Heart is a flashcard app that lets you create and save decks of flashcards, and then later review these cards at optimally-spaced intervals according to a spaced repetition algorithm (based on SM-2: https://www.supermemo.com/en/archives1990-2015/english/ol/sm2). Each flashcard can take the form of either a code snippet (in a variety of programming languages) or plain text. Programming languages supported: Python, JavaScript, Go, C++, C, C#, Objective C, Ruby, Java, Scala, Swift, Rust, Kotlin, Elixir.
github-demo-2022.mp4
- Clone this repository.
- Set up a virtual environment:
python3 -m venv venvandsource venv/bin/activate. - Install the requirements:
pip install -r requirements.txt. - Get a free API key from https://www.jdoodle.com/. Keep this key private, and create a
.envfile with:
JDOODLE_CLIENT_ID=whatever_your_client_id_is
JDOODLE_CLIENT_SECRET=whatever_your_client_secret_is
- Create a local PostgreSQL database called
code_by_heart, and then add to the.envfile the environment variableSQLALCHEMY_DATABASE_URIto hold the path to this database. For example:SQLALCHEMY_DATABASE_URI=postgresql+psycopg2://postgres:postgres@localhost:5432/code_by_heart - Run
flask db initandflask db migrate, and ensure three tables appear in thecode_by_heartdatabase:client,deckandflashcard. - To start up the backend, run
flask run.
- Clone this other repository: https://github.com/rachael-codes/code-by-heart-frontend-v2.
- Install dependencies by running
npm installoryarn install. - Create a
.envfile and add this line:REACT_APP_BACKEND_URL=whatever_your_backend_url_will_be. For example:REACT_APP_BACKEND_URL=http://127.0.0.1:5000. - To start up the frontend, run
yarn start(or npm).
For user authentication, create a Google Firebase project for Code By Heart. Within it, enable Google as a sign-in method, and add your local host as an authorized domain. Update the src/firebase/firebase.utils.js file in the frontend repository with your API key. This key may be exposed to the public (see here: https://medium.com/@paulbreslin/is-it-safe-to-expose-your-firebase-api-key-to-the-public-7e5bd01e637b).