Skip to content

Commit c3638da

Browse files
committed
feat(add): initial backend migration
0 parents  commit c3638da

20 files changed

Lines changed: 3805 additions & 0 deletions

.env.example

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# FixFX Backend - Environment Configuration
2+
3+
# Server Configuration
4+
PORT=3001
5+
ENVIRONMENT=development
6+
7+
# GitHub API
8+
GITHUB_TOKEN=
9+
GITHUB_OWNER=gofiber
10+
GITHUB_REPO=fiber
11+
12+
# Logging
13+
LOG_LEVEL=info
14+
15+
# Cache Configuration
16+
CACHE_ENABLED=true
17+
CACHE_TTL=3600
18+
19+
# Database (Future)
20+
# DB_HOST=localhost
21+
# DB_PORT=5432
22+
# DB_NAME=fixfx
23+
# DB_USER=fixfx
24+
# DB_PASSWORD=
25+
26+
# API Keys (Future)
27+
# API_KEY_ARTIFACTS=
28+
# API_KEY_NATIVES=

.gitignore

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.so.*
7+
*.dylib
8+
9+
# Test binary, built with `go test -c`
10+
*.test
11+
12+
# Output of the go coverage tool
13+
*.out
14+
15+
# Dependency directories
16+
vendor/
17+
18+
# Go workspace file
19+
go.work
20+
21+
# IDE
22+
.vscode/
23+
.idea/
24+
*.swp
25+
*.swo
26+
*~
27+
.DS_Store
28+
29+
# Environment
30+
.env
31+
.env.local
32+
.env.*.local
33+
34+
# Generated files
35+
docs/swagger.json
36+
docs/swagger.yaml
37+
38+
# Logs
39+
*.log
40+
logs/
41+
42+
# Temporary files
43+
tmp/
44+
temp/
45+
46+
# Build output
47+
dist/
48+
build/
49+
50+
# Air - Live reload for Go
51+
.air.toml
52+
tmp/
53+
54+
# GoLand
55+
.idea/
56+
57+
# VS Code
58+
.vscode/
59+
*.code-workspace
60+
61+
# macOS
62+
.DS_Store
63+
.AppleDouble
64+
.LSOverride
65+
66+
# Windows
67+
Thumbs.db

DEVELOPMENT.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# FixFX Backend
2+
3+
A high-performance Go backend API for the FixFX documentation platform.
4+
5+
## Quick Start
6+
7+
```bash
8+
# Install dependencies
9+
go mod download
10+
11+
# Generate Swagger documentation
12+
swag init
13+
14+
# Run the server
15+
go run main.go
16+
```
17+
18+
The API will be available at `http://localhost:3001`
19+
20+
## Documentation
21+
22+
- Interactive API Docs: http://localhost:3001/docs
23+
- Swagger JSON: http://localhost:3001/docs/json
24+
25+
## Architecture
26+
27+
The backend is organized into:
28+
29+
- **Routes** (`internal/routes/`) - API endpoint definitions with Swagger documentation
30+
- **Handlers** (`internal/handlers/`) - Request handlers
31+
- **Services** (`internal/services/`) - Business logic (fetching, processing, filtering)
32+
- **Models** (`internal/models/`) - Data structures
33+
34+
## APIs
35+
36+
### Artifacts API
37+
Fetch FiveM/RedM server artifacts with filtering and pagination.
38+
39+
```
40+
GET /api/artifacts/fetch
41+
- platform (windows/linux/all)
42+
- status (recommended/latest/active/deprecated/eol)
43+
- sortBy (version/date)
44+
- limit, offset
45+
```
46+
47+
### Natives API
48+
Query game native functions database.
49+
50+
```
51+
GET /api/natives
52+
- game (gta5/rdr3/all)
53+
- environment (server/client/all)
54+
- search, namespace
55+
- limit, offset
56+
```
57+
58+
### Source API
59+
Securely serve source code files.
60+
61+
```
62+
GET /api/source?path=path/to/file
63+
```
64+
65+
### Search API
66+
Full-text search across documentation.
67+
68+
```
69+
GET /api/search?q=query&type=all
70+
```
71+
72+
## Migration Status
73+
74+
This backend is being progressively populated with functionality from the Next.js frontend API routes.
75+
76+
### Completed
77+
- ✅ Project structure
78+
- ✅ Swagger/OpenAPI documentation setup
79+
- ✅ Route definitions
80+
- ✅ CORS and logging middleware
81+
82+
### In Progress
83+
- 🔄 Artifacts service implementation
84+
- 🔄 Natives service implementation
85+
- 🔄 Source file serving
86+
- 🔄 Search functionality
87+
88+
### Planned
89+
- ⏳ Caching (Redis)
90+
- ⏳ Rate limiting
91+
- ⏳ Authentication
92+
- ⏳ Database integration
93+
- ⏳ Performance optimization
94+
95+
## Development
96+
97+
For detailed development guide, see [README.md](README.md)
98+
99+
## License
100+
101+
Apache License 2.0

