Create a full backend architecture for a web application that enables users to generate AI-powered flashcards from files, URLs, and topics. The backend must include:
User Authentication System
Secure sign-up, login, and logout using email/password or OAuth (Google/GitHub).
JWT-based session management or Firebase Authentication.
Password encryption using bcrypt or similar.
Database Design
Use a cloud database (e.g., Firebase Firestore, MongoDB Atlas, or PostgreSQL) to store:
User profiles (encrypted credentials, preferences, timestamps).
Flashcards (content, source type—file/URL/topic, creation date, tags, difficulty level).
Notes (user-generated text linked to specific flashcards or topics).
Structure data for efficient querying and indexing (e.g., by user ID, topic, or date).
API Endpoints (RESTful or GraphQL)
POST /api/auth/register – Register new user.
POST /api/auth/login – Authenticate user and return token.
GET /api/user/content – Fetch all flashcards and notes for…