Thanks for contributing to Generic SQL API Framework.
This repository is focused on the backend API and database layer. Changes should keep HTTP handling, query construction, database access, and deployment concerns separated.
Read the project documentation first:
This helps avoid introducing changes that conflict with the current architecture.
The repository includes a prebuilt Windows PHP runtime.
Start the backend with:
start-windows.batThe startup script checks:
- PHP runtime
php.ini- Required runtime directories
- ODBC extension
- Database configuration
- Database connection
- API directory
- Available port
Create your local configuration:
database/config/database.json
Do not commit the real configuration file.
Example:
{
"provider": "sqlserver",
"driver": "auto",
"server": "localhost\\SQLEXPRESS",
"database": "TestDB",
"authentication": "windows",
"port": 1433
}For the complete configuration format, see:
Keep changes in the appropriate part of the project.
api/
HTTP entry point
database/
Database configuration and database-specific components
docs/
Project documentation
runtime/
Bundled runtime files
scripts/
Utility and startup-related scripts
The exact project structure may change as the framework grows.
Controllers and API entry points should handle HTTP-related responsibilities.
Avoid placing SQL generation directly inside the API entry point.
Query construction belongs to the query/repository layer.
Do not duplicate SQL-building logic across controllers.
Database connection and execution logic should remain in the database/query execution layer.
Avoid creating direct database connections inside individual controllers.
SQL Server-specific behavior should remain in the SQL Server/database layer where possible.
This makes future database providers easier to add.
When modifying the query builder, test existing functionality before adding new behavior.
At minimum, check the areas affected by the change:
SELECT
WHERE
JOIN
GROUP BY
HAVING
ORDER BY
Pagination
Functions
Aliases
Expressions
If a new JSON field is introduced, update:
docs/JSON-Request-Reference.md
docs/Query-Examples.md
When modifying SQL Server connectivity, test the relevant connection scenarios.
Where applicable, test:
- SQL Authentication
- Windows Authentication
- Automatic ODBC driver selection
- Explicit ODBC driver selection
- Named SQL Server instances
- Explicit SQL Server ports
- Encryption
- Trust Server Certificate
- Failed connections
Changes to:
runtime/windows/php/
can affect every Windows deployment.
Changes to:
start-windows.bat
should also be tested carefully.
Test at least:
PHP runtime missing
php.ini missing
ODBC missing
database.json missing
Database connection failed
Database connection successful
Port 8000 available
Port 8000 already in use
No available port
API starts successfully
Never commit secrets.
Do not commit:
database/config/database.json
when it contains real credentials.
Also do not commit:
.env
logs/
runtime/windows/php/opcache/
or other generated/local files.
Never add passwords, API keys, tokens, or production connection strings to source code.
The JSON request format is part of the public API contract.
Before changing it:
- Check the current query builder.
- Check validation logic.
- Check existing examples.
- Consider backward compatibility.
- Update the relevant documentation.
Do not document a field merely because it would be useful.
The implementation must support the documented request structure.
Keep documentation focused.
Each document has a specific purpose:
| File | Purpose |
|---|---|
docs/Introduction.md |
What the project is and what it does |
docs/Architecture.md |
How the backend is structured |
docs/API.md |
HTTP API usage |
docs/JSON-Request-Reference.md |
JSON request contract |
docs/Query-Examples.md |
Practical requests |
docs/Database-Configuration.md |
Database setup |
docs/Hosting.md |
Running and deploying the backend |
docs/Roadmap.md |
Future backend work |
CHANGELOG.md |
Released changes |
Avoid copying the same explanation into multiple files.
Instead, link to the document that owns the topic.
For a new backend feature:
Check:
Request
|
v
Controller
|
v
Validation
|
v
Repository / Query Builder
|
v
Execution
|
v
Database
Avoid shortcuts that mix responsibilities.
Make sure existing requests continue working.
If the feature changes the JSON request format, add a practical example.
Update only the documents affected by the change.
Add the change under the appropriate release or Unreleased section.
Keep commits short and focused.
Good examples:
feat: add update query support
feat: add transaction support
fix: handle SQL Server pagination correctly
fix: improve ODBC driver detection
docs: update database configuration
docs: document Windows runtime
Avoid vague messages such as:
update
changes
final
Use a separate branch for a feature or fix.
Examples:
feature/crud-support
feature/transaction-support
feature/api-authentication
fix/odbc-driver-detection
fix/pagination
docs/update-hosting
Keep unrelated changes out of the same branch.
A pull request should clearly explain:
Describe the actual implementation.
Explain the problem being solved.
Mention what was tested and the environment used.
Example:
Tested on:
- Windows 11
- Bundled PHP runtime
- PHP ODBC
- SQL Server Express
- ODBC Driver 18
When possible, test against a real SQL Server instance.
For query changes, test both successful and failure cases.
Example:
Valid request
|
v
Expected result
Invalid request
|
v
Expected validation error
Database failure
|
v
Expected database error
Do not hide database or query failures just to make a request appear successful.
Errors should:
- Be detected
- Be logged where appropriate
- Be returned through the API's error handling
- Avoid exposing sensitive database credentials
If a change is intended to improve performance, test the behavior before and after the change where possible.
Useful measurements include:
Execution time
Rows returned
Number of database operations
Avoid optimizing by bypassing validation or security checks.
Run through this checklist:
[ ] Feature works
[ ] Existing functionality still works
[ ] Error handling checked
[ ] Database behavior checked
[ ] No credentials committed
[ ] No generated files committed
[ ] Documentation updated
[ ] Changelog updated when required
[ ] Commit message describes the change
Include as much useful technical information as possible:
- Framework version
- Operating system
- PHP version
- SQL Server version
- ODBC driver version
- Request body
- Expected result
- Actual result
- Error message
- Relevant log information
Remove passwords and other sensitive information before sharing logs or configuration.
For a new feature, describe:
- The problem.
- The proposed behavior.
- The expected API/request format.
- Any database-specific requirements.
- Whether it changes the existing API contract.
Check the Roadmap before proposing functionality that may already be planned.
Contributions should remain relevant to the backend project.
This repository focuses on:
- API
- Query engine
- SQL generation
- Database connectivity
- Database execution
- Validation
- Metadata
- Logging
- Performance
- Security
- Deployment
Frontend UI, dashboards, charts, and report screens belong to consuming applications and should not be added to this repository.
By contributing to this project, you agree that your contributions will be licensed under the project's MIT License.