Makefile

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
.PHONY: help install deps build run test clean lint swagger docker-build docker-run
2+
3+
help:
4+
@echo "FixFX Backend - Available Commands"
5+
@echo "===================================="
6+
@echo " make install - Install dependencies"
7+
@echo " make deps - Download dependencies"
8+
@echo " make build - Build the application"
9+
@echo " make run - Run the application"
10+
@echo " make dev - Run with hot-reload (requires air)"
11+
@echo " make test - Run all tests"
12+
@echo " make test-cover - Run tests with coverage"
13+
@echo " make lint - Run linters"
14+
@echo " make swagger - Generate Swagger documentation"
15+
@echo " make clean - Clean build artifacts"
16+
@echo " make docker-build - Build Docker image"
17+
@echo " make docker-run - Run Docker container"
18+
@echo ""
19+
20+
install: deps
21+
@echo "Installing FixFX backend..."
22+
@go build -o fixfx-backend main.go
23+
@echo "✓ Installation complete"
24+
25+
deps:
26+
@echo "Installing dependencies..."
27+
@go mod download
28+
@go mod tidy
29+
@echo "✓ Dependencies installed"
30+
31+
build:
32+
@echo "Building FixFX backend..."
33+
@mkdir -p dist
34+
@go build -o dist/fixfx-backend main.go
35+
@echo "✓ Build complete: dist/fixfx-backend"
36+
37+
run:
38+
@echo "Starting FixFX backend..."
39+
@go run main.go
40+
41+
dev:
42+
@echo "Starting FixFX backend (dev mode with hot-reload)..."
43+
@which air > /dev/null || go install github.com/air-verse/air@latest
44+
@air
45+
46+
test:
47+
@echo "Running tests..."
48+
@go test -v ./...
49+
50+
test-cover:
51+
@echo "Running tests with coverage..."
52+
@go test -coverprofile=coverage.out ./...
53+
@go tool cover -html=coverage.out -o coverage.html
54+
@echo "Coverage report: coverage.html"
55+
56+
lint:
57+
@echo "Running linters..."
58+
@which golangci-lint > /dev/null || go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
59+
@golangci-lint run
60+
61+
swagger:
62+
@echo "Generating Swagger documentation..."
63+
@which swag > /dev/null || go install github.com/swaggo/swag/cmd/swag@latest
64+
@swag init
65+
@echo "✓ Swagger docs generated"
66+
67+
clean:
68+
@echo "Cleaning build artifacts..."
69+
@rm -f fixfx-backend
70+
@rm -rf dist/
71+
@rm -rf docs/swagger.*
72+
@rm -f coverage.out coverage.html
73+
@go clean
74+
@echo "✓ Clean complete"
75+
76+
docker-build:
77+
@echo "Building Docker image..."
78+
@docker build -t fixfx-backend:latest .
79+
@echo "✓ Docker image built"
80+
81+
docker-run:
82+
@echo "Running Docker container..."
83+
@docker run -p 3001:3001 \
84+
-e PORT=3001 \
85+
-e ENVIRONMENT=development \
86+
fixfx-backend:latest
87+
@echo "✓ Container running on http://localhost:3001"
88+
89+
# Development targets
90+
.PHONY: install-tools format
91+
92+
install-tools:
93+
@echo "Installing development tools..."
94+
@go install github.com/swaggo/swag/cmd/swag@latest
95+
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
96+
@go install github.com/air-verse/air@latest
97+
@echo "✓ Tools installed"
98+
99+
format:
100+
@echo "Formatting code..."
101+
@gofmt -w .
102+
@echo "✓ Code formatted"

0 commit comments

Comments
 (0)