Thank you for your interest in contributing to FPL Insights! This document provides guidelines and information for contributors.
- Node.js 20+
- npm 10+
- Git
-
Fork and clone the repository:
git clone https://github.com/<your-username>/fpl.git cd fpl
-
Install dependencies:
npm install
-
Copy environment variables:
cp .env.example .env.local
-
Start the development server:
npm run dev
For local development, you may need:
ANTHROPIC_API_KEY- (Optional) For AI featuresDATABASE_PATH- (Optional) SQLite database path, defaults to./data/fpl.db
The app works without any environment variables for basic functionality. AI features require an Anthropic API key.
- Use strict mode (enabled in
tsconfig.json) - Prefer explicit types over
any - Use interfaces for object shapes
- Use type guards for runtime validation
- Use functional components with hooks
- Named exports for components (one per file)
- PascalCase for component filenames
- Keep components focused and composable
- Tailwind CSS utility classes
- Custom colors via CSS variables (
--fpl-purple,--fpl-green, etc.) - Dark theme only (no light mode toggle)
- Mobile-first responsive design
- Use
@/path alias for imports - Group imports: external packages, internal modules, relative imports
- Sort alphabetically within groups
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage- Place tests in
__tests__/directories adjacent to source files - Use descriptive test names:
it("returns empty array when no fixtures match") - Use mock factories for FPL data (see existing tests for examples)
- Aim for high coverage of utility functions and business logic
import { describe, it, expect, vi } from "vitest";
describe("functionName", () => {
it("describes expected behavior", () => {
// Arrange
const input = { ... };
// Act
const result = functionName(input);
// Assert
expect(result).toEqual(expected);
});
});main- Production-ready code- Feature branches:
feature/short-description - Bug fixes:
fix/short-description - Docs:
docs/short-description
Follow Conventional Commits:
<type>(<scope>): <description>
[optional body]
[optional footer]
Types:
feat- New featurefix- Bug fixdocs- Documentation onlystyle- Code style (formatting, semicolons, etc.)refactor- Code change that neither fixes a bug nor adds a featureperf- Performance improvementtest- Adding or updating testschore- Maintenance tasks
Examples:
feat(captain): add expected points breakdown
fix(live): correct bonus points calculation
docs: update API documentation
test(transfers): add tests for price model
The project uses Husky and lint-staged. On every commit:
- ESLint runs on staged
.tsand.tsxfiles - Prettier formats staged files
- All tests run
If any step fails, the commit is aborted. Fix the issues and try again.
- Ensure your code follows the style guidelines
- Write or update tests as needed
- Update documentation if applicable
- Run the full test suite:
npm test - Run the linter:
npm run lint - Ensure the build passes:
npm run build
- Create a descriptive title (under 70 characters)
- Fill out the PR template with:
- Summary of changes
- Related issue number(s)
- Test plan
- Keep PRs focused - one feature or fix per PR
- Request review from maintainers
- At least one approval required before merge
- Address all review comments
- Keep discussion constructive and focused
- Squash commits when merging
See the CLAUDE.md file for detailed project structure and architecture documentation.
- Open an issue for bugs or feature requests
- Check existing issues before creating new ones
- Provide reproduction steps for bugs
- Include relevant error messages and screenshots
By contributing, you agree that your contributions will be licensed under the same license as the project.