A lightweight, serverless application designed to act as a public-facing "Lost and Found" portal for devices managed in Snipe-IT.
When a user scans an asset's QR code or visits the URL (e.g., https://lost.yourdomain.com/ASSET-TAG), this application fetches the asset data directly from the Snipe-IT API and displays a responsive, mobile-friendly information card.
Designed to be deployed for free on Cloudflare Pages using Edge Functions.
- Serverless Architecture: Runs entirely on Cloudflare Pages Functions. No Docker or server maintenance required.
- Real-time API Proxy: Safely proxies requests to the Snipe-IT API without exposing your API token to the public frontend.
- Smart Contact Routing: Automatically fetches contact information (Email/Phone) from the organization assigned to the asset.
- "Lost" Status Detection: Displays a prominent warning banner if the device is marked as "Lost" in Snipe-IT.
- Custom Overrides via Notes: Supports special keywords in the Snipe-IT asset or company notes:
hidecontact: Forces the contact section to be hidden.showcontact: Forces the contact section to be shown (default is only showing if marked as "Lost").customcontact: Your custom text here: Replaces the default contact info with your own specific message.
- A running Snipe-IT instance.
- A Snipe-IT API Token (generated in your Snipe-IT user profile).
- Node.js (v18+) for local development.
-
Clone the repository:
git clone https://github.com/yourusername/snipeit-lostnfound.git cd snipeit-lostnfound -
Install dependencies:
npm install
-
Configure local environment variables: Create a file named
.dev.varsin the root directory and add your Snipe-IT credentials:SNIPEIT_URL=https://your-snipeit-instance.com SNIPEIT_TOKEN=your_personal_access_token
(Note: Never commit this file. It is ignored by .gitignore.)
4. Start the local development server:
npm run dev
Open http://localhost:3000/YOUR-ASSET-TAG in your browser to test.
Deployment is completely automated via Git integration.
- Push this repository to GitHub or GitLab.
- Log in to your Cloudflare Dashboard and navigate to Workers & Pages.
- Click Create -> Pages -> Connect to Git.
- Select your repository.
- In the build settings:
- Framework preset: None
- Build command: (leave empty)
- Build output directory:
public(or leave empty if you don't use static assets)
- Crucial Step: Scroll down to Environment variables (advanced) and add:
SNIPEIT_URL(e.g.,https://your-snipeit-instance.com)SNIPEIT_TOKEN(your secret API token)
- Click Save and Deploy.
Cloudflare will now automatically deploy your function. Whenever you push changes to your main branch, Cloudflare will update the live site within seconds.
AI-Generated Code Please note that the code in this repository was generated and programmed with the assistance of Artificial Intelligence (AI). While the code has been tested for its intended functionality, it is highly recommended that you review and understand the code before deploying it to production environments.
This project is licensed under the MIT License.
Commercial and private use, modification, and distribution are permitted. However, the original copyright notice and the permission notice must be included in all copies or substantial portions of the software (Attribution required). See the LICENSE file for full details.