Skip to main content

Contributing Guide

Welcome to contribute to iForge!

Development Environment

# Clone the repository
git clone https://gitee.com/iforge-go/iforge.git
cd iforge

# Start the backend
cd server
go run ./cmd/server

# Start the frontend (in a new terminal)
cd web
npm install
npm run dev

Environment Variables Configuration

The development environment typically requires the following environment variables:

# Backend (server/.env)
IFORGE_HOME=./data
IFORGE_HTTP_PORT=8081
IFORGE_SSH_PORT=2022
IFORGE_CORS_ORIGINS=*

# Frontend (web/.env.local)
NEXT_PUBLIC_API_BASE=http://localhost:8081/api/v1

For complete configuration instructions, see Configuration.

Contribution Process

  1. Fork the repository to your own space
  2. Create a branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push: git push origin feature/amazing-feature
  5. Create MR: Initiate a merge request on Gitee/GitHub

Code Standards

Backend (Go)

  • Follow Effective Go style
  • New API endpoints must be registered in the router
  • Data model changes must go through GORM AutoMigrate or SQL migration
  • Error handling uses fmt.Errorf to wrap context

Frontend (TypeScript / React)

  • Use TypeScript, avoid any
  • Use functional components + Hooks
  • UI uses Chakra UI component library
  • Internationalized text is called through t('key'), no hardcoded Chinese
  • When using useSearchParams on pages, wrap with <Suspense>

Commit Messages

Format: type(scope): description

typeDescription
featNew features
fixBug fixes
docsDocumentation changes
styleCode format (does not affect functionality)
refactorRefactoring
testTest related
choreBuild/tools/dependencies

Examples:

feat(repo): Support repository archiving feature
fix(migration): AutoMigrate runs before SQL migration
docs(api): Add SSH clone instructions

Testing

# Backend tests
cd server
go test ./...

# Frontend type checking
cd web
npx tsc --noEmit

License

Contributed code will follow the project's Apache License 2.0 + Additional Conditions license. Contributor code can be used for commercial purposes.