The inc-lms project is a web application built using TypeScript and React. It serves as a learning management system (LMS) that provides a user-friendly interface for managing educational content and user interactions.
The project is organized into the following directories and files:
-
src/: Contains the source code for the application.
- components/: Contains React components, including the main application component.
- App.tsx: The main component that manages the layout and routing of the application.
- hooks/: Contains custom hooks for reusable logic.
- index.ts: Defines custom hooks for use within components.
- styles/: Contains CSS files for styling the application.
- App.css: Styles for the main application component.
- types/: Contains TypeScript type definitions.
- index.ts: Defines interfaces and types for type safety.
- index.tsx: The entry point of the application that renders the React app to the DOM.
- react-app-env.d.ts: Defines environment settings for the React application.
- components/: Contains React components, including the main application component.
-
public/: Contains public assets and HTML templates.
- index.html: The HTML template for the application.
- manifest.json: The web app manifest that defines metadata and icons.
-
package.json: The npm configuration file that lists dependencies and scripts.
-
tsconfig.json: The TypeScript configuration file that specifies compiler options.
-
README.md: This documentation file that provides an overview and setup instructions for the project.
-
Clone the repository:
git clone <repository-url> -
Navigate to the project directory:
cd inc-lms -
Install dependencies:
npm install -
Start the development server:
npm start
Once the development server is running, you can access the application in your web browser at http://localhost:3000. You can explore the features of the learning management system and interact with the various components.
This LMS is built using Firebase Firestore as a NoSQL database. It supports three user roles: admin, instructor, and user, with role-based access control (RBAC). The system allows workspace-based management of learning materials and tracks user progress.
- Create workspaces and invite the initial instructor
- Manage all workspaces and their users
- Change user roles within a workspace
- Invite other admin users
- Manage learning URLs (create, update, delete)
- View all learning records across workspaces
- Invite and remove user members from their workspace
- Change user roles within their workspace
- View all learning records within their workspace
- Access learning URLs
- View their own learning records
- Access learning URLs
- View their own learning records
- Create and manage workspaces
- Invite instructors to workspaces
- Manage all users and their roles
- Manage learning URLs accessible to workspaces
- View all users and learning progress data across workspaces
- Invite additional admin users
- Manage users in their workspace (invite/remove users, change roles)
- View learning records of workspace users
- Access learning URLs and track their own progress
- Access assigned learning URLs
- View their own learning progress
Firestore uses a collection-document structure. The main collections are as follows:
Path: /users/{userId}
{
"id": "user123",
"name": "Taro Yamada",
"email": "[email protected]",
"isAdmin": true,
"workspaces": [
{ "workspaceId": "workspaceA", "role": "instructor" },
{ "workspaceId": "workspaceB", "role": "user" }
]
}Stores user information. isAdmin: Boolean flag indicating whether the user is an admin. workspaces: List of workspaces the user belongs to, along with their role in each workspace.
Path: /workspaces/{workspaceId}
{
"id": "workspaceA",
"name": "AI Bootcamp",
"createdBy": "admin123"
}Stores workspace information. createdBy: Admin who created the workspace.
Path: /learningUrls/{workspaceId}_{urlId}
{
"id": "url456",
"category": "AI",
"title": "AI Bootcamp",
"description": "Learn the basics of AI",
"url": "https://example.com/learning-course",
"createdBy": "admin123"
}Stores learning URLs for each workspace.
Path: /learningRecords/{userId}_{urlId}
{
"userId": "user123",
"workspaceId": "workspaceA",
"urlId": "url456",
"status": "completed" | "in progress",
"timestamp": "2025-02-27T12:00:00Z"
}Tracks learning progress for each user.
These rules enforce access control based on user roles.
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// User Data
match /users/{userId} {
allow read, update: if request.auth.uid == userId;
}
// Workspace Management
match /workspaces/{workspaceId} {
allow read: if request.auth != null;
allow write: if request.auth.token.isAdmin == true;
}
// Learning URLs
match /learningUrls/{workspaceId}_{urlId} {
allow read: if request.auth != null;
allow write: if request.auth.token.isAdmin == true;
}
// Learning Records
match /learningRecords/{userId}_{urlId} {
allow read, write: if request.auth.uid == userId ||
request.auth.token.workspaces[workspaceId].role == "instructor";
}
}
}
- Ensure Firebase Authentication is enabled for user authentication.
- Use Firestore indexes for optimized querying.
- Configure Firebase Hosting for serving the front-end.
This README provides an overview of the system requirements, Firestore database structure, and security rules. Modify as needed for additional business logic or features.
Contributions are welcome! Please feel free to submit a pull request or open an issue for any suggestions or improvements.
This project is licensed under the MIT License. See the LICENSE file for more details.