三套独立启动器:Next.js(App Router、TypeScript)、Laravel 可复制文件、原生 JavaScript(零 npm 依赖)
nexwall-web-starter — Next.js 启动器模板
作者 kodnextechnologies
基于 NexWall 免费壁纸 API 的三套网页启动器:Next.js(App Router、TypeScript)、Laravel 可复制文件与原生 JavaScript,均通过服务端缓存代理隐藏 API 密钥,支持分类筛选、分页、大图查看与下载。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 3
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
API 密钥仅存于服务端环境变量,浏览器不可见,代理仅放行白名单查询参数
对成功响应做缓存(壁纸 5 分钟、分类 1 小时),错误不缓存,节省免费计划每日 100 次请求配额
支持分类筛选、9:16 网格懒加载缩略图、分页(加载更多或上一页/下一页)、大图查看与下载
统一代理契约,原生 JavaScript 前端可直接运行在 Next.js 或 Laravel 代理之上
处理 401、404、422、429 状态码,展示 Retry-After 等待时间与剩余请求数
模板详细介绍
该项目为使用 NexWall 免费壁纸 API 的开发者提供三套独立启动器,分别面向 Next.js、Laravel 和原生 JavaScript 技术栈。三者共用同一套代理契约:GET {proxy}/categories 与 GET {proxy}/wallpapers?page=&per_page=&category_id=&type=&search=&sort=,并原样返回 API 的 JSON 响应,因此原生 JavaScript 前端也可直接运行在 Next.js 或 Laravel 代理之上。
Next.js 版本包含 App Router 路由处理器 /api/wallpapers 与 /api/categories(带缓存),以及客户端页面(分类标签、网格、加载更多、大图查看器)。Laravel 版本不是完整应用,而是可复制到现有 Laravel 10/11/12 项目中的文件:NexWallClient 服务(Http facade + Cache::remember)、控制器、Blade 视图与可选 JSON 代理路由。原生 JavaScript 版本包含零 npm 依赖的 Node.js 静态服务器与内存缓存代理,以及无框架前端。
三套实现均将 API 密钥保存在服务端环境变量中,浏览器不可见;代理仅允许白名单查询参数(page、per_page、category_id、type、search、sort),并对成功响应做缓存(壁纸页默认 5 分钟,分类默认 1 小时),以节省免费计划每天 100 次请求的配额。错误响应不会被缓存,并处理 401、404、422、429(展示 Retry-After 等待时间)。Next.js 与 Node 代理会透传速率限制响应头。
限制方面:Laravel 目录为 drop-in 文件而非完整应用;免费计划每日 100 次请求,缓存会导致 sort=random 在缓存期内返回相同页面,剩余请求数徽章可能最多滞后 5 分钟;演示图片、字体、图标等第三方素材需单独核对许可;域名、托管、数据库等外部服务可能另行收费。
适合你的项目吗?
适用场景
- 在 Next.js 项目中快速搭建带分类筛选与分页的壁纸展示页
- 将壁纸浏览功能以可复制文件形式集成到现有 Laravel 10/11/12 项目
- 用零依赖的 Node.js 静态服务器与代理搭建无框架壁纸页面
- 复用同一套原生 JavaScript 前端,搭配 Next.js 或 Laravel 代理运行
- 在本地实验中直接调用 NexWall API 验证接口响应
适合人群
- 使用 Next.js、React 或 TypeScript 的 Web 开发者
- 维护 Laravel 10/11/12 项目并需要壁纸浏览功能的 PHP 开发者
- 偏好无框架、零 npm 依赖方案的前端开发者
- 需要将 API 密钥保留在服务端并控制请求配额的开发者
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
需先在 https://nexwall.kodnextech.com/developers/register 注册获取免费 API 密钥,免费计划无需信用卡
- 2
Next.js 版本需 Node.js 20.9+,复制 .env.example 为 .env.local 并设置 NEXWALL_API_KEY,然后 npm install 与 npm run dev
- 3
Laravel 版本需 PHP 8.1+,将 laravel/ 下文件复制到现有项目对应路径,添加 .env 配置,并将 routes/web.php 中的路由片段追加(而非替换)到项目路由文件
- 4
原生 JavaScript 版本需 Node.js 18+,复制 .env.example 为 .env 并设置 NEXWALL_API_KEY,运行 node server.mjs;Node 20.12+/21.7+ 会自动加载 .env,旧版本需手动设置环境变量或使用 --env-file
- 5
不要将密钥命名为 NEXT_PUBLIC_ 或 VITE_ 前缀,也不要提交 .env 文件;若密钥进入提交或公开页面,应视为已泄露并更换
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
- 免费计划每天仅允许 100 次 API 请求,超出后返回 429,需等待或升级付费计划。
- 商业或变现站点(广告、订阅、付费产品、客户项目)必须使用 Pro 或 Ultra 付费计划,免费计划不可用于商业用途。
- 动态(视频)壁纸需要 Ultra 付费计划,启动器仅请求静态图片。
- 使用前必须注册 NexWall 账号并获取 API 密钥,免费计划无需信用卡。
- Laravel 目录不是完整应用,仅为可复制文件,需自行集成到现有 Laravel 10/11/12 项目(PHP 8.1+)。
- 项目不包含自动化测试,仅通过类型检查、构建和语法检查验证。
- Laravel 文件未在所列全部 Laravel 版本中实际运行验证。
- API 返回的壁纸图片和视频不受 MIT 许可证覆盖,其使用受 NexWall Developer API License 约束。
- 禁止在页面中直接暴露 API 密钥,必须通过服务端代理调用。
- 缓存导致 sort=random 在最多 5 分钟内返回相同的“随机”页面。
- 剩余请求数徽章可能最多滞后 5 分钟。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
The free plan allows **100 requests per day**.
README 原文
**Commercial or monetized sites and apps** (ads, subscriptions, paid products, client work) need a **Pro or Ultra** plan under the [NexWall Developer API License](https://nexwall.kodnextech.com/wallpaper-api/license).
README 原文
Live (video) wallpapers need the Ultra plan; the starters request `type=image` only.
README 原文
Sign up at **https://nexwall.kodnextech.com/developers/register**. The free plan needs no credit card.
README 原文
`laravel/` is **not** a full Laravel application. It contains files you copy into an existing Laravel 10, 11 or 12 project (PHP 8.1+).
README 原文
No automated tests are included.
README 原文
the Laravel files have not been run inside every Laravel version listed.
README 原文
Wallpaper images and videos returned by the API are **not** covered by the MIT license.
README 原文
**Never ship a page that contains your key.**
README 原文
`sort=random` returns the same "random" page for up to 5 minutes
README 原文
https://github.com/kodnextechnologies/nexwall-web-starter/blob/main/LICENSEhttps://github.com/kodnextechnologies/nexwall-web-starter/blob/main/README.mdthe "requests left today" badge can show a value up to 5 minutes old.
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-06。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料较完整 · 85 / 100
- 技术栈
- Next.js · Laravel · React · HTML
- 网站类型
- 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-10-06
- 截图检查日期
- 2026-10-06
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Next.js。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: [email protected] · 2026-10-06
查看当时使用的来源资料
SHA-256: 1d29708defe0bf948b9d1782898a1e29bf16ed7f9a4bf699d3e97a5f51e92ea0
2026-10-06T08:14:06.356Z
来源文件 / 仓库# Wallpaper API Web Starter — Next.js, React, Laravel & JavaScript (Free NexWall API)
Three small, open-source web starters for the [NexWall **free wallpaper API**](https://nexwall.kodnextech.com/wallpaper-api/free-wallpaper-api): a Next.js (App Router, TypeScript) app for React developers, drop-in files for an existing Laravel project, and a plain HTML/CSS/JavaScript page with a zero-dependency Node.js proxy. Each one shows wallpaper categories, a paginated wallpaper grid, the full-size image and a download link, and each keeps your API key on the server behind a small cached proxy.
## Examples
| Folder | Stack | What you get | Key stays on |
| --- | --- | --- | --- |
| [`nextjs/`](nextjs) | Next.js 16 (App Router), React 19, TypeScript | Route handlers `/api/wallpapers` + `/api/categories` (cached proxy) and a client page with category chips, grid, "Load more", full image viewer | Next.js server |
| [`laravel/`](laravel) | Laravel 10 / 11 / 12, PHP 8.1+ | `NexWallClient` service (Http facade + `Cache::remember`), controller, Blade view with category filter and pagination, optional JSON proxy routes. **Drop-in files, not a full app** | Laravel server |
| [`vanilla-js/`](vanilla-js) | HTML, CSS, JavaScript, Node.js 18+ (no npm dependencies) | `server.mjs` static server + `/api/*` proxy with in-memory cache, and a framework-free frontend | Node.js server |
All three use the same proxy contract (`GET {proxy}/categories` and `GET {proxy}/wallpapers?page=&per_page=&category_id=&type=&search=&sort=`, returning the API's JSON unchanged), so the vanilla-js frontend also works on top of the Next.js or Laravel proxy.
## Features
- API key read from an environment variable on the server only; the browser never sees it
- Allow-listed query parameters (`page`, `per_page`, `category_id`, `type`, `search`, `sort`) so your proxy cannot be used to call arbitrary endpoints
- Response caching to save quota (5 minutes for wallpaper pages, 1 hour for categories by default)
- Category filter, 9:16 wallpaper grid with lazy-loaded thumbnails, pagination ("Load more" or previous/next)
- Full-size image viewer with "Open full image" and "Download"
- Shows `remaining_requests_today` from the API
- Handles `401`, `404`, `422` and `429` (shows the `Retry-After` wait time); errors are never cached
- Rate-limit headers (`X-RateLimit-*`, `X-Developer-Api-Plan`, `Retry-After`) are passed through by the Next.js and Node proxies
## Get a free API key
Sign up at **https://nexwall.kodnextech.com/developers/register**. The free plan needs no credit card.
```bash
git clone https://github.com/kodnextechnologies/nexwall-web-starter.git
cd nexwall-web-starter
```
## Quick start: Next.js (and React)
Requires Node.js 20.9+.
```bash
cd nextjs
npm install
cp .env.example .env.local # then set NEXWALL_API_KEY=your_key_here
npm run dev # http://localhost:3000
```
Other scripts: `npm run build`, `npm start`, `npm run typecheck` (`next typegen && tsc --noEmit`).
How it works:
```
Browser (app/page.tsx, client component)
│ fetch("/api/wallpapers?page=2&category_id=5")
▼
app/api/wallpapers/route.ts ──► lib/nexwall.ts ──► NexWall API
(allow-lists params) adds Authorization: Bearer $NEXWALL_API_KEY
fetch(..., { next: { revalidate: 300 } })
```
```
nextjs/
├── app/
│ ├── api/categories/route.ts # GET /api/categories (cached 1 hour)
│ ├── api/wallpapers/route.ts # GET /api/wallpapers (cached 5 minutes)
│ ├── layout.tsx
│ ├── page.tsx # client UI: chips, grid, Load more, viewer
│ └── globals.css
├── lib/nexwall.ts # server-side proxy helper + response types
├── next.config.ts
└── .env.example # copy to .env.local
```
**Why the cache?** The free plan allows **100 requests per day**. Without caching, every visitor and every "Load more" click would use one request, and a handful of visitors could use up the day's quota. With `next: { revalidate: 300 }`, Next.js stores each unique response (for example "page 2 of category 5") in its Data Cache and answers identical requests from it for 5 minutes without calling NexWall. Adjust the numbers in the two route handlers to taste. Two side effects: `sort=random` returns the same "random" page for up to 5 minutes, and the "requests left today" badge can show a value up to 5 minutes old.
**React without Next.js?** `app/page.tsx` is an ordinary React component that calls `/api/...` with `fetch`. You can reuse it in a Vite or Create React App project as long as some server (the Laravel or Node proxy below, or your own) answers `/api/categories` and `/api/wallpapers`.
**Images:** the starter uses a plain `<img loading="lazy">`, so no `next/image` configuration is needed. To switch to `next/image`, add an `images.remotePatterns` entry for `nexwall.kodnextech.com` (and any other host that appears in `image_url` / `thumbnail_url`); see the comment in `next.config.ts`.
## Quick start: Laravel
`laravel/` is **not** a full Laravel application. It contains files you copy into an existing Laravel 10, 11 or 12 project (PHP 8.1+). No extra Composer packages are needed and there is no frontend build step.
```
laravel/
├── app/Services/NexWallClient.php # Http facade + Cache::remember
├── app/Services/NexWallException.php # status + retryAfter
├── app/Http/Controllers/WallpaperController.php # Blade page + JSON proxy
├── config/nexwall.php
├── resources/views/wallpapers/index.blade.php # grid, category filter, pagination (plain CSS)
├── routes/web.php # snippet to ADD to your routes file
└── .env.example # lines to add to your .env
```
1. Copy the files into the same paths in your project:
```bash
cp -r laravel/app/* /path/to/your-app/app/
cp laravel/config/nexwall.php /path/to/your-app/config/
mkdir -p /path/to/your-app/resources/views/wallpapers
cp laravel/resources/views/wallpapers/index.blade.php /path/to/your-app/resources/views/wallpapers/
```
2. Add the lines from `laravel/.env.example` to your `.env`:
```
NEXWALL_API_KEY=your_key_here
```
3. **Add** (do not replace) the routes from `laravel/routes/web.php` to your `routes/web.php`:
```php
use App\Http\Controllers\WallpaperController;
Route::get('/wallpapers', [WallpaperController::class, 'index'])->name('wallpapers.index');
Route::prefix('nexwall-api')->middleware('throttle:60,1')->group(function () {
Route::get('/categories', [WallpaperController::class, 'apiCategories']);
Route::get('/wallpapers', [WallpaperController::class, 'apiWallpapers']);
});
```
4. Clear cached config if you use it (`php artisan config:clear`), run `php artisan serve` and open `/wallpapers`.
Notes:
- `NexWallClient::fromConfig()` reads `config/nexwall.php`. Successful responses are cached with `Cache::remember` in your default cache store (`NEXWALL_CACHE_TTL`, default 300 seconds; categories `NEXWALL_CATEGORIES_CACHE_TTL`, default 3600). Failed requests throw before anything is stored, so errors are not cached.
- Errors become a `NexWallException` with `status` (401, 404, 422, 429, 0 for connection failures) and `retryAfter` (from the `Retry-After` header on 429). The Blade page shows the message; the JSON routes return it with the same status code and `Retry-After` header.
- The `/nexwall-api/*` routes are optional. Keep them only if a JavaScript frontend needs the data; `throttle:60,1` limits each visitor to 60 requests per minute.
- The client also has `categoryWallpapers($id, $params)` and `wallpaper($id)` for `GET /categories/{id}/wallpapers` and `GET /wallpapers/{id}`.
## Quick start: Vanilla JavaScript
Requires Node.js 18+. There is nothing to install.
```bash
cd vanilla-js
cp .env.example .env # then set NEXWALL_API_KEY=your_key_here
node server.mjs # http://localhost:3000
```
`server.mjs` loads `.env` automatically on Node 20.12+ / 21.7+. On older versions, set the variable yourself (`NEXWALL_API_KEY=your_key node server.mjs`, or in PowerShell `$env:NEXWALL_API_KEY="your_key"; node server.mjs`) or use `node --env-file=.env server.mjs` on Node 20.6+.
```
vanilla-js/
├── server.mjs # static server for ./public + /api/* proxy with in-memory cache
├── public/
│ ├── index.html
│ ├── styles.css
│ └── app.js # calls API_BASE (default "/api"), never NexWall directly
├── package.json # "npm start" / "npm run check"; no dependencies
└── .env.example
```
The proxy forwards only `GET /api/categories`, `/api/wallpapers`, `/api/wallpapers/{id}` and `/api/categories/{id}/wallpapers`, with the allow-listed query parameters. Successful (200) responses are kept in memory for `NEXWALL_CACHE_TTL` seconds (default 300, up to 500 entries); the response header `X-Proxy-Cache: HIT|MISS` shows which you got. The cache is per process and is cleared on restart.
### Use the same frontend with the Next.js or Laravel proxy
- **Next.js:** copy `vanilla-js/public/*` into `nextjs/public/` (for example `nextjs/public/vanilla/`) and open `/vanilla/index.html`. The Next.js route handlers already answer `/api/categories` and `/api/wallpapers`.
- **Laravel:** copy `vanilla-js/public/*` into your Laravel `public/nexwall/` folder and add this line to `index.html` before `app.js`:
```html
<script>window.NEXWALL_API_BASE = "/nexwall-api";</script>
```
Then open `/nexwall/index.html`.
Serving the frontend from the same origin as the proxy avoids any CORS setup.
### Calling the API directly from the browser (local experiments only)
The NexWall API sends `Access-Control-Allow-Origin: *`, so a browser page *can* call it directly:
```js
// LOCAL EXPERIMENTS ONLY. Anyone who opens DevTools can copy this key.
const res = await fetch("https://nexwall.kodnextech.com/api/developer/v1/wallpapers?per_page=10", {
headers: { Authorization: "Bearer YOUR_KEY", Accept: "application/json" },
});
```
That is handy for a quick test on your own machine, but the key is visible to every visitor and can be used to drain your quota. **Never ship a page that contains your key.** Use one of the proxies above.
## Keep your API key secret
- Put the key in `.env` / `.env.local` (all ignored by `.gitignore`) or in your host's secret settings. Commit only `.env.example`.
- In Next.js, never name it `NEXT_PUBLIC_...`; in Vite, never `VITE_...`. Those prefixes are inlined into the browser bundle.
- In Laravel, read it only through `config('nexwall.api_key')` on the server and never pass it to a Blade view or JavaScript.
- Keep the parameter allow-list and caching in your proxy, and consider rate limiting it (the Laravel routes use `throttle:60,1`).
- If a key ends up in a commit or a public page, treat it as compromised and replace it.
## API endpoints used
Base URL: `https://nexwall.kodnextech.com/api/developer/v1`
Every request sends `Authorization: Bearer <API_KEY>` and `Accept: application/json`.
| Endpoint | Next.js | Laravel | Vanilla JS proxy |
| --- | --- | --- | --- |
| `GET /categories` | `/api/categories` | `categories()`, `/nexwall-api/categories` | `/api/categories` |
| `GET /wallpapers?page=&per_page=&category_id=&type=&search=&sort=` | `/api/wallpapers` | `wallpapers()`, `/nexwall-api/wallpapers` | `/api/wallpapers` |
| `GET /categories/{id}/wallpapers` | | `categoryWallpapers()` | `/api/categories/{id}/wallpapers` |
| `GET /wallpapers/{id}` | | `wallpaper()` | `/api/wallpapers/{id}` |
Parameters: `per_page` 1-100 (default 50; these starters use 24); `type` is `image` or `live` (live requires Ultra); `search` is 2-100 characters and matches tags; `sort` is `newest`, `oldest`, `popular` or `random`. List responses include `current_page`, `last_page`, `per_page`, `total`, `plan` and `remaining_requests_today`.
Full reference: [API docs](https://nexwall.kodnextech.com/wallpaper-api/docs) · [OpenAPI spec](https://nexwall.kodnextech.com/openapi.json) · [Sandbox](https://nexwall.kodnextech.com/wallpaper-api/sandbox)
## Rate limits & plans
| Plan | Price | Requests per day | Content |
| --- | --- | --- | --- |
| Free | Free, no credit card | 100 | Non-premium categories |
| Pro | ₹399 / $4.99 per month | 10,000 | |
| Ultra | ₹899 / $10.99 per month | 50,000 | Includes live (video) wallpapers |
- The free plan also allows up to 60 requests per minute and one API key.
- Responses include `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` and `X-Developer-Api-Plan` headers; the JSON body includes `plan` and `remaining_requests_today`.
- When you run out, the API returns **HTTP 429** with a `Retry-After` header. The starters show the wait time and do not retry on their own.
- On a public website, 100 requests per day goes quickly even with caching. The free plan is meant for development and personal projects.
- **Commercial or monetized sites and apps** (ads, subscriptions, paid products, client work) need a **Pro or Ultra** plan under the [NexWall Developer API License](https://nexwall.kodnextech.com/wallpaper-api/license).
## Notes and limitations
- **Download:** the image files are served from a different origin than your site, and browsers ignore the `download` attribute on cross-origin links. Clicking "Download" therefore usually opens the image in a new tab, where it can be saved. A same-origin download route is left out to keep the proxies small.
- Live (video) wallpapers need the Ultra plan; the starters request `type=image` only.
- No automated tests are included. The code is checked with `npm run typecheck` / `next build` (Next.js), `php -l` (Laravel PHP files) and `node --check` (vanilla-js); the Laravel files have not been run inside every Laravel version listed.
## Related starters
- [Flutter wallpaper app](https://github.com/kodnextechnologies/nexwall-flutter-wallpaper-app)
- [Android Kotlin wallpaper app (Jetpack Compose)](https://github.com/kodnextechnologies/nexwall-android-kotlin-wallpaper-app)
- [React Native / Expo wallpaper app](https://github.com/kodnextechnologies/nexwall-react-native-expo-wallpaper-app)
- [Python client and CLI with a daily wallpaper changer](https://github.com/kodnextechnologies/nexwall-python)
## License
The source code is released under the [MIT License](LICENSE).
Wallpaper images and videos returned by the API are **not** covered by the MIT license. Their use is governed by the [NexWall Developer API License](https://nexwall.kodnextech.com/wallpaper-api/license).
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

ai-website-cloner-template
Clone any website with one command using AI coding agents
Next.js · 启动器

Next.js SaaS Starter
Next.js SaaS Starter 是 Next.js 官方维护的 SaaS 起点模板,定位介于学习资源和可直接部署的脚手架之间。
Next.js · SaaS

Next.js Commerce
Next.js Commerce 是 Vercel 团队维护的电商启动模板,基于 Next.js App Router 构建,采用服务端渲染、React Server Components、Server Actions …
Next.js · 电商

Next-js-Boilerplate
Next-js-Boilerplate 是一个面向 Next.js 16、Tailwind CSS 4 和 TypeScript 的启动器,核心定位是开发者体验优先。
Next.js · 启动器

tailwind-nextjs-starter-blog
tailwind-nextjs-starter-blog 是一个面向个人技术博客的 Next.js 与 Tailwind CSS 启动模板,其 v2 版本基于 App Router 与 React Server Comp…
Next.js · 博客

next-forge
Production-grade Turborepo template for Next.js apps.
Next.js · 启动器
