Skip to content

Example App

Read the Receipts reference app, a Laravel Rust app with sign-in, camera photos, shared validation, biometrics, and notifications, and run it on your own machine.

Introduction

Receipts is a small app for keeping a photo of each receipt. It’s the reference app for Lairport, and the best place to see the guides in this documentation working together. It runs on iOS and Android from the same code as its web version. A copy runs on Laravel Cloud at laravel-mobile-receipts-production-xgpvxg.laravel.cloud.

The app lives in examples/receipts in the repository. It starts as a Laravel Rust project, created with laravel new receipts --rust, and laravel-mobile init adds the native app. It uses SQLite on your machine, so you don’t need a database server. On Laravel Cloud, attach a Postgres database, and DATABASE_URL switches the app to it.

What It Shows

Each feature in Receipts is a short piece of code you can read:

Feature Where to look
Registration, login, and a session that survives relaunches src/http/handlers/auth.rs, which uses Laravel Rust’s session guard
A photo from the camera <input type="file" capture> in resources/js/pages/Receipts/Create.tsx, and [permissions] camera in mobile.toml
One amount rule for the server and the app crates/shared. The server validates with parse_amount, and the app checks the amount as you type through the check_amount command in apps/mobile/src/lib.rs
Face ID or a fingerprint before deleting mobile.biometrics in resources/js/pages/Receipts/Index.tsx
A notification and a haptic when a receipt is saved mobile.notifications and mobile.haptics in resources/js/pages/Receipts/Create.tsx

In a browser, the same pages work without the native parts. Deleting asks with confirm(), and the amount is checked when you submit the form.

Run It

From examples/receipts, copy the environment file, install the dependencies, create the database, and start the server:

cp .env.example .env
npm install
laravel key:generate
laravel migrate
laravel dev

Open http://localhost:8000 in a browser to try the web version. To run the native app on an Android phone or emulator, start it in another terminal:

laravel-mobile dev android

Build It

Before you build for a store, set server.url in mobile.toml to the address of your deployed app. Then build a release and upload it to Google Play:

laravel-mobile build android --release
laravel-mobile submit android

submit is new in 0.1.2. See Building Your App for the upload key and the other release steps.

Test It

Run the Rust tests from examples/receipts:

cargo test

Next Steps

Type to search…

↑↓ navigate↵ selectEsc close