Skip to content

Commit 21083dd

Browse files
committed
fix: stuff and things
1 parent c3638da commit 21083dd

10 files changed

Lines changed: 1982 additions & 213 deletions

File tree

.env.example

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,4 @@ LOG_LEVEL=info
1414

1515
# Cache Configuration
1616
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=
17+
CACHE_TTL=3600

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ go.work
3131
.env.local
3232
.env.*.local
3333

34-
# Generated files
35-
docs/swagger.json
36-
docs/swagger.yaml
37-
3834
# Logs
3935
*.log
4036
logs/

CHANGELOG.md

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
# FixFX Backend Changelog
2+
3+
All notable changes to the FixFX backend will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## Release Strategy
9+
- **Patch versions** (0.1.x): Bug fixes, minor improvements
10+
- **Minor versions** (0.x.0): New features, non-breaking changes
11+
- **Major versions** (x.0.0): Breaking API changes
12+
13+
## [Unreleased]
14+
15+
### Planned
16+
- [ ] Chat API endpoint with message persistence
17+
- [ ] Contributors API with GitHub integration
18+
- [ ] Global search service (cross-service search)
19+
- [ ] Redis caching layer for improved performance
20+
- [ ] Rate limiting middleware
21+
- [ ] Authentication/Authorization system
22+
- [ ] Comprehensive test suite
23+
- [ ] Docker containerization
24+
- [ ] Monitoring and metrics collection
25+
26+
---
27+
28+
## [0.1.0] - 2026-01-25
29+
30+
### Added
31+
32+
#### Core Infrastructure
33+
- **Fiber v2 web framework** with middleware support
34+
- CORS middleware for cross-origin requests
35+
- Custom logging middleware
36+
- Global error handler with proper HTTP status codes
37+
- Health check endpoint (`/health`)
38+
39+
- **Swagger/OpenAPI documentation** with ReDoc UI
40+
- Auto-generated API specification from code comments
41+
- Beautiful dark-themed ReDoc interface matching frontend design
42+
- Interactive API documentation at `/docs`
43+
- JSON spec available at `/docs/doc.json`
44+
45+
#### Services & Handlers
46+
47+
**Artifacts Service** (3 handlers, 4 endpoints)
48+
- GitHub API integration for FiveM server artifacts
49+
- Artifact fetching with intelligent caching (1-hour TTL)
50+
- Version extraction and support status determination
51+
- Status types: recommended, latest, active, deprecated, eol
52+
- Platform-specific artifact generation (Windows/Linux)
53+
- Advanced filtering:
54+
- Filter by platform (windows/linux/all)
55+
- Filter by version
56+
- Filter by support status
57+
- Sorting capabilities:
58+
- Sort by version (semantic versioning aware)
59+
- Sort by date
60+
- Ascending/descending order
61+
- Pagination support:
62+
- Configurable limit (default 50, max 200)
63+
- Offset-based pagination
64+
- Changelog retrieval between versions
65+
- Fallback data handling for API failures
66+
67+
Endpoints:
68+
- `GET /api/artifacts/fetch` - Fetch artifacts with filtering & pagination
69+
- `GET /api/artifacts/version/:version` - Get specific version details
70+
- `GET /api/artifacts/check` - Check artifact availability
71+
- `GET /api/artifacts/changes` - Get changelog between versions
72+
73+
**Natives Service** (4 handlers, 4 endpoints)
74+
- Multi-source native function fetching:
75+
- GTA5 natives from https://runtime.fivem.net/doc/natives.json
76+
- RDR3 natives from runtime.fivem.net
77+
- CFX natives (custom CitizenFX natives)
78+
- Intelligent caching (1-hour TTL per source)
79+
- Environment detection (client/server/shared)
80+
- Namespace-based organization
81+
- Full-text search with relevance scoring
82+
- Exact name match: +4 points
83+
- Name contains: +3 points
84+
- Description match: +2 points
85+
- Parameter match: +1 point
86+
- Advanced filtering:
87+
- Filter by game (gta5/rdr3/cfx)
88+
- Filter by environment (client/server/shared)
89+
- Filter by namespace
90+
- Pagination support
91+
- Statistics generation (total natives, by game, by environment)
92+
93+
Endpoints:
94+
- `GET /api/natives` - Get natives with filtering & pagination
95+
- `GET /api/natives/search` - Full-text search across all natives
96+
- `GET /api/natives/:hash` - Get specific native by hash
97+
- `GET /api/natives/stats` - Get natives statistics
98+
99+
**Source Service** (1 handler, 1 endpoint)
100+
- Secure file serving with whitelist validation
101+
- Path traversal prevention
102+
- Prevents `..` directory traversal
103+
- Absolute path validation
104+
- Whitelist-only access
105+
- Syntax highlighting detection for 25+ file types
106+
- TypeScript, JavaScript, Go, Python
107+
- JSON, YAML, XML
108+
- SQL, Shell, Dockerfile
109+
- And more...
110+
- Proper error handling (400/403/404)
111+
- File metadata (size, language, path)
112+
113+
Endpoints:
114+
- `GET /api/source` - Read source files with syntax detection
115+
116+
#### Project Structure
117+
- `internal/services/` - Business logic layer
118+
- `internal/handlers/` - HTTP request/response handling
119+
- `internal/routes/` - Route registration and Swagger docs
120+
- `docs/` - Auto-generated Swagger specification
121+
- `Makefile` - Build automation and common tasks
122+
- `go.mod` - Dependency management
123+
- `README.md` - Project documentation
124+
- `DEVELOPMENT.md` - Development setup guide
125+
126+
#### DevOps & Tooling
127+
- Makefile with targets:
128+
- `make install` - Install dependencies and tools
129+
- `make build` - Build Go binary
130+
- `make dev` - Run with hot-reload (air)
131+
- `make run` - Run compiled binary
132+
- `make test` - Run tests
133+
- `make swagger` - Generate Swagger docs
134+
- GitHub Actions CI/CD pipeline
135+
- Docker support (Dockerfile included)
136+
- `.env.example` - Environment configuration template
137+
138+
#### Documentation
139+
- `README.md` - Quick start and API reference
140+
- `DEVELOPMENT.md` - Development environment setup
141+
- `BACKEND_MIGRATION.md` - Migration guide from Next.js
142+
- `BACKEND_SETUP.md` - Detailed setup instructions
143+
- `CHANGELOG.md` - This file
144+
145+
### Technical Details
146+
147+
#### Dependencies
148+
- `github.com/gofiber/fiber/v2` v2.52.0 - Web framework
149+
- `github.com/swaggo/swag` v1.16.0 - Swagger documentation
150+
- `github.com/swaggo/files` v1.0.1 - Swagger UI files
151+
- `github.com/joho/godotenv` v1.5.1 - Environment variables
152+
153+
#### Architecture
154+
- **Service Pattern**: Business logic encapsulated in services
155+
- **Handler Pattern**: HTTP concerns handled separately
156+
- **Middleware**: CORS, logging, error handling
157+
- **Error Handling**: Consistent error responses with proper status codes
158+
- **Caching**: In-memory cache with TTL (ready for Redis migration)
159+
- **API Versioning**: Prepared for future API versioning
160+
161+
### Performance Features
162+
- In-memory caching with intelligent TTL management
163+
- Efficient filtering and sorting algorithms
164+
- Pagination to prevent large response payloads
165+
- Relevance-based search scoring
166+
167+
### Security Features
168+
- CORS enabled for development (can be configured)
169+
- Path validation for file serving
170+
- Input validation on all endpoints
171+
- Structured logging for debugging
172+
- Proper HTTP status codes for security (403, 404, etc.)
173+
174+
### Known Limitations
175+
- In-memory cache (no persistence across restarts)
176+
- No authentication/authorization yet
177+
- Search endpoint uses Next.js backend (to be migrated)
178+
- No rate limiting
179+
- Health check is basic (ready to enhance)
180+
181+
---

DEVELOPMENT.md

Lines changed: 0 additions & 101 deletions
This file was deleted.

0 commit comments

Comments
 (0)