Thank you for your interest in contributing! This document provides guidelines and instructions for contributing to this project.
By participating in this project, you agree to:
- Be respectful and inclusive
- Welcome newcomers and help them learn
- Focus on constructive feedback
- Respect different viewpoints and experiences
- Check existing issues: Make sure the bug hasn't been reported already
- Create a new issue: Use the bug report template
- Provide details:
- Clear description of the bug
- Steps to reproduce
- Expected vs actual behavior
- Environment (OS, Node version, etc.)
- Screenshots (if applicable)
- Check existing issues: See if the feature has been suggested
- Create a new issue: Use the feature request template
- Provide details:
- Clear description of the feature
- Use case and motivation
- Potential implementation approach (if you have ideas)
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature-name - Make your changes:
- Follow the coding standards (see below)
- Write/update tests if applicable
- Update documentation if needed
- Commit your changes:
- Use clear, descriptive commit messages
- Follow the commit message format:
[TYPE] - Description - Types:
feat,fix,chore,refactor,docs,style
- Push to your fork:
git push origin feature/your-feature-name - Create a Pull Request:
- Provide a clear description
- Reference related issues
- Wait for review and feedback
- Node.js >= 25.0.0
- pnpm >= 10.0.0
- PostgreSQL
- Redis (optional)
-
Fork and clone:
git clone https://github.com/your-username/webdevstudios.git cd webdevstudios -
Install dependencies:
pnpm install
-
Setup environment variables:
- Copy
.env.exampleto.env(if exists) - Configure database, JWT, OAuth, etc.
- Copy
-
Setup database:
cd apps/api pnpm prisma:migrate pnpm prisma:generate pnpm prisma:seed -
Start development servers:
# From root pnpm dev
- Strict mode: Always enabled
- No
any: Useunknownif type is truly unknown - Type everything: Functions, variables, props
- Enums: Use enums for constants instead of strings
- Formatting: Prettier (auto-format on save)
- Linting: ESLint (must pass before commit)
- Imports: Sorted with simple-import-sort
- Comments: English only, JSDoc for public APIs
Imports MUST be sorted in this order:
- Side effects (
import '...') - Node built-ins (
import fs from 'node:fs') - External libraries (
import { ... } from '@nestjs/common') - Path aliases (
import { ... } from '@/common') - Relative imports (
import { ... } from './file')
- One export per file: Each file exports one main thing
- Co-location: Related files stay together
- Barrel exports: Use
index.tsfor re-exports when appropriate
- CQRS Pattern: MUST follow CQRS
- Controllers dispatch Commands/Queries only
- No business logic in controllers
- Module Structure: Follow existing module patterns
- Validation: Use class-validator for DTOs
- Error Handling: Use proper HTTP status codes
- Server Components First: Prefer Server Components
- Client Components: Only use
'use client'when necessary - Responsive Design: Mobile-first approach
- Accessibility: ARIA labels, keyboard navigation
- Image Optimization: Use Next.js Image component
# All tests
pnpm test
# Specific app
cd apps/web && pnpm test
cd apps/api && pnpm test- Unit tests: For utilities and business logic
- Integration tests: For API endpoints
- E2E tests: For critical user flows (if applicable)
- JSDoc: For public functions/classes
- Comments: For complex logic (English only)
- README: Update if adding new features
- English only: All markdown files and comments
- User-facing content: Vietnamese (for website content)
- Code: English (variable names, functions, etc.)
Format: [TYPE] - Description
Types:
feat: New featurefix: Bug fixchore: Maintenance tasksrefactor: Code refactoringdocs: Documentation changesstyle: Code style changes (formatting, etc.)
Examples:
[feat] - Add product review feature
[fix] - Fix cart quantity validation
[refactor] - Extract product API client
[docs] - Update API documentation
- Update documentation if needed
- Add tests if applicable
- Ensure all tests pass
- Run linting:
pnpm lint - Format code:
pnpm format - Update CHANGELOG (if exists)
- Request review from maintainers
- Maintainers will review your PR
- Address feedback and suggestions
- Keep discussions constructive
- Be patient - reviews may take time
- Open an issue: For questions or discussions
- Check documentation: See
docs/folder - Read existing code: Learn from examples
By contributing, you agree that your contributions will be licensed under the same license as the project (see LICENSE file).
Thank you for contributing! 🎉