This is a Next.js project bootstrapped with create-next-app.
npm install
# or
yarn install
# or
pnpm install
# or
bun installThis project requires HTTPS for local development. Use mkcert to generate trusted local SSL certificates:
macOS:
brew install mkcert
brew install nss # if you use FirefoxLinux:
# Arch Linux
sudo pacman -S mkcert
# Ubuntu/Debian
sudo apt install mkcert
# Or install manually
curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64"
chmod +x mkcert-v*-linux-amd64
sudo mv mkcert-v*-linux-amd64 /usr/local/bin/mkcertWindows:
choco install mkcertmkcert -install# Generate .pem certificates (for server)
mkcert localhost 127.0.0.1 ::1 <HOST_IP>
# This creates:
# - localhost+3.pem (certificate)
# - localhost+3-key.pem (private key)Android devices require PKCS#12 (.p12) format certificates for trusted HTTPS connections:
# Convert .pem to .p12 format
openssl pkcs12 -export -out client_full.p12 \
-inkey localhost+3-key.pem \
-in localhost+3.pem \
-name "<NAME_CERTIFICATE>"
-password pass:'<PASSWORD>'
- Transfer
client_full.p12to your Android device (via email, cloud storage, or USB) - Open Settings → Security → Encryption & credentials
- Tap Install a certificate → CA certificate
- Browse and select
client_full.p12 - If prompted for a password, insert password and press OK
- Name the certificate (e.g., "Localhost Development")
Firefox for Android requires additional steps to trust the certificate:
- Open Firefox on your Android device
- Navigate to
about:configin the address bar - Search for
security.enterprise_roots.enabled - Toggle it to
true(this allows Firefox to use system certificates) - Alternatively, import the certificate directly into Firefox:
- Type
about:certificatein the address bar - Tap Import or Add Certificate
- Select
client_full.p12from your device - Enter the password when prompted
- Firefox will now trust the certificate for HTTPS connections
- Type
Note: If about:certificate doesn't work, you can also:
- Visit your HTTPS site (e.g.,
https://YOUR_LOCAL_IP) - Click on the warning/lock icon
- Select "Add Exception" or "Continue to site"
- Firefox will add the certificate to its trusted list
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devThe Next.js app will run on http://localhost:3000
Caddy provides a reverse proxy with automatic HTTPS for local development, making it easier to access the app from mobile devices on the same network.
macOS:
brew install caddyLinux:
# Debian/Ubuntu
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddyWindows:
choco install caddycaddy run --config CaddyfileCaddyfile Configuration:
- Runs on port 3001 (HTTPS)
- Proxies requests to Next.js (port 3000) and OCR server (port 3002)
- Automatically handles SSL/TLS with the generated certificates
- Enables access from other devices on the local network
What Caddy Does:
- Acts as a reverse proxy to route traffic to the correct services
- Provides HTTPS encryption using the mkcert certificates
- Enables mobile device testing on the same network
- Routes
/api/ocr-uploadto the OCR server (port 3002) - Routes all other requests to the Next.js app (port 3000)
With Caddy running:
- HTTPS:
https://<HOST_IP>:3001 - From Mobile:
https://<HOST_IP>:3001(find your local IP withipconfigorifconfig)
Without Caddy:
- Next.js:
http://localhost:3000 - OCR Server:
https://localhost:3002
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.