Files
OpenFUT-Core/CONTRIBUTING.md
T
OpenFUT Agent f70cf4415c wip(core): preserve local broad Core refactor + inventory service
Divergent development line off origin/main (11a811d): a broad refactor across
routes/services/models/app + a large integration_test expansion (+1000), plus an
untracked game-independent inventory query service and Docker files. Preserved
verbatim before moving the canonical Core checkout to the committed migration
trunk (66c88fb). Reconciling this refactor with the migration trunk is a separate
user decision; nothing here is lost.
2026-08-13 18:34:00 +00:00

94 lines
2.4 KiB
Markdown

# Contributing to OpenFUT Core
## Prerequisites
- **Rust** (stable, 1.80+) — install via [rustup](https://rustup.rs)
- **SQLite 3** — usually pre-installed on Linux/macOS
Recommended tools:
```bash
rustup component add clippy rustfmt
```
## Setup
```bash
git clone <repo-url>
cd openfut-core
cp .env.example .env
cargo build
```
## Running locally
```bash
cargo run
```
The server starts at `http://127.0.0.1:8080` by default. Logs appear in the
terminal. On first run, the SQLite database is created and all migrations are
applied automatically.
## Running tests
```bash
cargo test
```
Tests spin up a full in-process server against an in-memory SQLite database —
no setup required and nothing is written to disk.
## Code style
All PRs must pass before merge:
```bash
cargo fmt --check # formatting
cargo clippy -- -D warnings # lints
cargo test # full test suite
```
Auto-fix formatting with `cargo fmt`.
## Adding card / pack / objective data
See [MODDING.md](MODDING.md) for the data file schemas. No Rust code changes
are needed to add new cards, packs, objectives, or SBC definitions.
## Project layout
```
src/
app.rs router + middleware setup
config.rs Config struct (reads from env)
db.rs SQLite pool init + migrations
error.rs AppError enum
middleware.rs concurrency limit, request ID
models/ Serde structs for DB rows and API payloads
routes/ Axum handler functions (one file per domain)
services/ Business logic (no HTTP types here)
seed/ One-time startup seeds
modding/ JSON data loader utilities
data/
cards/ CardDefinition JSON arrays
packs/ PackDefinition JSON arrays
objectives/ ObjectiveDefinition JSON arrays
sbcs/ SbcDefinition JSON arrays
migrations/ SQLite migration SQL files
```
## Branching & pull requests
- Create a branch from `main`: `git checkout -b feat/my-feature`
- Keep PRs focused — one feature or fix per PR
- PR description should explain *why*, not just *what*
## Design constraints
- **No online multiplayer.** This is an offline local backend only.
- **No copyrighted assets.** All card data in `data/` must be original.
- **No real EA services.** Do not hardcode or reverse-engineer EA endpoints.
- **Game-independent core.** `openfut-core` must stay game-agnostic;
FIFA-specific logic belongs in the emulation layer (`fifa17-recon/`).