Skip to content

The ai-flashcards project is a Next.js web application that leverages AI to create, purchase, and study flashcards. It integrates Tailwind CSS for enhanced styling, and uses Clerk for route protection, ensuring robust security.

Notifications You must be signed in to change notification settings

saatviknagpal/ai-flashcards

Repository files navigation

AI-FLASHCARDS

AI Flashcards: Expand Memory, Streamline Learning

license last-commit repo-top-language repo-language-count

Developed with the software and tools below.

Firebase JavaScript PostCSS React Axios ESLint Stripe JSON


Quick Links


Overview

The ai-flashcards project is a Next.js web application that leverages AI to create, purchase, and study flashcards. It integrates Tailwind CSS for enhanced styling, and uses Clerk for route protection, ensuring robust security. The app facilitates flashcard generation and checkout processes via API routes, enabling users to create and purchase custom flashcards. With AI-powered flashcard creation and seamless payment processing, ai-flashcards provides a valuable tool for efficient and personalized learning experiences.


Features

Feature Description
βš™οΈ Architecture Next.js with Tailwind CSS, leveraging API routes and serverless functions for dynamic content creation and delivery. Utilizes path aliases for streamlined access to modules and components.
πŸ”© Code Quality Follows a modular structure with well-defined API routes and middleware for route protection. Uses ESLint for code linting and follows Tailwind CSS for consistent styling.
πŸ“„ Documentation Limited information regarding code documentation and architectural decision-making. More comprehensive documentation could improve understanding and onboarding for contributors.
πŸ”Œ Integrations Integrates with Stripe for payment processing, Clerk for route protection, and Firebase for database operations.
🧩 Modularity Modular architecture with separate API routes and middleware for route protection, promoting reusability and maintainability.
πŸ§ͺ Testing No explicit mention of testing frameworks and tools. Consideration for incorporating unit and integration tests would enhance code reliability.
⚑️ Performance Utilizes Tailwind CSS for efficient styling and responsive design. Efficient resource usage and speed can be inferred from the use of Next.js.
πŸ›‘οΈ Security Implements Clerk for route protection, ensuring secure access control. Measures for data protection include API route protection and secure payment processing using Stripe.
πŸ“¦ Dependencies Relies on various dependencies such as Next.js, Stripe, Tailwind CSS, Firebase, and others.
πŸš€ Scalability Next.js and serverless functions support scalability, enabling the app to handle increased traffic and load efficiently.

Repository Structure

└── ai-flashcards/
    β”œβ”€β”€ README.md
    β”œβ”€β”€ app
    β”‚   β”œβ”€β”€ [id]
    β”‚   β”‚   └── page.js
    β”‚   β”œβ”€β”€ api
    β”‚   β”‚   β”œβ”€β”€ checkout
    β”‚   β”‚   β”‚   └── route.js
    β”‚   β”‚   β”œβ”€β”€ generate-flashcards
    β”‚   β”‚   β”‚   └── route.js
    β”‚   β”‚   └── generate-flashcards-from-text
    β”‚   β”‚       └── route.js
    β”‚   β”œβ”€β”€ favicon.ico
    β”‚   β”œβ”€β”€ globals.css
    β”‚   β”œβ”€β”€ layout.js
    β”‚   β”œβ”€β”€ page.js
    β”‚   β”œβ”€β”€ pricing
    β”‚   β”‚   └── page.js
    β”‚   β”œβ”€β”€ providers
    β”‚   β”‚   └── QueryClientProvider.js
    β”‚   β”œβ”€β”€ saved-flashcards
    β”‚   β”‚   β”œβ”€β”€ [id]
    β”‚   β”‚   β”‚   └── page.js
    β”‚   β”‚   └── page.js
    β”‚   └── utils
    β”‚       β”œβ”€β”€ flashcardUtils.js
    β”‚       └── get-stripe.js
    β”œβ”€β”€ components
    β”‚   β”œβ”€β”€ Checkout.js
    β”‚   β”œβ”€β”€ FileUpload.js
    β”‚   β”œβ”€β”€ Navbar.js
    β”‚   β”œβ”€β”€ dark-mode-toggle.js
    β”‚   β”œβ”€β”€ text-flashcards.js
    β”‚   └── ui
    β”‚       β”œβ”€β”€ button.jsx
    β”‚       β”œβ”€β”€ card.jsx
    β”‚       β”œβ”€β”€ dialog.jsx
    β”‚       β”œβ”€β”€ dropdown-menu.jsx
    β”‚       β”œβ”€β”€ input.jsx
    β”‚       └── theme-provider.js
    β”œβ”€β”€ components.json
    β”œβ”€β”€ firebase.js
    β”œβ”€β”€ jsconfig.json
    β”œβ”€β”€ lib
    β”‚   β”œβ”€β”€ stripe.js
    β”‚   └── utils.js
    β”œβ”€β”€ middleware.js
    β”œβ”€β”€ next.config.mjs
    β”œβ”€β”€ package-lock.json
    β”œβ”€β”€ package.json
    β”œβ”€β”€ postcss.config.mjs
    β”œβ”€β”€ public
    β”‚   β”œβ”€β”€ next.svg
    β”‚   └── vercel.svg
    └── tailwind.config.js

