This repo provide design and sourcecode for learning-journey module.
UX design can be found here
- This is a SSR webapp build by NextJS
- Language: Typescript
- Database: Mongo DB
-
The whole project will be packaged in a Docker image. It needs to connect to an external MongoDB.
-
This web app is designed to be served in two ways:
- Standalone web app; it can be hosted for public or internal use.
- Embedded in the playground.digital.auto platform as a built-in learning tool.
- Package and deploy by npm, npx
This is a Next.js project bootstrapped with create-next-app.
-
Run the development setup script:
npm run setup:dev
This will:
- Check Docker installation
- Create
.env.devfile - Start MongoDB and MongoDB Express
- Migrate mock data to the database
-
Start the development server:
npm run dev
-
Access the services:
- Next.js App: http://localhost:3000
- MongoDB Express (Admin): http://localhost:8081 (admin/password123)
-
Run the production setup script:
npm run setup:prod
This will:
- Check Docker installation
- Create
.env.prodfile from template - Build the Next.js application
- Start all production services
- Migrate data to the database
-
Access the application:
- Application: http://localhost:3000
- MongoDB Express (if enabled): http://localhost:8081
npm run docker:dev:up # Start MongoDB and MongoDB Express
npm run migrate # Migrate data
npm run dev # Start development servercp env.prod.example .env.prod # Configure production environment
npm run docker:prod:up # Start production services
npm run docker:prod:admin # With MongoDB Express
npm run docker:prod:nginx # With Nginx
npm run docker:prod:full # With all servicesOpen http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.
npm run dev- Start development servernpm run build- Build for productionnpm run start- Start production servernpm run lint- Run linternpm run migrate- Migrate mock data to database
For maintenance tasks, run scripts directly from scripts/ directory:
node scripts/backup-db.js- Backup databasenode scripts/restore-db.js- Restore database- See DEVELOPMENT.md for more details
The application now supports both database and mock data with automatic fallback:
GET /api/paths- Get all pathsGET /api/paths/[slug]- Get path by slugPOST /api/paths- Create new pathPUT /api/paths/[slug]- Update pathDELETE /api/paths/[slug]- Delete path
GET /api/courses- Get all coursesGET /api/courses/[slug]- Get course by slugPOST /api/courses- Create new coursePUT /api/courses/[slug]- Update courseDELETE /api/courses/[slug]- Delete course
GET /api/lessons- Get all lessonsGET /api/lessons/[slug]- Get lesson by slugPOST /api/lessons- Create new lessonPUT /api/lessons/[slug]- Update lessonDELETE /api/lessons/[slug]- Delete lesson
GET /api/quiz-questions- Get all quiz questions (with filters)GET /api/quiz-questions/[id]- Get quiz question by IDPOST /api/quiz-questions- Create new quiz questionPUT /api/quiz-questions/[id]- Update quiz questionDELETE /api/quiz-questions/[id]- Delete quiz questionPOST /api/quiz-questions/[id]/grade- Grade a quiz answer
GET /api/health- Check application and database status
The application uses MongoDB with the following collections:
- paths - Learning paths with course references
- courses - Courses with lesson references and sections
- lessons - Individual lessons with different types (video, text, quiz, interactive, etc.)
- courseprogresses - User progress tracking
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
For detailed setup instructions, see SETUP.md.
1 Config the folder store data in .env file
MEDIA_STORE_PATH=/opt/learning/media_store- Create a symbolic link from your media store to the public directory
ln -s /opt/learning/media_store/images ./public/images
ln -s /opt/learning/media_store/files ./public/files