First off, thank you for taking the time to contribute! Contributions are what make the open-source community such an amazing place to learn, inspire, and create.
Join our Discord Server to connect with the maintainers and other contributors!
All types of contributions are welcome:
- 🐛 Reporting & Fixing Bugs
- 📝 Improving Documentation
- 💡 Proposing & Implementing Features
- 🧪 Adding Examples or Test Coverage
SmoothAPI is a dual-language API resilience and fault-tolerance library. The workspace is organized as follows:
smooth-api/
├── examples/ # Broswer based examples for SmoothAPI
├── packages/
│ ├── smooth-api-ts/ # TypeScript package (@codingaryan/smoothapi)
│ └── smooth-api-py/ # Python package (smoothapi-py)
├── sandbox/ # Express-based chaos server (used by integration tests)
├── website/ # Documentation wesbsite
├── README.md # Project overview
└── CONTRIBUTING.md # You are here!
To develop locally, you will need:
- Node.js (v18 or higher)
- npm (v9 or higher)
- Python (v3.10 or higher)
- pip
Both the TypeScript and Python integration tests rely on a local Express server running in the background to simulate transient API failures, circuit breaker states, and timeouts.
Before running any tests, start the sandbox:
# Navigate to the sandbox directory
cd sandbox
# Install dependencies
npm install
# Start the chaos server
node server.jsThe server runs on http://localhost:3001 and provides /health, /chaos, and other endpoints. Keep this terminal open.
-
Install dependencies:
cd packages/smooth-api-ts npm install -
Build the project: To compile the TypeScript source files to the
distdirectory:npm run build
-
Watch mode: To automatically recompile files when changes are saved:
npm run build:watch
-
Run tests: Make sure the Sandbox Server is running first, then execute:
npm testThis compiles the test files and runs the suite using Node's native test runner.
-
Set up a virtual environment (recommended):
cd packages/smooth-api-py python -m venv .venv # Activate virtualenv (Windows) .venv\Scripts\activate # Activate virtualenv (macOS/Linux) source .venv/bin/activate
-
Install package in editable mode with dev tools:
pip install -e ".[dev]" -
Run tests: Make sure the Sandbox Server is running first, then execute:
pytest tests/ -v
To keep the repository clean, please adhere to these guidelines:
- Zero Dependencies: Keep the packages lightweight. Do not add external runtime dependencies unless absolutely necessary and approved by maintainers.
- Dual Language Alignment: When adding configuration options or features, try to maintain parity between the TypeScript and Python implementations so that their API shapes and features stay equivalent.
- Clean Code: Follow the Single Responsibility Principle, keep functions small, use descriptive naming, and prefer code clarity over excessive comments.
- No changes should be merged without accompanying tests.
- Ensure all tests pass locally for both Python and TypeScript before submitting a PR.
- Add regression tests if you are fixing a bug, and feature tests if you are adding capabilities.
We encourage semantic/structured commit messages to help automate release notes and versioning:
feat: <description>(new feature for the user)fix: <description>(bug fix for the user)docs: <description>(changes to documentation)style: <description>(formatting, missing semi colons, etc; no production code change)refactor: <description>(refactoring production code, eg. renaming a variable)test: <description>(adding missing tests, refactoring tests)chore: <description>(updating dev tasks, package dependencies, etc)
- Create a new branch from
main(e.g.,feature/timeout-supportorbugfix/retry-jitter). - Make your changes in the codebase.
- Verify that your changes compile successfully and all linting/types check out.
- Run the full test suite with the local sandbox running.
- Update documentation if you are changing or introducing features.
- Open a Pull Request pointing to the
mainbranch. Provide a clear description of the problem solved, changes made, and proof of testing.