Skip to main content

Backend Contribution Guidelines

The backend is a Go application under backend/.

Project Structure

Each domain package under internal/ follows a flat structure:

FilePurpose
service.goService interface + business logic
handler.goHTTP handlers
store.goData access layer
model.goDomain models and DTOs
constants.goPackage constants
error_constants.goError messages and codes
store_constants.goDB queries and table names
init.goPackage initialization and route registration

Key Rules

  • File naming: snake_case (e.g., error_constants.go)
  • Exports: Only export service interface and models used in service. Keep implementations, constants, queries unexported.
  • Logging: Use log package from internal/system. Avoid PII; use MaskString for sensitive data.

Mock Generation

After changing any interface, regenerate mocks:

make mockery
warning

CI has a verify-mocks job that will fail your build if mocks are out of sync with the interfaces.

Testing

PurposeCommand
Unit testsmake test_unit
Integration testsmake test_integration
Specific testmake test_integration RUN="TestName"
Specific packagemake test_integration PACKAGE="pkg/path"
All backend testsmake test
Thunder LogoThunder Logo

Work together seamlessly with secure your applications with ease.

Terms & Policy

Pages

HomeDocsAPIsSDKs
© WSO2 LLC. All rights reserved.