Contributing Guidelines¶
Thank you for your interest in contributing to this portfolio and blog application! This guide will help you understand our development process and how to submit contributions effectively.
Code of Conduct¶
- Be respectful and inclusive
- Provide constructive feedback
- Focus on the code, not the person
- Help create a welcoming environment
Getting Started¶
- Fork the Repository: Create your own fork of the project
- Clone Your Fork:
git clone https://github.com/YOUR_USERNAME/portfolio.git - Create a Branch:
git checkout -b feature/your-feature-name - Set Up Development: Follow the Getting Started Guide
Development Workflow¶
1. Before Making Changes¶
- Ensure you're on the latest main branch
- Run tests to verify everything works:
pnpm test - Run linting to check code quality:
pnpm lint
2. Making Changes¶
Follow these principles:
- Make minimal changes: Only modify what's necessary
- Write clean code: Follow existing patterns and conventions
- Add tests: For new features or bug fixes
- Update documentation: If changing APIs or behavior
3. Code Standards¶
TypeScript¶
- Use TypeScript for all new code
- Avoid
anytypes - use proper type definitions - Use path aliases (
@/) instead of relative imports - Add JSDoc comments for complex functions
```typescript // Good import { db } from "@/server/db";
// Bad import { db } from "../../../server/db"; ```
React Components¶
- Use functional components
- Mark client components with
"use client"directive - Use Server Components by default
- Follow the single responsibility principle
```typescript "use client";
import { useState } from "react";
export function MyComponent() { const [state, setState] = useState(false); return
API Development¶
- All business logic goes through tRPC
- Use Zod for input validation
- Follow RESTful naming conventions
- Add proper error handling
typescript
export const myRouter = createTRPCRouter({
getItem: publicProcedure
.input(z.object({ id: z.string() }))
.query(async ({ input }) => {
// Implementation
}),
});
4. Testing¶
Write tests for:
- New features
- Bug fixes
- Critical business logic
- Complex components
Run tests before committing:
bash
pnpm test
5. Linting and Formatting¶
Before every commit:
```bash
Check linting¶
pnpm lint
Check formatting¶
pnpm format
Auto-fix formatting¶
pnpm format:fix ```
6. Commit Messages¶
Use clear, descriptive commit messages:
```bash
Good¶
git commit -m "Add user authentication to blog posts" git commit -m "Fix pagination bug in post listing"
Bad¶
git commit -m "updates" git commit -m "fix bug" ```
Follow this format:
```