Thank you for your interest in contributing to LinguaChat! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Workflow
- Pull Request Process
- Coding Standards
- Testing Guidelines
- Documentation
This project adheres to a code of conduct that all contributors are expected to follow:
- Be respectful and inclusive
- Accept constructive criticism gracefully
- Focus on what is best for the community
- Show empathy towards other community members
- Node.js 18+ or Bun
- pnpm (recommended) or npm
- Git
- OpenAI API key
-
Fork the repository
# Click "Fork" on GitHub, then clone your fork git clone https://github.com/YOUR_USERNAME/AI-Language-Learning-App.git cd AI-Language-Learning-App
-
Install dependencies
pnpm install
-
Set up environment variables
cp .env.example .env.local # Edit .env.local and add your OpenAI API key -
Run the development server
pnpm dev
-
Verify everything works
- Open http://localhost:3000
- Test the chat functionality
- Check that corrections and vocabulary work
main- Production-ready codedevelop- Integration branch for featuresfeature/your-feature-name- Feature branchesfix/issue-description- Bug fix branches
Follow the Conventional Commits specification:
<type>(<scope>): <subject>
<body>
<footer>
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringperf: Performance improvementstest: Adding testschore: Build process or auxiliary tool changes
Examples:
feat(chat): add voice input support
fix(corrections): resolve duplicate correction entries
docs(readme): update installation instructions
-
Create a feature branch
git checkout -b feature/your-feature-name
-
Make your changes
- Write clean, readable code
- Follow the coding standards below
- Add comments for complex logic
-
Test your changes
pnpm lint # Run linter pnpm type-check # Check TypeScript types pnpm build # Verify production build works
-
Commit your changes
git add . git commit -m "feat(scope): description"
- Code follows the project's style guidelines
- Self-reviewed the code
- Commented complex code sections
- Updated documentation if needed
- All tests pass locally
- No new warnings or errors
- Tested on multiple browsers (Chrome, Firefox, Safari)
- Tested on mobile devices
-
Push your branch
git push origin feature/your-feature-name
-
Create Pull Request
- Go to the repository on GitHub
- Click "New Pull Request"
- Select your branch
- Fill out the PR template
- Link related issues
-
Code Review
- Wait for maintainer review
- Address any feedback
- Make requested changes
- Request re-review
-
Merge
- Once approved, a maintainer will merge your PR
- Delete your feature branch after merge
- Use TypeScript for all new code
- Enable strict mode
- Define proper types (avoid
any) - Use interfaces for object shapes
- Document complex types
Example:
interface Message {
id: string;
role: "user" | "assistant";
content: string;
timestamp: Date;
corrections?: Correction[];
}- Use functional components with hooks
- Prefer named exports over default exports
- Keep components small and focused
- Extract reusable logic into custom hooks
- Use TypeScript for prop types
Example:
interface ChatInputProps {
onSend: (message: string) => void;
disabled?: boolean;
}
export function ChatInput({ onSend, disabled = false }: ChatInputProps) {
// Component logic
}- Use Tailwind CSS utility classes
- Follow the design system in
app/globals.css - Use the
cn()utility for conditional classes - Maintain responsive design (mobile-first)
- Support dark mode with dark: prefix
Example:
<div className={cn(
"rounded-lg p-4",
"bg-white dark:bg-slate-900",
isActive && "ring-2 ring-primary"
)} />components/
├── ui/ # shadcn/ui components
├── chat/ # Chat-specific components
├── corrections/ # Corrections panel
└── vocabulary/ # Vocabulary components
lib/
├── utils.ts # Utility functions
├── store.ts # Zustand state
└── scenarios.ts # Scenario definitions
- Use Zustand for global state
- Use React state for local component state
- Persist important state to localStorage
- Clear sensitive data on logout
- Use Edge runtime when possible
- Implement proper error handling
- Validate all inputs
- Return appropriate status codes
- Add rate limiting for public endpoints
- Test all user flows
- Test with different languages
- Test with different difficulty levels
- Test on Chrome, Firefox, Safari
- Test on mobile (iOS and Android)
- Test dark mode
- Test with network throttling
- Test error states
- Test edge cases
- Chrome (latest 2 versions)
- Firefox (latest 2 versions)
- Safari (latest 2 versions)
- Edge (latest 2 versions)
- Mobile Safari (iOS 15+)
- Chrome Mobile (Android 10+)
/**
* Sanitizes user input to prevent XSS attacks
* @param message - The raw message from the user
* @returns Sanitized message safe for processing
*/
function sanitizeMessage(message: string): string {
// Remove HTML tags
const withoutHtml = message.replace(/<[^>]*>/g, "");
return withoutHtml.trim();
}When adding features, update:
README.md- If user-facingUSER_GUIDE.md- For end usersTASKS.md- Mark completed tasksCLAUDE.md- For AI development context
If you have questions:
- Check existing Issues
- Review Discussions
- Open a new issue with your question
Your contributions make LinguaChat better for everyone. We appreciate your time and effort!