Modules

.
File Summary
jsconfig.json The code snippet in jsconfig.json sets up path aliases for the parent repository's architecture, providing streamlined access to various modules and components throughout the codebase.
postcss.config.mjs The code in postcss.config.mjs configures Tailwind CSS for the parent ai-flashcards repository, enhancing styling capabilities within the application.
components.json The code snippet in api/checkout/route.js handles the API route for checkout in the ai-flashcards repository. It facilitates payment processing and order completion for flashcard purchases.
middleware.js Code snippet overview: middleware.js adds route protection using Clerk for selected routes in the Next.js app. It uses clerkMiddleware to define and enforce route protection based on specified criteria. The createRouteMatcher validates routes, and auth().protect() secures them. The code is crucial for enhancing app security.
package.json This code snippet orchestrates the API routes for generating flashcards, ensuring seamless integration within the app's architecture. It facilitates dynamic content creation and delivery.
next.config.mjs The code snippet in next.config.mjs configures Next.js settings for the parent repository ai-flashcards. It defines custom Next.js configurations.
tailwind.config.js This code snippet provides a route for generating flashcards from text as part of the AI Flashcards app's API. It contributes to the app's functionality related to creating flashcards from text inputs.
package-lock.json This code snippet is responsible for handling the generation of flashcards from text input in the AI Flashcards parent repository. It plays a critical role in the application's feature set by enabling users to convert plain text into flashcards seamlessly.
firebase.js Code in firebase.js initializes Firebase app, firestore, and storage for the parent repository's frontend app to interact with the Firebase cloud services to store and retrieve data. This integration enables efficient handling of user data and assets.
components
File Summary
text-flashcards.js This code snippet, situated in the components directory, powers the generation of flashcards from text input. It integrates with the generate-flashcards-from-text API endpoint and handles the UI component for text input-based flashcard creation.
dark-mode-toggle.js This code snippet, dark-mode-toggle.js, provides a component for toggling between light and dark themes in the parent repository's UI. It imports and utilizes the useTheme hook to enable theme switching. The component offers a visually appealing and user-friendly interface for theme selection.
FileUpload.js This code snippet in the ai-flashcards repository implements API routes for flashcard generation and payment checkout. It's pivotal to the repository's backend architecture, handling critical functionalities.
Navbar.js Code Summary:The Navbar.js component renders a navbar with links to home, saved flashcards, pricing, and a dark mode toggle. It also includes a user button for authentication. This component helps create a cohesive and navigable user interface within the parent repository's architecture.
Checkout.js This Checkout.js component facilitates seamless integration of Stripe payments into the AI Flashcards platform. It allows the user to purchase a specific plan, efficiently handling the payment process.
components.ui
File Summary
dialog.jsx This code snippet adds routing for flashcard generation and text extraction to the existing API structure in the AI Flashcards repository. It enables users to dynamically create flashcards through the application's interface.
input.jsx Code Summary: The input.jsx component provides a reusable UI input element with dynamic styling for React applications. It enhances the parent repository's UI capabilities by enabling flexible and consistent input fields across the app.
theme-provider.js The code in theme-provider.js facilitates the implementation of a theme provider component within the repository's architecture. It enables the usage of themes in the application's UI components.
card.jsx Summary: The card.jsx code provides reusable UI components for creating cards with title, description, and footer, supporting customization. It contributes essential UI elements to the parent repository's frontend architecture.
dropdown-menu.jsx This code snippet adds routes for generating flashcards from text to the parent repository's API module. It supports the creation of flashcards from user-provided text inputs.
button.jsx This code snippet defines a flexible Button component using class variance authority for styling variations. It plays a crucial role in providing consistent and customizable UI buttons across the app.
lib
File Summary
utils.js The code snippet in lib/utils.js provides a utility function for merging CSS class names using clsx and tailwind-merge libraries. This enhances the repository's architecture by centralizing CSS class merging operations.
stripe.js The code in lib/stripe.js defines pricing plans and their features for the billing component in the ai-flashcards repository, helping manage subscription options and billing logic.
app
File Summary
layout.js Code in app/layout.js configures the base layout for the Next.js application, utilizing Clerk for authentication and QueryProvider for managing data querying. It establishes global styles and theme handling.
page.js The app/page.js code provides the Home component for the AI flashcards app. It handles user authentication, presents UI components, and allows generating flashcards from PDF or text.
globals.css Code snippet in generate-flashcards/route.js handles API requests for creating flashcards. This module interfaces with the app's backend to process and store flashcard data. It's a key component of the flashcard generation feature in the repository's architecture.
app.[id]
File Summary
page.js This code snippet is a route for generating flashcards from text in the api section of the AI Flashcards repository. It facilitates the creation of flashcards from input text.
app.saved-flashcards
File Summary
page.js This code snippet implements flashcard generation and text-to-flashcard conversion, contributing to the parent repository's app functionality in the generate-flashcards and generate-flashcards-from-text routes.
app.saved-flashcards.[id]
File Summary
page.js This code snippet includes the route.js files within the api folder, responsible for handling checkout and flashcards generation APIs in the parent repository's architecture.
app.utils
File Summary
get-stripe.js Code in app/utils/get-stripe.js: Handles lazy loading of Stripe library to reduce initial page load by asynchronously fetching the library when needed. Improves performance in the payment flow.
flashcardUtils.js The code in app/utils/flashcardUtils.js facilitates saving flashcards to a user's account by leveraging Firebase Firestore and the Clerk authentication library. It integrates with the parent repository's architecture to handle user-specific data management.
app.pricing
File Summary
page.js Summary:In app/pricing/page.js, the code defines a web page for selecting pricing plans and integrating with the Stripe API for checkout. It incorporates user authentication using Clerk and displays plan details dynamically.This code snippet plays a critical role in the frontend UI of the parent repository by creating a user-friendly interface for users to choose from various pricing plans. It seamlessly integrates with the Stripe API for secure payment processing and utilizes user authentication to provide personalized experiences based on the user's identity.
app.api.checkout
File Summary
route.js The route.js code in app/api/checkout manages Stripe checkout for subscription. It creates and retrieves checkout sessions using Stripe API.
app.api.generate-flashcards
File Summary
route.js This code snippet contains API routes for generating flashcards. It plays a critical role in handling flashcard creation within the parent repository's architecture.
app.api.generate-flashcards-from-text
File Summary
route.js This code snippet in the ai-flashcards repository manages API routes for flashcard generation and checkout. It plays a critical role in handling user requests and integrating with external services.
app.providers
File Summary
QueryClientProvider.js The QueryClientProvider.js file in the ai-flashcards repository sets up a query client for React components using the @tanstack/react-query library, enhancing the app's data fetching capabilities.

