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: ```bash git clone https://github.com/yourusername/snipeit-lostnfound.git cd snipeit-lostnfound ```
-
Install dependencies: ```bash npm install ```
-
Configure local environment variables: Create a file named `.dev.vars` in the root directory and add your Snipe-IT credentials: ```env SNIPEIT_URL=https://your-snipeit-instance.com SNIPEIT_TOKEN=your_personal_access_token ``` (Note: Never commit this file. It is ignored by
.gitignore.) -
Start the local development server: ```bash 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.
MIT