CodeTrove ‐ Basic - Yash-777/LearnJava GitHub Wiki

How to use it now:

  • Install dependencies: npm install
  • Create .env file from .env.example: copy .env.example .env
  • Edit .env and make sure it has:
    GOOGLE_APPLICATION_CREDENTIALS=./serviceAccountKey.json
    VITE_FIREBASE_PROJECT_ID=your-project-id
    # ... other Firebase config
    
  • Run the setup script: npm run setup-users

Authentication

Authenticate and manage users from a variety of providers without server-side code

Up-On clicking Get Started button.

Processing user: Yash-777...
✗ Failed to create Yash-777: There is no configuration corresponding to the provided identifier.

Email/Password Allow users to sign up using their email address and password. Our SDKs also provide email address verification, password recovery, and email address change primitives. Learn more

Processing user: Yash-777...
✓ Created Yash-777

Processing user: Yash-Admin...
✗ Failed to create Yash-Admin: The password must be a string with at least 6 characters.

These errors are being thrown by Firebase because of two specific configuration issues in your Firebase project:

  1. "There is no configuration corresponding to the provided identifier"

Reason: This error (auth/configuration-not-found) occurs when either Firebase Authentication is not activated in your project, or the Email/Password sign-in provider is not enabled.

How to fix it:

Open the Firebase Console and select your project (node-firestore-service).

In the left navigation menu, click Authentication.

If you see a Get Started button, click it to initialize the service.

Go to the Sign-in method tab.

Select Email/Password, turn on the Enable toggle, and click Save.

  1. "The password must be a string with at least 6 characters"

Reason: Firebase Authentication enforces a security rule requiring all user passwords to be at least 6 characters long. The password provided for Yash-Admin in your defaultUsers array is shorter than this limit.

How to fix it:

Open your script where defaultUsers is defined and update Yash-Admin's password (and any other user's password) to be at least 6 characters long (e.g., "admin123" instead of something short like "1234").


✓ Successfully created:
  ✓ Yash-777
    Email:    [email protected]
    Password: IIayuX8v%Mci%CSf
    Role:     admin
    UID:      ggZvp2xp3mRxEy4dlfkeKidJLe32

  ✓ Yash-Editor
    Email:    [email protected]
    Password: Editor
    Role:     editor
    UID:      AFANFgVgEEdhX7P4tVAwBJCCe9A2

  ✓ Yash-Viewer
    Email:    [email protected]
    Password: Viewer
    Role:     viewer
    UID:      B6EounYeB9T216zCtlNArXer1o93

🎯 What You Got

  1. Markdown Content System ✅
    • Topic content now uses .md files with full styling
    • Supports:
      • Syntax-highlighted code blocks (any language)
      • Tables, lists, links, emphasis
      • GitHub-flavored markdown
      • Dark/light mode support
    • Example: java/optional/content.md - comprehensive guide
  2. Dev Mode Admin (No Login Required) ✅
    • Set VITE_DEV_ADMIN=true in .env
    • You're automatically logged in as admin
    • Perfect for testing admin features without Firebase
    • Easy to toggle off for production
  3. Better Content Architecture ✅
    • Metadata in .js files (slug, title, summary, tags)
    • Content in .md files (readable, portable)
    • No React code in content
    • Non-developers can write topics
  4. Complete Documentation ✅
    • CONTENT_CREATION_GUIDE.md - Step-by-step topic creation
    • MARKDOWN_SYSTEM_SETUP.md - System overview & quick start
    • Example markdown content with all features

📝 Creating New Topics (Super Easy!)

3 simple steps:

Step 1: Add to category file (java.js):

{
  slug: 'your-topic',
  title: 'Your Topic Title',
  summary: 'Brief description',
  tags: ['java', 'tag1'],
  gifUrl: null,
  relatedTool: null,
  body: '',  // Always empty!
}

Step 2: Create markdown file at src/data/topics/java/your-topic/content.md:

# Your Topic Title

## Intro

Your content with **markdown** features.

## Code Example

```java
public class Example {
  // Syntax highlighted!
}
```--

Step 3: Refresh browser - topic appears automatically!

📦 Files Created

  1. MarkdownContent.jsx - Markdown renderer component
  2. MarkdownContent.css - Beautiful markdown styles
  3. CONTENT_CREATION_GUIDE.md - Detailed topic creation guide
  4. MARKDOWN_SYSTEM_SETUP.md - System overview

🔧 Files Modified

  1. package.json - Added react-markdown, remark-gfm
  2. TopicPage.jsx - Now uses MarkdownContent
  3. AuthContext.jsx - Added dev mode admin
  4. .env - Set VITE_DEV_ADMIN=true
  5. java/optional/content.md - Rich markdown example

✨ Key Features

✅ Syntax highlighting - All languages supported ✅ Tables - GitHub flavored markdown ✅ Dark mode - Automatic theme support ✅ No login needed - Dev mode admin ✅ Easy content - Just write markdown ✅ Scalable - Add 100s of topics easily

⚠️ Important Notes

Dev Mode:

  • VITE_DEV_ADMIN=true = No login needed (DEV ONLY)
  • Always set to false before production
  • Works only in npm run dev (not in production builds)

Content Creation:

  • File paths must match exactly: src/data/topics/{category}/{slug}/content.md
  • body field in .js must always be empty string ''
  • Metadata file (java.js) needs entry in array

📚 Full Guides

Next

  1. Run npm install
  2. Run npm run dev
  3. Check out Java → Optional topic to see markdown in action
  4. Create a new topic following the guide
  5. When production-ready, set VITE_DEV_ADMIN=false and enable Firebase

Everything is ready to go! 🎉Step 3: Refresh browser - topic appears automatically!

📦 Files Created

  1. MarkdownContent.jsx - Markdown renderer component
  2. MarkdownContent.css - Beautiful markdown styles
  3. CONTENT_CREATION_GUIDE.md - Detailed topic creation guide
  4. MARKDOWN_SYSTEM_SETUP.md - System overview

🔧 Files Modified

  1. package.json - Added react-markdown, remark-gfm
  2. TopicPage.jsx - Now uses MarkdownContent
  3. AuthContext.jsx - Added dev mode admin
  4. .env - Set VITE_DEV_ADMIN=true
  5. java/optional/content.md - Rich markdown example

✨ Key Features

✅ Syntax highlighting - All languages supported ✅ Tables - GitHub flavored markdown ✅ Dark mode - Automatic theme support ✅ No login needed - Dev mode admin ✅ Easy content - Just write markdown ✅ Scalable - Add 100s of topics easily

⚠️ Important Notes

Dev Mode:

  • VITE_DEV_ADMIN=true = No login needed (DEV ONLY)
  • Always set to false before production
  • Works only in npm run dev (not in production builds)

Content Creation:

  • File paths must match exactly: src/data/topics/{category}/{slug}/content.md
  • body field in .js must always be empty string ''
  • Metadata file (java.js) needs entry in array

📚 Full Guides

Next

  1. Run npm install
  2. Run npm run dev
  3. Check out Java → Optional topic to see markdown in action
  4. Create a new topic following the guide
  5. When production-ready, set VITE_DEV_ADMIN=false and enable Firebase

Everything is ready to go! 🎉