Skip to content

Commit d48981a

Browse files
committed
Updated docs
1 parent 948250d commit d48981a

File tree

5 files changed

+937
-0
lines changed

5 files changed

+937
-0
lines changed

CONTRIBUTING.md

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# Contributing to Gitea Mirror
2+
3+
Thank you for your interest in contributing to Gitea Mirror! This document provides guidelines and instructions for contributing to the open-source version of the project.
4+
5+
## 🎯 Project Overview
6+
7+
Gitea Mirror is an open-source, self-hosted solution for mirroring GitHub repositories to Gitea instances. This guide provides everything you need to know about contributing to the project.
8+
9+
## 🚀 Getting Started
10+
11+
1. Fork the repository
12+
2. Clone your fork:
13+
```bash
14+
git clone https://github.com/yourusername/gitea-mirror.git
15+
cd gitea-mirror
16+
```
17+
18+
3. Install dependencies:
19+
```bash
20+
bun install
21+
```
22+
23+
4. Set up your environment:
24+
```bash
25+
cp .env.example .env
26+
# Edit .env with your configuration
27+
```
28+
29+
5. Start development:
30+
```bash
31+
bun run dev
32+
```
33+
34+
## 🛠 Development Workflow
35+
36+
### Running the Application
37+
38+
```bash
39+
# Development mode
40+
bun run dev
41+
42+
# Build for production
43+
bun run build
44+
45+
# Run tests
46+
bun test
47+
```
48+
49+
### Database Management
50+
51+
```bash
52+
# Initialize database
53+
bun run init-db
54+
55+
# Reset database
56+
bun run cleanup-db && bun run init-db
57+
```
58+
59+
## 📝 Code Guidelines
60+
61+
### General Principles
62+
63+
1. **Keep it Simple**: Gitea Mirror should remain easy to self-host
64+
2. **Focus on Core Features**: Prioritize repository mirroring and synchronization
65+
3. **Database**: Use SQLite for simplicity and portability
66+
4. **Dependencies**: Minimize external dependencies for easier deployment
67+
68+
### Code Style
69+
70+
- Use TypeScript for all new code
71+
- Follow the existing code formatting (Prettier is configured)
72+
- Write meaningful commit messages
73+
- Add tests for new features
74+
75+
### Scope of Contributions
76+
77+
This project focuses on personal/small team use cases. Please keep contributions aligned with:
78+
- Core mirroring functionality
79+
- Self-hosted simplicity
80+
- Minimal external dependencies
81+
- SQLite as the database
82+
- Single-instance deployments
83+
84+
## 🐛 Reporting Issues
85+
86+
1. Check existing issues first
87+
2. Use issue templates when available
88+
3. Provide clear reproduction steps
89+
4. Include relevant logs and screenshots
90+
91+
## 🎯 Pull Request Process
92+
93+
1. Create a feature branch:
94+
```bash
95+
git checkout -b feature/your-feature-name
96+
```
97+
98+
2. Make your changes following the code guidelines
99+
100+
3. Test your changes:
101+
```bash
102+
# Run tests
103+
bun test
104+
105+
# Build and check
106+
bun run build:oss
107+
```
108+
109+
4. Commit your changes:
110+
```bash
111+
git commit -m "feat: add new feature"
112+
```
113+
114+
5. Push to your fork and create a Pull Request
115+
116+
### PR Requirements
117+
118+
- Clear description of changes
119+
- Tests for new functionality
120+
- Documentation updates if needed
121+
- No breaking changes without discussion
122+
- Passes all CI checks
123+
124+
## 🏗 Architecture Overview
125+
126+
```
127+
src/
128+
├── components/ # React components
129+
├── lib/ # Core utilities
130+
│ ├── db/ # Database queries (SQLite only)
131+
│ ├── github/ # GitHub API integration
132+
│ ├── gitea/ # Gitea API integration
133+
│ └── utils/ # Helper functions
134+
├── pages/ # Astro pages
135+
│ └── api/ # API endpoints
136+
└── types/ # TypeScript types
137+
```
138+
139+
## 🧪 Testing
140+
141+
```bash
142+
# Run all tests
143+
bun test
144+
145+
# Run tests in watch mode
146+
bun test:watch
147+
148+
# Run with coverage
149+
bun test:coverage
150+
```
151+
152+
## 📚 Documentation
153+
154+
- Update README.md for user-facing changes
155+
- Add JSDoc comments for new functions
156+
- Update .env.example for new environment variables
157+
158+
## 💡 Feature Requests
159+
160+
We welcome feature requests! When proposing new features, please consider:
161+
- Does it enhance the core mirroring functionality?
162+
- Will it benefit self-hosted users?
163+
- Can it be implemented without complex external dependencies?
164+
- Does it maintain the project's simplicity?
165+
166+
## 🤝 Community
167+
168+
- Be respectful and constructive
169+
- Help others in issues and discussions
170+
- Share your use cases and feedback
171+
172+
## 📄 License
173+
174+
By contributing, you agree that your contributions will be licensed under the same license as the project (MIT).
175+
176+
## Questions?
177+
178+
Feel free to open an issue for any questions about contributing!
179+
180+
---
181+
182+
Thank you for helping make Gitea Mirror better! 🎉

