Thank you for your interest in contributing! This guide helps you set up a local environment, understand the workflow, and submit high‑quality changes.
Be respectful and constructive. We aim for an inclusive, collaborative environment.
DocPort.io is an API‑first backend in Go for managing technical documentation tied to physical equipment via QR codes. Learn more at https://docport.io and see the top‑level README for architecture and usage.
- Go 1.21+
git clone https://github.com/docport-io/app.git
cd app
cp config.example.toml config.toml
go mod download
go run ./cmd/app
- Adjust config.toml as needed (server bind/port, database URL, storage provider)
- Override via env vars with DOCPORT_ prefix (dots become underscores), e.g. DOCPORT_SERVER_PORT=8080
- main is protected; create feature branches: feature/short-description, fix/short-description, chore/short-description
- Prefer Conventional Commits style:
- feat: add version tagging to file uploads
- fix: correct pagination defaults for files list
- chore: bump dependencies
- docs: update README with API paths
- Language: Go
- Style: go fmt/go vet; keep imports organized
- Errors: wrap with context when helpful; return typed errors from service layer when applicable
- HTTP: handlers live in pkg/controller; keep business logic in pkg/service
- DTOs: in pkg/dto; avoid leaking DB models to controllers
- SQL is defined in query.sql (and migrations under migrations/)
- Generated code lives in pkg/database via sqlc
- If you change SQL queries or schema:
- Update migrations in migrations/*.up.sql and *.down.sql (use next number)
- Run sqlc generate to refresh pkg/database
- Start the app to apply migrations automatically
- Default provider is filesystem. New providers should implement pkg/storage.FileStorage and be wired in pkg/app/storage.go
# run
go run ./cmd/app
# all tests
go test ./...
- Swagger is served at /swagger (host configured via server.host). Update specs in pkg/docs if you change routes.
- Avoid blocking calls in handlers; defer heavy I/O to services
- Use pagination for list endpoints; validate inputs
- Branch created from latest main and rebased
- Code formatted (go fmt), vet clean (go vet)
- Tests added/updated and passing (go test ./...)
- Migrations included (if schema changes) and sqlc generated
- README/CONTRIBUTING updated if behavior or setup changed
- Swagger docs updated if API changed
- Keep PRs scoped and < 400 lines when possible
- Provide context: what/why, screenshots for user‑visible changes
- Respond to review comments within 3 business days
- Use clear titles; include steps to reproduce, expected vs actual, logs if relevant
- Label appropriately (bug, enhancement, docs)
- Do not open public issues for vulnerabilities
- Report privately to the maintainers; request a security contact if not listed in repository settings
By contributing, you agree that your contributions will be licensed under the repository’s license.