Getting Started

Requirements

Ensure you have the following dependencies installed on your system:

  • JavaScript: version x.y.z

Installation

  1. Clone the ai-flashcards repository:
git clone https://github.com/saatviknagpal/ai-flashcards
  1. Change to the project directory:
cd ai-flashcards
  1. Install the dependencies:
npm install

Running ai-flashcards

Use the following command to run ai-flashcards:

node app.js

Tests

To execute tests, run:

npm test

Contributing

Contributions are welcome! Here are several ways you can contribute:

Contributing Guidelines
  1. Fork the Repository: Start by forking the project repository to your GitHub account.
  2. Clone Locally: Clone the forked repository to your local machine using a Git client.
    git clone https://github.com/saatviknagpal/ai-flashcards
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear message describing your updates.
    git commit -m 'Implemented new feature x.'
  6. Push to GitHub: Push the changes to your forked repository.
    git push origin new-feature-x
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.

Once your PR is reviewed and approved, it will be merged into the main branch.


License

This project is protected under the SELECT-A-LICENSE License. For more details, refer to the LICENSE file.


Acknowledgments

  • List any resources, contributors, inspiration, etc. here.

Return


About

The ai-flashcards project is a Next.js web application that leverages AI to create, purchase, and study flashcards. It integrates Tailwind CSS for enhanced styling, and uses Clerk for route protection, ensuring robust security.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published