Skip to content

yixin0829/lp-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

121 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learning Path Generator

1 Goal

Help people learn faster and more efficiently to reach their learning goal. LearnAnything's mission is to facilitate the consolidation of the world's knowledge sharing by creating a place where users can share their learning experiences and knowledge with others.

2 Overview

Why did we build LearnAnything? You might ask. Well, we want you to think of LearnAnything as more than just a learning path generator, but as an entry point for YOU to begin your learning journey on any topic that you could possibly imagine. Just as Mahatma Gandhi once said, "Live as if you were to die tomorrow. Learn as if you were to live forever."

3 How to Run

3.1 Local (without Docker)

  • Backend
    • cd server
    • uv sync
    • Set OPENAI_API_KEY in your shell or .env
    • Optional: set CORS_ORIGINS=http://localhost:3000 (comma-separated list supported)
    • Optional: set CACHE_BACKEND=firestore to enable learning path caching (default: noop — no caching)
    • Start API: uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
  • Frontend
    • cd client
    • npm install
    • npm run dev
    • App runs at http://localhost:3000
  • API base URL config
    • client/.env.development defaults to VITE_API_BASE_URL=http://localhost:8000
    • Local FE+BE flow should call http://localhost:8000/v1/lp/{term}

3.2 Frontend Production Env (Vercel)

  • The repo keeps client/.env.production as:
    • VITE_API_BASE_URL=__PROD_API_BASE_URL_PLACEHOLDER__
  • In Vercel Project Settings, set:
    • VITE_API_BASE_URL=https://<your-deployed-backend-url>
  • This variable is required for production API calls.

3.3 With Docker Compose

  • Run from repo root: docker compose up --build
  • Frontend served on http://localhost:3000
  • Backend served on http://localhost:8000

3.4 Backend Deployment (Cloud Run)

  • Build and deploy (example):
    • gcloud builds submit --tag gcr.io/$GOOGLE_CLOUD_PROJECT/lp-backend ./server
    • gcloud run deploy lp-backend --image gcr.io/$GOOGLE_CLOUD_PROJECT/lp-backend --region <region> --platform managed --allow-unauthenticated --set-env-vars CORS_ORIGINS=https://<your-frontend-domain> --set-secrets OPENAI_API_KEY=OPENAI_API_KEY:latest
  • The container serves FastAPI with:
    • uvicorn app.main:app --host 0.0.0.0 --port $PORT
  • Health check endpoint:
    • GET /health

4 SEO & Discoverability

The client includes per-route SEO optimizations so search engines and AI crawlers can discover and cite the site:

  • Per-route <head> tags — each page sets its own <title>, <meta description>, canonical URL, OpenGraph, and Twitter Card tags via a shared Seo component (client/src/seo/Seo.jsx). Uses React 19 native <head> hoisting (no extra library).
  • JSON-LD structured data — Home page emits WebSite, WebApplication, and Organization schemas (with a SearchAction). About page emits AboutPage, Person, Organization, and BreadcrumbList.
  • Crawl filesrobots.txt (allows search + AI search bots, blocks training-only crawlers), sitemap.xml, and llms.txt are served from client/public/.
  • Pre-rendered SEOnpm run build runs a post-build script (client/scripts/prerender-seo.mjs) that injects <title>, meta tags, and JSON-LD into the static HTML for / and /about, so bots that don't execute JS still see the critical signals.
  • noindex on generator/learningpath?term=... is marked noindex,follow to prevent infinite indexable URLs.
  • Site constantsSITE_URL, SITE_NAME, etc. are centralized in client/src/config/site.js (reads VITE_SITE_URL with a prod fallback).

5 Resources

About

Learning Path Generator

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors