This document provides a concise overview of the Flashcard application's architecture, features, and setup instructions.
The Flashcard app is a web application designed to help users learn and memorize information using flashcards and a spaced repetition system. It features user authentication, flashcard management, and a battle/quiz mode. It's built using a MERN stack (MongoDB, Express.js, React, Node.js) architecture.
- User Authentication: Secure signup and login functionality using JWT.
- Flashcard Management: Create, view, update, and delete flashcards with a spaced repetition system (SRS) for optimized learning. Flashcards can be categorized by domain.
- Battle/Quiz Mode: Test your knowledge in a timed battle against yourself.
- Spaced Repetition Review: A dedicated review mode to focus on flashcards due for review, organized into review boxes.
- Responsive Design: Accessible on various devices.
- Frontend: React, React Router, React Bootstrap
- Backend: Node.js, Express.js
- Database: MongoDB with Mongoose
- Authentication: JWT (JSON Web Tokens)
The application follows a MERN stack architecture:
- Frontend (React): Handles user interface and interactions.
- Backend (Express.js/Node.js): Manages API requests, database interactions, and authentication.
- Database (MongoDB): Stores user data, flashcards, and battle information.
- User: Stores user information (name, email, password, battle statistics).
- Flashcard: Stores flashcard data (question, answer, domain, SRS box level, next review date).
- Battle: Stores battle information (player, category, flashcards, score).
(See detailed API documentation within the code for a complete list.) Key endpoints include:
/auth/signup,/auth/login: User authentication./flashcards: CRUD operations for flashcards./battles: Start and answer quiz questions.
LoginPage,SignupPage: Authentication components.Home: Landing page (currently placeholder).Flashcards: Manages flashcard display and interactions.BattleMode: Handles the flashcard quiz/battle functionality.ReviseFlashcards: Component for reviewing flashcards using the SRS.
- Clone the repository.
- Navigate to the backend directory.
- Install dependencies:
npm install - Create a
.envfile and configure environment variables (e.g.,MONGO_URL,JWT_SECRET). - Start the server:
npm start
- Navigate to the frontend directory.
- Install dependencies:
npm install - Create a
.envfile and configure environment variables (e.g.,REACT_APP_API_URL). - Start the development server:
npm start
- Start the backend server.
- Start the frontend development server.
- Access the application in your browser.
The BattleMode component implements the flashcard quiz functionality. It features:
- Quiz initialization on component mount.
- 5-second timer for each question.
- Automatic answer submission when the timer expires.
- Quiz completion tracking and score display.
- Dynamic question display.
The ReviseFlashcards component handles the spaced repetition review process:
- Fetches flashcards from the backend, including date formatting.
- Allows users to select a domain for review.
- Implements "Correct" and "Incorrect" buttons to update the SRS box level and next review date.
- Displays flashcards grouped by SRS box.
- Provides feedback on review progress.
The application uses a spaced repetition system to optimize learning. Flashcards are organized into review boxes, with the review schedule based on the box level.
- Box Levels: Flashcards progress through boxes as they are answered correctly. Incorrect answers reset the flashcard to Box 1.
- Review Scheduling: The time between reviews increases as the flashcard moves to higher boxes.
ReviseFlashcardsComponent: This component facilitates the SRS by displaying flashcards grouped by their current box and allowing users to mark answers as correct or incorrect, which updates the box level and next review date.
The App component sets up the routing and navigation for the application. Key features:
- Uses
react-router-domfor navigation. - Implements protected routes using
Navigate. Unauthenticated users are redirected to the login page. - Provides a navigation bar with links to different sections.
- Handles user authentication status and logout functionality.
