A React-based template for creating student-facing curriculum workshop site with interactive exercises, quizzes, and content management.
First-time setup for a project that depends on nss-core:
- Create and set your NPM token (
NPM_TOKEN) as described here
-
Create environment variables: Create a
.env.localfile in the project root:VITE_LEARNING_PLATFORM_API=http://localhost:8000If authentication is enabled (see Configuration section), also add:
VITE_OAUTH_CLIENT_ID=your_oauth_client_id VITE_PROXY_DOMAIN=your_proxy_domain -
Install dependencies:
npm install
-
Start the development server:
npm run dev
The application will be available at http://localhost:5173/[course-name]/ where [course-name] is derived from your courseName configuration.
This repository serves as a template for creating new workshop curriculum sites. Here's how to get started:
Edit src/config.js to customize your course:
const config = {
oauthClientId: import.meta.env.VITE_OAUTH_CLIENT_ID,
proxyDomain: import.meta.env.VITE_PROXY_DOMAIN,
baseUrl: import.meta.env.BASE_URL,
learningPlatformApi: import.meta.env.VITE_LEARNING_PLATFORM_API,
courseName: "Your Course Name Here", // Change this
doAuth: false, // Set to true if you need authentication
};-
courseName(string): The display name of your course. Used as the HTML page title and throughout the application. Automatically converted to URL-friendly format (lowercase, spaces to hyphens). -
doAuth(boolean):true: Enables authentication features, requires OAuth environment variablesfalse: Disables authentication for simpler deployment
When you create a new repository from this template, GitHub copies all workflow files
(in .github/workflows/) but does not copy secrets or workflow permissions.
Follow these steps to get GitHub Actions fully working.
- Go to your repository on GitHub.
- Click the Actions tab (top navigation bar).
- If you see a yellow banner saying “Workflows aren’t being run on this fork/template yet,”
click “I understand my workflows, enable them.” - If you see “Enable GitHub Actions” — click it to activate workflows.
Your repo is now allowed to run GitHub Actions.
- Go to Settings → Actions → General
- Scroll to Workflow permissions
- Choose “Read and write permissions”
- Check ✅ “Allow GitHub Actions to create and approve pull requests”
Edit src/chapters/nav.js to define your course modules:
export const nav = [
{
id: "module-1", // Unique identifier for the module
title: "Module 1 Title",
description: "Brief description of what this module covers",
required: true, // Whether completion is required
},
{
id: "module-2",
title: "Module 2 Title",
description: "Another module description",
required: true,
},
]Edit src/chapters/index.jsx to define your course content. This file demonstrates two important import patterns:
Raw Imports (for content files):
// Use ?raw suffix for markdown content and code files that should be displayed as text
import pageContent from "./module_1/page_one.md?raw";
import exerciseCode from "./module_1/exercise_1.js?raw";
import solutionCode from "./module_1/solution_1.js?raw";Module Imports (for executable code):
// Import without ?raw for JavaScript modules that export functions/objects
import {tests as t1} from "./module_1/tests_1.js";
import {questions as q1} from "./module_1/questions_1.jsx";For each module, create a directory structure like:
src/chapters/
├── nav.js # Module navigation configuration
├── index.jsx # Chapter definitions and imports
└── your_module_name/
├── page_one.md # Markdown content (imported with ?raw)
├── page_two.md # Additional pages as needed
├── exercise_1.js # Starter code (imported with ?raw)
├── solution_1.js # Solution code (imported with ?raw)
├── tests_1.js # Test cases (imported as module)
└── questions_1.jsx # Quiz questions (imported as module)
Markdown Files (.md) - Course content:
- Import with
?rawsuffix - Contains lesson content, explanations, instructions
- Supports standard markdown syntax
Exercise Files (.js) - Starter code:
- Import with
?rawsuffix - Contains incomplete code for students to complete
- Displayed in the code editor
Solution Files (.js) - Complete solutions:
- Import with
?rawsuffix - Contains working solutions to exercises
- Used for validation and instructor reference
Test Files (.js) - Automated testing:
- Import as JavaScript modules (no
?raw) - Must export a
testsarray - Each test object should have
name,testfunction, andmessage
Question Files (.jsx) - Quiz questions:
- Import as JavaScript modules (no
?raw) - Must export a
questionsarray - Used with the Checkpoint component for quizzes
In src/chapters/index.jsx, define your chapters:
export const chapters = [
{
id: "unique-chapter-id",
title: "Chapter Title",
sectionId: "module-id", // Must match nav.js module id
previousChapterId: null, // or "previous-chapter-id"
content: markdownContent, // Imported markdown
exercise: {
starterCode: exerciseCode,
solution: solutionCode,
tests: testArray
},
quiz: {
component: () => <Checkpoint questions={questionArray}/>
}
}
]The template supports these environment variables:
Required:
VITE_LEARNING_PLATFORM_API: API endpoint for the learning platform
Optional (when doAuth: true):
VITE_OAUTH_CLIENT_ID: OAuth client ID for authenticationVITE_PROXY_DOMAIN: Domain for OAuth proxy
The course name in src/config.js automatically configures:
- Base path in
vite.config.js - GitHub Pages deployment paths
- Internal routing
Example: "Introduction to React" becomes /introduction-to-react/
Understanding when to use ?raw vs module imports:
- Markdown content files (
.md) - Code files that should be displayed as text
- Exercise starter code
- Solution code
- Any file where you want the raw text content
- JavaScript files that export functions or objects
- Test files that export test arrays
- Question files that export question arrays
- React components
- Any executable JavaScript code
src/chapters/example_module_1/
├── page_one.md # Lesson content
├── page_two.md # Additional content
├── exercise_1.js # Student starter code
├── solution_one.js # Complete solution
├── tests_1.js # Automated tests
└── questions_1.jsx # Quiz questions
- Fork/clone this template repository
- Update
src/config.jswith your course details - Modify
src/chapters/nav.jsto define your modules - Create content directories for each module
- Add content files (markdown, exercises, tests, quizzes)
- Update
src/chapters/index.jsxto import and configure your content - Test locally with
npm run dev - Deploy to your hosting platform
For questions about the NSS Core platform or this template, refer to the NSS Workshops Platform documentation.
This template is developed by Nashville Software School to provide free, accessible curriculum development tools for educators.