Contributing to PocketMocker
December 5, 2025 · View on GitHub
First off, thank you for considering contributing to PocketMocker! It's people like you that make PocketMocker such a great tool.
Development Setup
-
Fork and Clone the repository:
git clone https://github.com/YOUR_USERNAME/pocket-mocker.git cd pocket-mocker -
Install Dependencies:
npm install -
Start Development Server:
npm run devThis will start the Vite development server with a demo page where you can test your changes.
Project Structure
The project codebase is organized as follows:
src/
├── core/ # Core Logic (The Brain)
│ ├── adapters/ # Interceptors for fetch/XHR
│ ├── engine/ # Request matching, handling, and smart mock generation
│ ├── manager/ # Rule state management
│ ├── importers/ # Logic for importing Postman/OpenAPI configs
│ └── utils/ # Shared utilities
├── lib/ # UI Components (Svelte)
│ ├── components/ # Domain-specific components
│ │ ├── layout/ # Header, Tabs, Container
│ │ ├── rules/ # Rule list, editor, filters
│ │ └── network/ # Network log panel
│ ├── stores/ # UI state management (dashboard-store)
│ └── ui/ # Reusable base components (Button, Input, etc.)
├── store/ # Global Business State (Rules, Logs)
├── plugin/ # Vite Plugin source code
└── test/ # Unit and Integration Tests
Testing
We use Vitest for testing. Please ensure all tests pass before submitting your PR.
# Run all tests
npm run test
# Run tests in watch mode
npm run test -- --watch
If you add new features, please add corresponding test cases in the test/ directory.
Commit Guidelines
We follow the Conventional Commits specification.
feat: A new featurefix: A bug fixdocs: Documentation only changesstyle: Changes that do not affect the meaning of the code (white-space, formatting, etc)refactor: A code change that neither fixes a bug nor adds a featureperf: A code change that improves performancetest: Adding missing tests or correcting existing testschore: Changes to the build process or auxiliary tools
Example: feat(core): add support for graphQL mocking
Pull Request Process
- Create a new branch from
main:git checkout -b feat/my-new-feature. - Make your changes and commit them following the guidelines above.
- Run tests to ensure no regressions:
npm run test. - Push your branch:
git push origin feat/my-new-feature. - Open a Pull Request on GitHub.
- Provide a clear description of your changes and link any relevant issues.
Thank you for your contribution!