Browse Courses

Final Assignment

Final assignment project to create CodeCraftHub personalized learning platform using generative AI, ChatGPT, Node.js, MongoDB, Express.js, with requirements gathering, database design, code generation, testing, and Docker deployment.

This final assignment guides you through building a personalized learning platform using generative AI and modern web technologies, covering requirements, design, code, testing, and deployment.


  • This project will help you create a personalized learning platform for software developers using ChatGPT.

It involves creating prompts that can be run in a generative AI classroom ChatGPT environment to build a learning platform that provides personalized learning recommendations based on existing courses.

You will explore using ChatGPT to gather requirements for the app, design tables and databases in MongoDB, and use prompts to generate code in Node and Express.js endpoints. You will observe how ChatGPT provides recommendations based on the generated code.

You will learn to generate test cases to test the endpoints of the code and, finally, create a Dockerfile for deploying the app. You can push the code to GitHub at each step and also execute the endpoints in the Cloud IDE.

Estimated time needed: 2 hours

Welcome to the final project. Your organization is creating CodeCraftHub, a personalized learning platform crafted for developers! You are assigned to design the server-side architecture for this learning platform and develop it using Node.js and MongoDB. You will create the server-side components for CodeCraftHub using Generative AI. In this project, you’ll leverage the power of Generative AI and a diverse array of technologies to transform your vision into a reality.

Learning objectives After completing this lab, you will be able to perform the following tasks:

Design and develop software applications using Generative AI Create documentation for the code with Generative AI Create test cases with Generative AI Deploy the deployable application designed and developed entirely with Generative AI Prerequisites You must be familiar with at least one programming language and know software architectures well.

You must have a GitHub account.

You must be comfortable using the IDE.

You must be familiar with using Postman.

You must be familiar with Docker applications and commands.

Setting up the AI classroom


Gathering requirements for the development of the learning platform

Note:

Using GenAI, gather requirements for developing the server-side learning platform by asking the following questions:

The effectiveness of the responses depends on the prompts provided. The prompts provided here are suggestions; you can use your discretion to change them. You should also use your subject matter expertise and judgment as a developer. It is your responsibility to check the correctness of the responses.

prompt> I want to create a personalized online learning platform. I want to start with the server side. Recommend a good design and architecture for the server side and help me understand what is required.

View Answer

To develop a robust server-side architecture for a personalized online learning platform, you’ll need to consider several key components and technologies. Here’s a recommended design and architecture along with the requirements:

Microservices Architecture

  • Scalability: Microservices allow you to scale individual components of your application independently.
  • Flexibility: Each service can be developed, deployed, and maintained independently.
  • Technology Stack: You can use different technologies for different services based on their specific needs.

Core Components:

  • User Management Service: Handles user authentication, authorization, and profile management. Consider using OAuth 2.0 or OpenID Connect for secure authentication.
  • Course Management Service: Manages course creation, updates, and deletions. This service should handle metadata about courses and modules.
  • Recommendation Engine: Implements personalized content delivery using machine learning algorithms to analyze user behavior and preferences.
  • Content Delivery Network (CDN): Ensures fast and reliable delivery of content to users globally.
  • Analytics Service: Collects and analyzes data on user interaction to provide insights and improve personalization.

Technology Recommendations:

  • Backend Frameworks: Node.js, Django (Python), or Spring Boot (Java) for building RESTful APIs.
  • Database: Use a combination of SQL (e.g., PostgreSQL) for structured data and NoSQL (e.g., MongoDB) for unstructured data.
  • Machine Learning: TensorFlow or PyTorch for building and deploying recommendation models.
  • Message Queues: RabbitMQ or Apache Kafka for handling asynchronous communication between microservices.

Infrastructure:

  • Cloud Providers: AWS, Google Cloud, or Microsoft Azure for hosting and scaling your application.
  • Containerization: Use Docker for containerizing applications and Kubernetes for orchestration to manage deployments, scaling, and operations of application containers.

Security:

  • Data Protection: Implement HTTPS, encrypt sensitive data, and regularly update security protocols.
  • Access Control: Use role-based access control (RBAC) to ensure users have appropriate permissions.

Development and Deployment:

  • CI/CD Pipelines: Implement continuous integration and continuous deployment pipelines using tools like Jenkins, GitHub Actions, or GitLab CI/CD.
  • Monitoring and Logging: Use tools like Prometheus for monitoring and ELK Stack (Elasticsearch, Logstash, Kibana) for logging and analyzing logs.

Compliance:

  • Ensure compliance with regulations like GDPR, CCPA, or any other relevant data protection laws, especially if your platform will handle personal data.

Ensure compliance with regulations like GDPR, CCPA, or any other relevant data protection laws, especially if your platform will handle personal data. By focusing on these components and technologies, you can build a scalable, secure, and efficient server-side architecture for your personalized online learning platform.


prompt> I would like to use a microservices architecture for the server side. These are the services I want to be able to provide: 1. Personalized learning recommendations, 2. Interactive coding exercises 3. Real-time feedback to help developers improve their skills and knowledge. What are the various components I should have?

View Answer

To implement a microservices architecture for your personalized online learning platform that includes personalized learning recommendations, interactive coding exercises, and real-time feedback, you’ll need to design specific components and services tailored to these functionalities. Here are the components you should consider:

User Management Service:

Authentication & Authorization: Implement OAuth 2.0 or OpenID Connect for secure login and access control. Profile Management: Store user details and preferences to tailor the learning experience. Personalized Recommendation Service:

Machine Learning Models: Use machine learning algorithms to analyze user behavior and preferences to recommend courses or exercises. Data Collection: Gather data on user interactions to continuously improve recommendation accuracy. Interactive Coding Exercise Service:

