Thank you for your interest in contributing to StackIt! This document provides a comprehensive guide to help you get started with contributing to our Q&A platform.
We welcome contributions from the community! Whether you're fixing bugs, adding new features, improving documentation, or suggesting ideas, your contributions help make StackIt better for everyone.
- 🐛 Bug Fixes: Help us squash bugs and improve stability
- ✨ New Features: Add exciting new functionality to the platform
- 📚 Documentation: Improve our docs, README, or add helpful comments
- 🎨 UI/UX Improvements: Enhance the user interface and experience
- 🧪 Testing: Add tests or improve test coverage
- 🔧 Code Quality: Refactor code, improve performance, or fix linting issues
- 🌐 Localization: Help translate the platform to other languages
- 📊 Analytics: Improve our data tracking and insights
Before you begin, make sure you have the following installed:
- Node.js 18+ - Download here
- PostgreSQL - Download here
- Git - Download here
- pnpm (recommended) or npm - Install pnpm
- Navigate to the StackIt repository on GitHub
- Click the "Fork" button in the top-right corner
- Wait for the forking process to complete
- Clone your forked repository to your local machine:
git clone https://github.com/YOUR_USERNAME/StackIt.git
cd StackIt- Install dependencies:
pnpm install- Set up environment variables:
Create a
.env.localfile in the root directory:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/stackit"
# Authentication
AUTH_SECRET="your-secret-key"
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
# NextAuth
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-nextauth-secret"- Set up the database:
# Generate Prisma client
pnpm prisma generate
# Run database migrations
pnpm prisma db push- Start the development server:
pnpm dev- Verify everything is working:
- Open http://localhost:3000
- Make sure the application loads without errors
- Test basic functionality like signing up and creating a question
Never work directly on the main branch! Always create a new branch for your changes:
# Make sure you're on the main branch and it's up to date
git checkout main
git pull origin main
# Create and switch to a new feature branch
git checkout -b feature/your-feature-nameBranch Naming Conventions:
feature/descriptive-feature-name- For new featuresfix/descriptive-bug-fix- For bug fixesdocs/description- For documentation changesrefactor/description- For code refactoringtest/description- For adding or improving testsstyle/description- For code style changes
Examples:
git checkout -b feature/user-notification-system
git checkout -b fix/answer-voting-bug
git checkout -b docs/update-contribution-guide
git checkout -b refactor/optimize-database-queries- Write your code following our coding standards (see below)
- Test your changes thoroughly
- Update documentation if necessary
- Run linting to ensure code quality:
pnpm lintUse clear, descriptive commit messages:
# Stage your changes
git add .
# Commit with a descriptive message
git commit -m "feat: add user notification system
- Implement real-time notifications for mentions
- Add notification preferences in user settings
- Create notification dropdown component
- Add tests for notification functionality
Closes #123"Commit Message Format:
<type>(<scope>): <description>
[optional body]
[optional footer]
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
git push origin feature/your-feature-name- Go to your forked repository on GitHub
- Click "Compare & pull request" for your feature branch
- Fill out the pull request template with:
- Title: Clear description of your changes
- Description: Detailed explanation of what you've done
- Type: Bug fix, feature, documentation, etc.
- Testing: How you tested your changes
- Screenshots: If applicable (UI changes)
Example Pull Request Title:
feat: Add user notification system for mentions and answers
-
Ensure your code follows our standards:
- Run
pnpm lintand fix any issues - Follow TypeScript best practices
- Use proper error handling
- Add appropriate comments for complex logic
- Run
-
Test thoroughly:
- Test your changes in different scenarios
- Ensure no existing functionality is broken
- Test on different browsers if it's a frontend change
-
Update documentation:
- Update README if you've added new features
- Add JSDoc comments for new functions
- Update API documentation if you've modified endpoints
-
Check the checklist:
- Code follows project style guidelines
- Changes are tested thoroughly
- Documentation is updated
- No new warnings are generated
- Tests are added/updated
- All tests pass
-
Automated Checks: Your PR will be automatically checked for:
- Code linting
- TypeScript compilation
- Test suite execution
- Build success
-
Code Review: Team members will review your code for:
- Code quality and best practices
- Security considerations
- Performance implications
- User experience impact
-
Feedback: You may receive feedback requesting changes:
- Address all feedback promptly
- Make requested changes in the same branch
- Push updates to the same PR
-
Approval: Once approved, your PR will be merged to the
devbranch
We use ESLint and Prettier for code formatting. Run these commands:
# Check for linting issues
pnpm lint
# Fix auto-fixable issues
pnpm lint --fix- Use strict TypeScript configuration
- Define proper types for all functions and variables
- Avoid
anytype - use proper typing - Use interfaces for object shapes
- Use enums for constants
- Use functional components with hooks
- Follow the existing component structure
- Use TypeScript for all components
- Implement proper error boundaries
- Use proper accessibility attributes
- Use Prisma migrations for schema changes
- Follow naming conventions for tables and fields
- Add proper indexes for performance
- Use transactions for complex operations
- Validate data at the API level
- Use RESTful conventions
- Implement proper error handling
- Add input validation
- Use appropriate HTTP status codes
- Add rate limiting where necessary
# Run all tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Run tests with coverage
pnpm test:coverage- Write tests for new features
- Update tests when fixing bugs
- Aim for good test coverage
- Use descriptive test names
- Test both success and error cases
When reporting bugs, please include:
- Clear description of the bug
- Steps to reproduce the issue
- Expected behavior vs actual behavior
- Screenshots if applicable
- Environment details (browser, OS, etc.)
- Console errors if any
When suggesting new features:
- Clear description of the feature
- Use case and benefits
- Implementation suggestions if possible
- Mockups or wireframes if applicable
Contributors will be recognized in:
- README.md - Contributors section
- Release notes - For significant contributions
- GitHub profile - Through the contributors graph
Thank you for contributing to StackIt! Your efforts help make this platform better for everyone in the community. 🚀
Happy Coding! 💻