Contributing to DocShare¶
Thank you for your interest in contributing to DocShare! This document provides guidelines and information for contributors.
Getting Started¶
Prerequisites¶
- Docker and Docker Compose
- Go 1.24+ (for backend and CLI development)
- Node.js 20+ (for frontend development)
- Git
Development Setup¶
-
Fork the repository
-
Add the upstream remote
-
Start the development environment
This builds the backend and frontend from local source code. To rebuild after making changes:
- Create a feature branch
Development Guidelines¶
Code Style¶
Backend (Go)¶
- Follow standard Go formatting (
gofmt) - Use
golangci-lintfor linting - Write meaningful commit messages
- Add tests for new functionality
- Use meaningful variable and function names
Frontend (TypeScript/React)¶
- Follow ESLint configuration
- Use TypeScript for all new code
- Use meaningful component and variable names
- Follow React best practices
- Use shadcn/ui components when possible
Testing¶
API Tests¶
Web Tests¶
Commit Messages¶
Follow the Conventional Commits specification:
feat:for new featuresfix:for bug fixesdocs:for documentation changesstyle:for code style changes (formatting, etc.)refactor:for code refactoringtest:for adding or updating testschore:for maintenance tasks
Examples:
feat: add file sharing with groups
fix: resolve authentication token expiration
docs: update API documentation
Pull Request Process¶
-
Update your branch
-
Run tests
-
Create a pull request
- Use a descriptive title
- Reference any relevant issues
- Describe your changes
-
Add screenshots if applicable
-
Code Review
- Address review feedback promptly
- Keep the PR focused and small
- Respond to all comments
Reporting Issues¶
Bug Reports¶
When reporting a bug, please include:
- Description: Clear description of the issue
- Steps to Reproduce: Detailed steps to reproduce the issue
- Expected Behavior: What you expected to happen
- Actual Behavior: What actually happened
- Environment:
- OS and version
- Docker version
- Browser version (if applicable)
- Logs: Relevant error messages or logs
Feature Requests¶
When requesting a feature, please include:
- Use Case: Why you need this feature
- Proposed Solution: How you envision the feature working
- Alternatives Considered: Any alternative solutions you've thought about
Development Workflow¶
API Development¶
cd api
# Install dependencies
go mod download
# Run the server
go run cmd/server/main.go
# Run tests
go test ./...
# Run with live reload (using air)
air
Web Development¶
cd web
# Install dependencies
npm install
# Run development server
npm run dev
# Run tests
npm test
# Build for production
npm run build
CLI Development¶
The CLI is a standalone Go module in cli/ with its own go.mod. It has no shared code with the backend — it communicates with the server purely via the REST API.
Key directories:
- cmd/ — Cobra command definitions (one file per command)
- internal/api/ — HTTP client and API response types
- internal/config/ — Config file persistence (~/.config/docshare/)
- internal/output/ — Table formatting and JSON output
- internal/pathutil/ — Path-to-UUID resolution
Architecture Guidelines¶
Backend (Go)¶
- Use the existing project structure
- Follow clean architecture principles
- Add new handlers to
internal/handlers/ - Add new services to
internal/services/ - Add new models to
internal/models/
CLI (Go)¶
- Add new commands to
cli/cmd/(one file per command, register ininit()) - All commands should support
--jsonoutput via the globalflagJSONflag - Use
pathutil.Resolve()when accepting remote file paths from the user - Use
requireAuth()at the start of any command that needs authentication
Frontend (Next.js)¶
- Use the App Router
- Add new pages to
src/app/ - Add new components to
src/components/ - Use shadcn/ui components when possible
- Follow the existing state management pattern with Zustand
Security Considerations¶
- Never commit secrets or API keys
- Use environment variables for configuration
- Follow secure coding practices
- Report security vulnerabilities privately
Documentation¶
- Update relevant documentation when making changes
- Add inline comments for complex logic
- Update API documentation for endpoint changes
- Update README.md for user-facing changes
Release Process¶
Releases are automated through GitHub Actions:
- Create a new tag:
git tag v1.0.0 - Push the tag:
git push origin v1.0.0 - GitHub Actions will build and publish Docker images
- A GitHub release will be created automatically
Getting Help¶
- Check existing issues and documentation
- Ask questions in GitHub Discussions
- Join our community (link to be added)
Code of Conduct¶
Please be respectful and inclusive in all interactions. See CODE_OF_CONDUCT.md for details.
Thank you for contributing to DocShare! 🚀