Code Execution Environment: Use containers (like Docker) to create isolated environments where users can write and execute code safely. Exercise Management: Store and manage a library of coding exercises and challenges. Real-time Collaboration: Implement features for pair programming or group exercises if needed. Real-time Feedback Service:

Feedback Engine: Analyze user code submissions and provide immediate feedback on correctness, efficiency, and style. Notification System: Use WebSockets or similar technologies to push real-time feedback to users. Course and Content Management Service:

Content Storage: Manage and store course materials, including text, video, and interactive content. Content Delivery: Use a CDN to deliver content quickly and efficiently to users worldwide. Analytics and Insights Service:

User Interaction Tracking: Collect and analyze data on how users interact with the platform to improve personalization and identify trends. Reporting: Provide insights to educators or platform administrators on user progress and engagement. Infrastructure and DevOps:

Container Orchestration: Use Kubernetes to manage containers for scalability and reliability. CI/CD Pipelines: Implement continuous integration and deployment to streamline updates and maintenance. Security and Compliance:

Data Encryption: Protect sensitive data both at rest and in transit. Access Control: Implement role-based access control to ensure users have appropriate permissions. Integration and API Gateway:

API Management: Use an API gateway to manage and secure communication between microservices. Third-party Integrations: Allow integration with external services or tools as needed. Monitoring and Logging:

Monitoring Tools: Use Prometheus or Grafana for real-time monitoring of system performance. Logging: Implement centralized logging with the ELK Stack to track and analyze system logs. By structuring your platform around these services, you can create a scalable and flexible system that supports personalized learning, interactive coding exercises, and real-time feedback effectively.


prompt> I would like to create the user service. I would like to use Node.js and MongoDB for this project. How do I create a project structure?

View Answer

Creating a well-organized project structure for your User Management Service using Node.js and MongoDB is crucial for maintainability and scalability. Below is a recommended project structure along with explanations for each component:

Project Structure typescript

 1user-service/
 2 3├── src/
 4│   ├── config/
 5│   │   └── config.js               # Configuration settings (e.g., environment variables)
 6│   │
 7│   ├── controllers/
 8│   │   └── userController.js       # Business logic for user-related operations
 9│   │
10│   ├── models/
11│   │   └── userModel.js            # Mongoose schema and model for users
12│   │
13│   ├── routes/
14│   │   └── userRoutes.js           # API endpoints related to user operations
15│   │
16│   ├── services/
17│   │   └── authService.js          # Authentication logic (e.g., JWT handling)
18│   │
19│   ├── middlewares/
20│   │   └── authMiddleware.js       # Middleware for authentication and authorization
21│   │
22│   ├── utils/
23│   │   └── helpers.js              # Utility functions
24│   │
25│   ├── app.js                      # Express app setup and middleware configuration
26│   └── server.js                   # Server entry point
2728├── .env                            # Environment variables
29├── .gitignore                      # Files and directories to ignore in Git
30├── package.json                    # Project dependencies and scripts
31└── README.md                       # Project documentation

Explanation of Components src/config/config.js:

Store configuration settings such as database connection strings, API keys, and other environment-specific variables. Use the dotenv package to load variables from a .env file. src/controllers/userController.js:

Contains business logic for handling user operations like registration, login, profile updates, etc. src/models/userModel.js:

Define the Mongoose schema and model for users, specifying the structure of user documents in MongoDB. src/routes/userRoutes.js:

Define the API endpoints for user-related operations and link them to the corresponding controller functions. src/services/authService.js:

Implement authentication logic, such as generating JWT tokens for user sessions and handling password hashing. src/middlewares/authMiddleware.js:

Middleware for checking user authentication and authorization, ensuring only authorized users can access certain routes. src/utils/helpers.js:

Utility functions that can be reused across the application, such as input validation or error handling. src/app.js:

Set up the Express application, configure middleware, and initialize routes. src/server.js:

Entry point for the server, responsible for starting the Express application and connecting to the MongoDB database.


Initialize the Project

1mkdir user-service
2   cd user-service
3   npm init -y

Install Dependencies

1npm install express mongoose dotenv jsonwebtoken bcryptjs
2   npm install --save-dev nodemon

Create the .env File

Store sensitive information like database URI and JWT secret:

1MONGODB_URI = your_mongodb_connection_string
2JWT_SECRET = your_jwt_secret
3PORT = 3000

Start the Server

  • Use nodemon for development to automatically restart the server on file changes:
1npx nodemon src/server.js

By following this structure, you can ensure that your User Management Service is modular, making it easier to maintain and extend as your platform grows.


View Answer
 1user-service/
 2 3├── src/
 4│   ├── config/
 5│   │   ├── db.js             # Database connection configuration
 6│   │   └── server.js         # Server configuration (port, middleware)
 7│   │
 8│   ├── controllers/
 9│   │   └── userController.js  # User-related request handlers
10│   │
11│   ├── models/
12│   │   └── userModel.js       # User schema and model definitions
13│   │
14│   ├── routes/
15│   │   └── userRoutes.js       # API route definitions for user-related endpoints
16│   │
17│   ├── middleware/
18│   │   └── authMiddleware.js    # Authentication and authorization middleware
19│   │
20│   ├── services/
21│   │   └── userService.js       # Business logic related to user operations
22│   │
23│   ├── utils/
24│   │   └── validation.js        # Input validation functions
25│   │
26│   └── app.js                  # Main application entry point
2728├── tests/
29│   └── user.test.js             # Unit and integration tests for user service
3031├── .env                          # Environment variables (e.g., DB URI, JWT secret)
32├── .gitignore                    # Files and directories to ignore in Git
33├── package.json                  # Project metadata and dependencies
34└── README.md                     # Project documentation

prompt> Provide me the code that is to be included in the files

View Answer

FAQ