docs/BUILD_GUIDE.md

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
# Build Guide
2+
3+
This guide covers building the open-source version of Gitea Mirror.
4+
5+
## Prerequisites
6+
7+
- **Bun** >= 1.2.9 (primary runtime)
8+
- **Node.js** >= 20 (for compatibility)
9+
- **Git**
10+
11+
## Quick Start
12+
13+
```bash
14+
# Clone repository
15+
git clone https://github.com/yourusername/gitea-mirror.git
16+
cd gitea-mirror
17+
18+
# Install dependencies
19+
bun install
20+
21+
# Initialize database
22+
bun run init-db
23+
24+
# Build for production
25+
bun run build
26+
27+
# Start the application
28+
bun run start
29+
```
30+
31+
## Build Commands
32+
33+
| Command | Description |
34+
|---------|-------------|
35+
| `bun run build` | Production build |
36+
| `bun run dev` | Development server |
37+
| `bun run preview` | Preview production build |
38+
| `bun test` | Run tests |
39+
| `bun run cleanup-db` | Remove database files |
40+
41+
## Build Output
42+
43+
The build creates:
44+
- `dist/` - Production-ready server files
45+
- `.astro/` - Build cache (git-ignored)
46+
- `data/` - SQLite database location
47+
48+
## Development Build
49+
50+
For active development with hot reload:
51+
52+
```bash
53+
bun run dev
54+
```
55+
56+
Access the application at http://localhost:4321
57+
58+
## Production Build
59+
60+
```bash
61+
# Build
62+
bun run build
63+
64+
# Test the build
65+
bun run preview
66+
67+
# Run in production
68+
bun run start
69+
```
70+
71+
## Docker Build
72+
73+
```dockerfile
74+
# Build Docker image
75+
docker build -t gitea-mirror:latest .
76+
77+
# Run container
78+
docker run -p 3000:3000 gitea-mirror:latest
79+
```
80+
81+
## Environment Variables
82+
83+
Create a `.env` file:
84+
85+
```env
86+
# Database
87+
DATABASE_PATH=./data/gitea-mirror.db
88+
89+
# Authentication
90+
JWT_SECRET=your-secret-here
91+
92+
# GitHub Configuration
93+
GITHUB_TOKEN=ghp_...
94+
GITHUB_WEBHOOK_SECRET=...
95+
96+
# Gitea Configuration
97+
GITEA_URL=https://your-gitea.com
98+
GITEA_TOKEN=...
99+
```
100+
101+
## Common Build Issues
102+
103+
### Missing Dependencies
104+
105+
```bash
106+
# Solution
107+
bun install
108+
```
109+
110+
### Database Not Initialized
111+
112+
```bash
113+
# Solution
114+
bun run init-db
115+
```
116+
117+
### Port Already in Use
118+
119+
```bash
120+
# Change port
121+
PORT=3001 bun run dev
122+
```
123+
124+
### Build Cache Issues
125+
126+
```bash
127+
# Clear cache
128+
rm -rf .astro/ dist/
129+
bun run build
130+
```
131+
132+
## Build Optimization
133+
134+
### Development Speed
135+
136+
- Use `bun run dev` for hot reload
137+
- Skip type checking during rapid development
138+
- Keep `.astro/` cache between builds
139+
140+
### Production Optimization
141+
142+
- Minification enabled automatically
143+
- Tree shaking removes unused code
144+
- Image optimization with Sharp
145+
146+
## Validation
147+
148+
After building, verify:
149+
150+
```bash
151+
# Check build output
152+
ls -la dist/
153+
154+
# Test server starts
155+
bun run start
156+
157+
# Check health endpoint
158+
curl http://localhost:3000/api/health
159+
```
160+
161+
## CI/CD Build
162+
163+
Example GitHub Actions workflow:
164+
165+
```yaml
166+
name: Build and Test
167+
on: [push, pull_request]
168+
169+
jobs:
170+
build:
171+
runs-on: ubuntu-latest
172+
steps:
173+
- uses: actions/checkout@v4
174+
- uses: oven-sh/setup-bun@v2
175+
- run: bun install
176+
- run: bun run build
177+
- run: bun test
178+
```
179+
180+
## Troubleshooting
181+
182+
### Build Fails
183+
184+
1. Check Bun version: `bun --version`
185+
2. Clear dependencies: `rm -rf node_modules && bun install`
186+
3. Check for syntax errors: `bunx tsc --noEmit`
187+
188+
### Runtime Errors
189+
190+
1. Check environment variables
191+
2. Verify database exists
192+
3. Check file permissions
193+
194+
## Performance
195+
196+
Expected build times:
197+
- Clean build: ~5-10 seconds
198+
- Incremental build: ~2-5 seconds
199+
- Development startup: ~1-2 seconds
200+
201+
## Next Steps
202+
203+
- Configure with [Configuration Guide](./CONFIGURATION.md)
204+
- Deploy with [Deployment Guide](./DEPLOYMENT.md)
205+
- Set up authentication with [SSO Guide](./SSO-OIDC-SETUP.md)

0 commit comments

Comments
 (0)