This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Open Source Bazaar (开源市集) is an open-source project showcase platform built with Next.js 15, TypeScript, React Bootstrap, and MobX. The platform serves as a comprehensive hub for open-source collaboration, featuring license filtering tools, Wiki knowledge base integration, volunteer showcases, and GitHub repository management.
- License Filter Tool: Interactive multi-step license selection process with comprehensive i18n support
- Wiki Knowledge Base: Integration with GitHub ContentModel to access policy documents
- Volunteer Showcase: GitHub organization contributor displays with OSS Insight widgets
- Project Repository: GitHub repository listings and management
- Multi-language Support: Full i18n with Chinese (Simplified/Traditional) and English
- Lark Integration: Enterprise collaboration platform integration
- PWA Support: Progressive Web App capabilities
-
pages/- Next.js pages and API routesindex.tsx- Homepage with animated welcome contentlicense-filter.tsx- Interactive license selection toolpolicy/- Wiki/policy document pagesvolunteer.tsx- Contributor showcaseproject.tsx- GitHub repository listingsapi/- API routes for external integrations
-
components/- Reusable React components with Bootstrap stylingLayout/- Page layout components (PageHead, Navigation, Footer)Git/- GitHub-related componentsNavigator/- Navigation componentsPageContent/- Content display componentsLicense/- License filter components
-
models/- MobX stores and data modelsBase.ts- Core configuration and client setupRepository.ts- GitHub repository data modelsTranslation.ts- i18n translation modelsWiki.ts- Wiki content modelsSystem.ts- System configuration models
-
translation/- i18n language fileszh-CN.ts- Simplified Chinesezh-TW.ts- Traditional Chineseen-US.ts- English
-
styles/- CSS and styling files -
public/- Static assets and PWA manifest -
types/- TypeScript type definitions
package.json- Dependencies and scriptsnext.config.ts- Next.js configuration with MDX, PWA, and proxy rewritestsconfig.json- TypeScript configurationeslint.config.ts- ESLint configuration with spell checkingbabel.config.js- Babel configuration for decorators.github/copilot-instructions.md- Detailed development guidelines
- Next.js 15 - React framework with App Router
- TypeScript 5.9 - Type-safe JavaScript
- React 19.1 - UI library with hooks
- React Bootstrap 2.10 - UI component library
- MobX 6.13 - State management
- PNPM - Package manager
-
MobX Ecosystem:
mobx-github- GitHub API integrationmobx-i18n- Internationalizationmobx-restful- RESTful API clientmobx-restful-table- Data table componentsmobx-lark- Lark integrationmobx-react- React bindings
-
Content Processing:
@mdx-js/react- MDX supportmarked- Markdown processingyaml- YAML front-matter processing
-
Development Tools:
eslint- Code lintingprettier- Code formattinghusky- Git hookslint-staged- Pre-commit linting
-
Utilities:
web-utility- Web utility functionslicense-filter- License filtering logickoajax- HTTP clientidea-react- React utilities
- Check Node.js version:
node --version - Development and linting commands work on Node.js 20+
- Use PNPM as package manager, not NPM or Yarn
- Install global pnpm:
npm install -g pnpm - Install dependencies:
pnpm install-- takes 1-3 minutes. NEVER CANCEL - Verify setup:
pnpm --version(should be 10.x+)
Important: If you see "node_modules missing" error, you MUST run pnpm install first before any other commands.
# Development
pnpm dev # Start development server (5-15s) on http://localhost:3000
pnpm build # Production build (30s-2min)
pnpm start # Start production server
# Code Quality
pnpm lint # Run ESLint with auto-fix (15s)
pnpm test # Run tests (lint-staged + lint, 15s)
# Git Hooks
pnpm prepare # Install husky hooks- ALWAYS use React Bootstrap components instead of custom HTML elements
- Use utilities from established libraries: 'web-utility'
- Import
'./Base'in model files for proper configuration - Use semantic HTML structure:
<article>,<header>,<section>
// ✅ Correct - use React Bootstrap components
import { Button, Badge, Breadcrumb, Card, Container } from 'react-bootstrap';
// ✅ Correct - import from established sources
import { ContentModel } from 'mobx-github';
import { githubClient } from 'mobx-github';
import { treeFrom } from 'web-utility';
import './Base'; // For GitHub client setup
// ❌ Wrong - custom HTML elements
<a href={url} className="btn btn-outline-primary">Edit</a>
<span className="badge bg-secondary">{label}</span>- Natural error throwing for static generation - let errors bubble up to catch build issues
- Ensure build passes before pushing - resolve issues at compile time
- ALL user-facing text MUST be translated using i18n system
- Use the
t()function from I18nContext for all translations - This includes button text, labels, error messages, placeholder text, and dynamic content
// ✅ Correct - use translation function
<Button variant="outline-primary" size="sm">
{t('edit_on_github')}
</Button>
// ❌ Wrong - hardcoded text
<Button variant="outline-primary" size="sm">
Edit on GitHub
</Button>- Use generic terms unless specifically scoped:
t('knowledge_base')nott('policy_documents') - Add translation keys to ALL language files:
zh-CN.ts,en-US.ts,zh-TW.ts - Remove unused translation keys when replacing with generic ones
- Use ContentModel with configured client from mobx-github
- Import configuration via
'./Base'to ensure proper GitHub client setup - Handle Base64 content decoding when processing GitHub API responses
// ✅ Correct - use configured client
import { githubClient } from './models/Base';
// ❌ Wrong - create separate instances
const client = new GitHubClient();- GitHub API authentication is configured in
models/Base.ts - Use the configured client to avoid rate limiting and authentication issues
- Don't create separate GitHub API instances
- Use optional chaining and modern JavaScript features
- Let TypeScript infer types when possible to avoid verbose annotations
- Use modern ECMAScript patterns for cleaner, more maintainable code
- Import from established sources: ContentModel from mobx-github, utilities from web-utility
- Import configuration files where needed:
'./Base'for GitHub client setup - Use minimal exports and avoid unnecessary custom implementations
- Run linting:
pnpm lintto auto-fix formatting - Check build: Ensure
pnpm buildpasses - Validate translations: Verify all text is properly translated
- Remove unused code: Clean up unused imports and translation keys
After making ANY changes, ALWAYS validate by running through these scenarios:
- Start development server:
pnpm devand verify it starts without errors - Navigate to homepage: Visit http://localhost:3000 and verify page loads
- Test core pages:
- License filter: http://localhost:3000/license-filter
- Wiki pages: http://localhost:3000/policy
- Volunteer page: http://localhost:3000/volunteer
- Projects: http://localhost:3000/project
- Test API endpoints: Verify GitHub API integrations work
- Check responsive design: Test mobile/desktop layouts
- Verify i18n functionality: Check language switching works
- Uses GitHub ContentModel to access policy documents from
fpsig/open-source-policyrepository - Renders markdown content with front-matter metadata
- Supports hierarchical document structure with breadcrumb navigation
- Uses
treeFromutility from web-utility for hierarchical data structures
- Interactive multi-step license selection process
- Uses
license-filterpackage for license recommendation logic - Supports multiple languages with comprehensive i18n coverage
- Complex state management with MobX stores
- Displays GitHub organization contributors
- Integrates with OSS Insight widgets for contributor analytics
- Uses GitHub API for real-time contributor data
- Features contributor cards with activity metrics
The project includes proxy rewrites for external services:
- GitHub API and raw content
- Alibaba Geo Data services
- Lark API integration
- "Unsupported engine" warnings: Expected on Node.js <22, development still works
- Build hangs: Never cancel builds - they may take several minutes, set appropriate timeouts
- Missing dependencies: Always run
pnpm installfirst
- Custom HTML not working: Replace with React Bootstrap components
- Translation not showing: Ensure all text uses
t()function and keys exist in all language files - GitHub API errors: Verify you're using configured
githubClientfrommodels/Base.ts
- Base64 content errors: Use
atob(item.content)to decode GitHub API responses - Missing content: Check ContentModel configuration and repository access
- Tree structure problems: Use
treeFrom()utility from web-utility
- Clear browser cache if components don't render properly
- Restart development server after major configuration changes
- Verify all translation files are updated when adding new keys
- Project is configured for Vercel deployment
- Uses GitHub Actions for CI/CD pipeline
- PWA support enabled for offline functionality
NODE_ENV- Environment detectionCI- Continuous integration flagGithubToken- GitHub API authenticationAPI_Host- Backend API hostLARK_API_HOST- Lark API host
- Follow exact code suggestions from reviews when provided
- Use minimal approach - only include explicitly requested functionality
- Don't add extra features not specified in requirements
- Address reviewer feedback completely before requesting re-review
Checklist(清单):
- [ ] Labels
- [ ] Assignees
- [ ] Reviewers
Closes #XXXXX- All tests pass
- Code follows project conventions
- No linting errors
- Build succeeds
- Translations are complete
- Responsive design verified
- API integrations working
.github/copilot-instructions.md- Detailed development guidelinesREADME.md- Project overview and quick startpackage.json- Complete dependency list- Translation files - All supported languages and keys
- Next.js Documentation
- React Bootstrap Documentation
- MobX Documentation
- TypeScript Documentation
- PNPM Documentation
For project-specific questions, refer to the existing documentation and GitHub issues. For development guidance, follow the patterns and conventions established in the codebase and the detailed copilot instructions.