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
- Fork the repository to your own space
- Create a branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push:
git push origin feature/amazing-feature - 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.Errorfto 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
useSearchParamson pages, wrap with<Suspense>
Commit Messages
Format: type(scope): description
| type | Description |
|---|---|
feat | New features |
fix | Bug fixes |
docs | Documentation changes |
style | Code format (does not affect functionality) |
refactor | Refactoring |
test | Test related |
chore | Build/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.