Skip to content

PavelKotlov/codi-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔗 Codi-API

Say goodbye to boring memorization - Codi's flashcard-based platform makes learning to code a fun and seamless experience with progress tracking to keep you motivated.

🔗 Live Version | Live API | Codi Client Repo

made-with-node made-with-PostgreQSQL made-with-Auth0 made-with-Axios made-with-prisma made-with-OpenAI made-with-express made-with-Railway

Table of Content

🌟 Features

  • Topic management: users can manage their topics through the topics endpoints.

  • Flashcard management: users can manage flashcards for a specific topic through the cards endpoints.

  • Flashcard quiz: the quiz endpoint provides a random set of flashcards for the user to answer in a quiz session.

  • Analytics

    • Topic statistics: users can retrieve statistics for a specific topic, such as the total number of flashcards, the number of flashcards in each status, and the number of flashcard reviews grouped by date.
  • Security:

    • The API requires authentication through Auth0 to access any of its endpoints.
    • Users can only access topics and flashcards they own.

🚀 Getting Started

  1. Connect to your postgres server

  2. Clone it
    git clone https://github.com/PavelKotlov/codi-api

  3. Navigate to the repo
    cd codi-api

  4. Install all the depndencies
    npm install

  5. Sign up with Auth0. Create an API follow the prompts and ensure to allow Allow Offline Access. ⚠️ Alternativly if you will connect a front end application also do the following: Add http://localhost:[PORT] link to Allowed Callback URLs, Allowed Logout URLs, and Allowed Web Origins. Add https://[app-name.us].auth0.com/authorize to Application Login URI.

  6. Create a .env file according to the template below

    DATABASE_URL=
    OPENAI_API_KEY=
    AUTH0_AUDIENCE=
    AUTH0_ISSUER_BASE_URL=
  7. Create a databse for the project

    CREATE DATABASE codi;
    
  8. Run migrations and seed the database

    npx prisma migrate reset
  9. Run the server

    npm start

⚫ Endpoints

Http method path Description
GET /api/topics Gets all the topics for the authorized user
POST /api/topics Creat a new topic for the authorized user
GET /api/topics/:id Gets a specific topic for the authorized user
DELETE /api/topics/:id Deletes a specific topic for the authorized user
PATCH /api/topics/id Edits a specific topic for the authorized user
GET /api/topics/:id/stats Gets reviews per day, card counts, and graph informartion of a specific topic for the authorized user
GET /api/topics/:id/cards/quiz Gets the cards due for a quiz for a specific topic for the authorized user
GET /api/topics/:id/cards Gets all the cards for a specific topic for the authorized user
DELETE /api/topics/:id/cards/:card_id Deletes a card from a specific topic for the authorized user
GET /api/topics/:id/cards/:card_id Gets a specific card for a specific topic for the authorized user
POST /api/topics/:id/cards Adds a card to a specific topic for the authorized user
PATCH /api/topics/:id/cards/:card_id Edits a card for a specific topic for the authorized user

🧱 Main Structure

├── db                     # functions that interact with the db to retrieve stats data
├── helpers                # helper functions
├── prisma                 # database
│  ├── migrations          # database migrations
│  ├── seeds               # database seeds
├─── routes                # app routes
├─── knexfile.js
├─── package-lock.json
├─── package.json
├─── README.md
└─── server.js            # the server: the main driver of the app includes all the routes and server configs

📦 Tech Stack (Dependencies)

🔙 Backend

🧰 Development Dependencies

🔨 contributors

  • PavelKotlov @PavelKotlov
  • Juliana Mochizuki @jkmochizuki
  • Shorouk Abdelaziz @ShoroukAziz

⚠️ Disclaimer

⬆ Go to beginning

About

Codi App

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •