Skip to content

Commit 115cb2d

Browse files
committed
New Tool (Server List Preview),
Improvements, API Call Stat, Sponsor Space
1 parent 32b4f25 commit 115cb2d

38 files changed

Lines changed: 3679 additions & 635 deletions

.env.example

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# NitroCraft environment example
2+
# Copy this file to .env and adjust for your deployment.
3+
4+
# Runtime
5+
NODE_ENV=production
6+
EXTERNAL_URL=https://nitrocraft.example.com
7+
BIND=0.0.0.0
8+
PORT=3000
9+
SERVER_PORT=3000
10+
EXTERNAL_HTTP_TIMEOUT=2000
11+
12+
# CORS
13+
# Use All (or empty) to allow any origin.
14+
# Use a comma-separated allowlist to restrict origins.
15+
CORS_ORIGIN=All
16+
# CORS_ORIGINS=https://app.example.com,https://admin.example.com
17+
18+
# Cache backend
19+
# Valid values: redis, memory, none
20+
CACHE_BACKEND=memory
21+
# Used when CACHE_BACKEND=redis
22+
REDIS_URL=redis://localhost:6379
23+
CACHE_LOCAL=1200
24+
CACHE_BROWSER=3600
25+
EPHEMERAL_STORAGE=false
26+
CLOUDFLARE=false
27+
MEMORY_CACHE_MAX_KEYS=50000
28+
MEMORY_CACHE_TTL_SECONDS=2400
29+
API_CALL_COUNT_FILE=./data/api-call-count.json
30+
API_CALL_COUNT_FLUSH_MS=2000
31+
32+
# Optional homepage sponsor card (renders only when URL + image are set)
33+
# Multiple sponsor cards as JSON array (takes precedence over SPONSOR_CARD_*)
34+
# SPONSOR_CARDS=[{"url":"https://example.com","image":"https://cdn.example.com/sponsor1.png","alt":"Sponsor 1"},{"url":"https://example.org","image":"/images/sponsor2.png","alt":"Sponsor 2"}]
35+
SPONSOR_CARDS=
36+
SPONSOR_CARD_URL=
37+
SPONSOR_CARD_IMAGE=
38+
SPONSOR_CARD_ALT=Sponsor
39+
40+
# Retention / cleanup
41+
RETENTION_ENABLED=true
42+
RETENTION_DAYS=30
43+
# RETENTION_MAX_AGE_DAYS=30
44+
# RETENTION_MAX_AGE_HOURS=720
45+
RETENTION_INTERVAL_HOURS=24
46+
# RETENTION_INTERVAL_DAYS=1
47+
48+
# Outbound + inbound rate limits
49+
# Leave blank (or <=0) to disable request limiter.
50+
SESSIONS_RATE_LIMIT=25
51+
REQUESTS_RATE_LIMIT=180
52+
REQUESTS_RATE_LIMIT_WINDOW_MS=1000
53+
REQUESTS_RATE_LIMIT_MAX_KEYS=50000
54+
REQUESTS_RATE_LIMIT_TRUST_PROXY=true
55+
REQUESTS_RATE_LIMIT_EXCLUDE=
56+
57+
# Status probes
58+
STATUS_ALLOW_PRIVATE_TARGETS=false
59+
STATUS_PROBE_CACHE_TTL_MS=10000
60+
61+
# Security and redirect controls
62+
MAX_TEXTURE_BYTES=1048576
63+
DEFAULT_REDIRECT_ALLOWLIST=nitrocraft.example.com,*.nitrocraft.example.com
64+
65+
# Logging
66+
DEBUG=false
67+
LOG_TIME=true
68+
69+
# Optional image/render bounds
70+
AVATAR_MIN=1
71+
AVATAR_MAX=512
72+
AVATAR_DEFAULT=160
73+
RENDER_MIN=1
74+
RENDER_MAX=10
75+
RENDER_DEFAULT=6
76+
77+
# Optional storage directory overrides
78+
FACE_DIR=./images/faces/
79+
HELM_DIR=./images/helms/
80+
SKIN_DIR=./images/skins/
81+
RENDER_DIR=./images/renders/
82+
CAPE_DIR=./images/capes/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ replay_pid*
2727
.nitro
2828
.env
2929
/node_modules
30+
/data

CONTRIBUTING.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,23 @@ Thanks for helping improve NitroCraft. We aim to keep contributions practical, s
1616
0. Share version info (`node`, OS, runtime context such as Docker/Pterodactyl).
1717
0. If applicable, include request URL examples and response codes.
1818

19-
## Pull request guidelines
20-
21-
0. Keep PRs small and reviewable.
22-
0. Explain what changed, why it changed, and any risk/compatibility impact.
19+
## Pull request guidelines
20+
21+
0. Keep PRs small and reviewable.
22+
0. Explain what changed, why it changed, and any risk/compatibility impact.
2323
0. Update docs/config examples when behavior or configuration changes.
24-
0. Follow existing project style and file organization.
25-
0. Prefer root-cause fixes over temporary patches.
26-
27-
## Code style
28-
29-
0. Follow the existing style of the repository.
24+
0. Follow existing project style and file organization.
25+
0. Prefer root-cause fixes over temporary patches.
26+
27+
## Contributor recognition
28+
29+
0. Contributor Minecraft avatars can be added to the homepage jumbotron sample list.
30+
0. Pinned contributor entries use `data-pinned="true"` and are always kept visible in the jumbotron, including on mobile.
31+
0. If you want to be added, include your Minecraft username/UUID in your PR notes.
32+
33+
## Code style
34+
35+
0. Follow the existing style of the repository.
3036
0. Keep code readable and consistent.
3137
0. Prefer clear naming and simple, maintainable implementations.
3238
0. Add comments only when behavior is non-obvious.

README.md

Lines changed: 29 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,10 @@ NitroCraft is a Minecraft avatar/render API built on Nitro and `minecraft-toolki
1010

1111
## Preview
1212

13-
| Steve Avatar | Alex Avatar | Steve Skin |
14-
| --- | --- | --- |
15-
| ![Steve Avatar](public/images/mhf_steve.png) | ![Alex Avatar](public/images/mhf_alex.png) | ![Steve Skin](public/images/mhf_steve_skin.png) |
16-
17-
### Fetched Skin Samples
18-
19-
<p align="center">
20-
<img src="images/skins/292009a4925b58f02c77dadc3ecef07ea4c7472f64e0fdc32ce5522489362680.png" alt="Fetched skin sample 1" width="72" />
21-
<img src="images/skins/50c410fad8d9d8825ad56b0e443e2777a6b46bfa20dacd1d2f55edc71fbeb06d.png" alt="Fetched skin sample 2" width="72" />
22-
<img src="images/skins/56313add193389fc6154549026a3247727c3ebaaa6888820a3fb126599c230a1.png" alt="Fetched skin sample 3" width="72" />
23-
<img src="images/skins/5b1aa335740b970fd44e8fa60c6857cb8322b3d11599a1c9462186962dbf641d.png" alt="Fetched skin sample 4" width="72" />
24-
<img src="images/skins/68bb81ce003b18edfa2af119b0fbf91adc704d87ec2ea4262874d17003c5ab.png" alt="Fetched skin sample 5" width="72" />
25-
<img src="images/skins/6b46b561b84da3179f033dc0cc7862def10ec0c7d541edec320d860fe160584c.png" alt="Fetched skin sample 6" width="72" />
26-
<img src="images/skins/71cf0793a772b2168cb73daa4b0c08ec0a817ab96ac426a8dc5f793a9ee45dd6.png" alt="Fetched skin sample 7" width="72" />
27-
<img src="images/skins/74d1e08b0bb7e9f590af27758125bbed1778ac6cef729aedfcb9613e9911ae75.png" alt="Fetched skin sample 8" width="72" />
28-
<img src="images/skins/765b4f20d4e3850c2e79453873e571c66cd28755b9982aaf86f8ca2ffe319503.png" alt="Fetched skin sample 9" width="72" />
29-
<img src="images/skins/7fd9ba42a7c81eeea22f1524271ae85a8e045ce0af5a6ae16c6406ae917e68b5.png" alt="Fetched skin sample 10" width="72" />
30-
</p>
31-
32-
### Fetched Face Samples
33-
34-
<p align="center">
35-
<img src="images/faces/292009a4925b58f02c77dadc3ecef07ea4c7472f64e0fdc32ce5522489362680.png" alt="Fetched face sample 1" width="72" />
36-
<img src="images/faces/50c410fad8d9d8825ad56b0e443e2777a6b46bfa20dacd1d2f55edc71fbeb06d.png" alt="Fetched face sample 2" width="72" />
37-
<img src="images/faces/56313add193389fc6154549026a3247727c3ebaaa6888820a3fb126599c230a1.png" alt="Fetched face sample 3" width="72" />
38-
<img src="images/faces/5b1aa335740b970fd44e8fa60c6857cb8322b3d11599a1c9462186962dbf641d.png" alt="Fetched face sample 4" width="72" />
39-
<img src="images/faces/68bb81ce003b18edfa2af119b0fbf91adc704d87ec2ea4262874d17003c5ab.png" alt="Fetched face sample 5" width="72" />
40-
<img src="images/faces/6b46b561b84da3179f033dc0cc7862def10ec0c7d541edec320d860fe160584c.png" alt="Fetched face sample 6" width="72" />
41-
<img src="images/faces/71cf0793a772b2168cb73daa4b0c08ec0a817ab96ac426a8dc5f793a9ee45dd6.png" alt="Fetched face sample 7" width="72" />
42-
<img src="images/faces/74d1e08b0bb7e9f590af27758125bbed1778ac6cef729aedfcb9613e9911ae75.png" alt="Fetched face sample 8" width="72" />
43-
<img src="images/faces/765b4f20d4e3850c2e79453873e571c66cd28755b9982aaf86f8ca2ffe319503.png" alt="Fetched face sample 9" width="72" />
44-
<img src="images/faces/7fd9ba42a7c81eeea22f1524271ae85a8e045ce0af5a6ae16c6406ae917e68b5.png" alt="Fetched face sample 10" width="72" />
45-
</p>
46-
47-
### Fetched Render Samples
48-
49-
<p align="center">
50-
<img src="images/renders/292009a4925b58f02c77dadc3ecef07ea4c7472f64e0fdc32ce5522489362680-6-body-t.png" alt="Fetched body render sample 1" height="140" />
51-
<img src="images/renders/50c410fad8d9d8825ad56b0e443e2777a6b46bfa20dacd1d2f55edc71fbeb06d-6-body-t.png" alt="Fetched body render sample 2" height="140" />
52-
<img src="images/renders/5b1aa335740b970fd44e8fa60c6857cb8322b3d11599a1c9462186962dbf641d-6-body-t.png" alt="Fetched body render sample 3" height="140" />
53-
<img src="images/renders/6b46b561b84da3179f033dc0cc7862def10ec0c7d541edec320d860fe160584c-6-body-t.png" alt="Fetched body render sample 4" height="140" />
54-
<img src="images/renders/71cf0793a772b2168cb73daa4b0c08ec0a817ab96ac426a8dc5f793a9ee45dd6-6-body-t.png" alt="Fetched body render sample 5" height="140" />
55-
<img src="images/renders/74d1e08b0bb7e9f590af27758125bbed1778ac6cef729aedfcb9613e9911ae75-6-body-t.png" alt="Fetched body render sample 6" height="140" />
56-
</p>
13+
| Player | Avatar | Head Render | Body Render |
14+
| --- | --- | --- | --- |
15+
| RepGraphics | ![RepGraphics Avatar](https://nitrocraft.uk/avatars/d634462bd663401d9788a8596307bc4d?size=100&overlay) | ![RepGraphics Head Render](https://nitrocraft.uk/renders/head/d634462bd663401d9788a8596307bc4d?scale=6&overlay) | ![RepGraphics Body Render](https://nitrocraft.uk/renders/body/d634462bd663401d9788a8596307bc4d?scale=6&overlay) |
16+
| 26bz | ![26bz Avatar](https://nitrocraft.uk/avatars/15851079f1d24d418207ce9f914e966d?size=100&overlay) | ![26bz Head Render](https://nitrocraft.uk/renders/head/15851079f1d24d418207ce9f914e966d?scale=6&overlay) | ![26bz Body Render](https://nitrocraft.uk/renders/body/15851079f1d24d418207ce9f914e966d?scale=6&overlay) |
5717

5818
## Quick Links
5919

@@ -68,8 +28,11 @@ NitroCraft is a Minecraft avatar/render API built on Nitro and `minecraft-toolki
6828
- UUID-based avatar, skin, cape, and render endpoints
6929
- Username/UUID resolution endpoints via `minecraft-toolkit`
7030
- Disk + metadata caching with Redis or memory backend
31+
- Short-TTL + in-flight deduplicated status probe caching for `/status/*` endpoints
7132
- Configurable outbound Mojang session rate limiting (`SESSIONS_RATE_LIMIT`)
7233
- Optional inbound per-IP request rate limiting (`REQUESTS_RATE_LIMIT`)
34+
- OpenAPI schema (`/openapi.json`) and Prometheus metrics (`/metrics`)
35+
- Interactive server-list simulator (`/tools/server-list`) with import/share flow
7336
- Nitro runtime with `pnpm` workflows
7437

7538
## API Endpoints
@@ -103,6 +66,12 @@ NitroCraft is a Minecraft avatar/render API built on Nitro and `minecraft-toolki
10366
- `GET /format/strip?text=...`
10467
- `GET /format/css`
10568

69+
### Tooling and Meta
70+
71+
- `GET /tools/server-list`
72+
- `GET /openapi.json`
73+
- `GET /metrics`
74+
10675
## Getting Started
10776

10877
### Local Development
@@ -170,6 +139,12 @@ Create a `.env` file and configure the following values.
170139
| --- | --- |
171140
| `CACHE_BACKEND` | Cache backend: `redis`, `memory`, or `none`. |
172141
| `REDIS_URL` | Redis connection string (used when `CACHE_BACKEND=redis`). |
142+
| `API_CALL_COUNT_FILE` | JSON file path for persistent API call count (used when Redis is unavailable). |
143+
| `API_CALL_COUNT_FLUSH_MS` | Flush interval for persisting API call count updates. |
144+
| `SPONSOR_CARDS` | JSON array of sponsor cards shown below the jumbotron; each entry is `{ "url": "...", "image": "...", "alt": "..." }`. Takes precedence over `SPONSOR_CARD_*`. |
145+
| `SPONSOR_CARD_URL` | External link target for the optional sponsor card shown below the homepage jumbotron. |
146+
| `SPONSOR_CARD_IMAGE` | Image URL (or `/public-path` image) used for the optional sponsor card. |
147+
| `SPONSOR_CARD_ALT` | Alt text for the sponsor card image (`Sponsor` by default). |
173148
| `SESSIONS_RATE_LIMIT` | Outbound Mojang session request limit. |
174149
| `REQUESTS_RATE_LIMIT` | Enable/disable inbound per-IP request limiting. |
175150
| `REQUESTS_RATE_LIMIT_WINDOW_MS` | Rate-limit window size in milliseconds. |
@@ -185,23 +160,29 @@ Create a `.env` file and configure the following values.
185160
| `PORT` | HTTP server port. |
186161
| `BIND` | Bind address/interface. |
187162
| `EXTERNAL_URL` | Public base URL used for generated external links. |
163+
| `STATUS_PROBE_CACHE_TTL_MS` | Cache TTL for `/status/java`, `/status/bedrock`, `/status/server`, and `/status/icon` probes. |
188164

189165
## Notes
190166

191167
- Render endpoints require native `canvas` dependencies in your runtime image/environment.
192168
- Core image endpoints use UUID input. `/players/{uuid-or-username}` resolves usernames.
169+
- Credit to [26bz](https://github.com/26bz) for creating [`minecraft-toolkit`](https://github.com/26bz/minecraft-toolkit), which powers player/status tooling in NitroCraft.
193170

194171
## Donations
195172

196173
If NitroCraft helps your projects, you can support ongoing development here:
197174

198175
[![GitHub Sponsors](https://img.shields.io/badge/GitHub%20Sponsors-Support-181717?style=for-the-badge&logo=githubsponsors&logoColor=white)](https://github.com/sponsors/RepGraphics)
199-
[![PayPal](https://img.shields.io/badge/PayPal-Donate-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://www.paypal.me/repgraphics)
200-
[![Patreon](https://img.shields.io/badge/Patreon-Become%20a%20Patron-F96854?style=for-the-badge&logo=patreon&logoColor=white)](https://www.patreon.com/c/EuphoriaDevelopment)
201176

202177
- GitHub Sponsors: [github.com/sponsors/RepGraphics](https://github.com/sponsors/RepGraphics)
203-
- PayPal: [paypal.me/repgraphics](https://www.paypal.me/repgraphics)
204-
- Patreon: [patreon.com/c/EuphoriaDevelopment](https://www.patreon.com/c/EuphoriaDevelopment)
178+
179+
### Supporter Tiers
180+
181+
NitroCraft tiers are designed so any support helps, while the `$20` tier is the clear best fit for teams or brands that want visibility.
182+
183+
- `Supporter ($5/month)`: helps cover baseline hosting and maintenance costs, plus supporter role/thanks in community channels.
184+
- `Builder ($10/month)`: includes Supporter perks, plus priority review for one feature suggestion per month and access to sponsor polls.
185+
- `Sponsor Spotlight ($20/month)`: includes all lower-tier perks, plus placement in the NitroCraft homepage sponsor section and README sponsor listing with your linked image card.
205186

206187
## Support
207188

1.39 KB
Loading
216 Bytes
Loading
14.5 KB
Loading
7.33 KB
Loading
7.97 KB
Loading
3.84 KB
Loading

0 commit comments

Comments
 (0)