# Upload Guide

This pilot is a small Node.js web app. It stores pilot data in `data/db.json`.

## Files To Upload

Upload these files and folders:

```text
server.js
package.json
README.md
UPLOAD_GUIDE.md
public/
```

You do not need to upload `data/db.json`. The app will create it automatically online.

Do not upload:

```text
.git/
attendance-pilot-upload.zip
```

## Recommended Hosting

Use any hosting service that supports Node.js, for example Render, Railway, Fly.io, DigitalOcean App Platform, or a VPS.

The host should support:

- Node.js
- HTTPS
- Persistent disk/storage if you want attendance data to survive redeploys

HTTPS is important because mobile browsers usually require HTTPS before allowing GPS/location access.

## Environment Settings

Set this environment variable on your host:

```text
ADMIN_PIN=choose-a-strong-admin-pin
```

Many hosts set `PORT` automatically. If your host does that, leave `PORT` alone.

## Build And Start Commands

Build command:

```text
npm install
```

Start command:

```text
npm start
```

The app currently has no external packages, so install should be quick.

## Render-Style Deployment Steps

1. Create a new Web Service.
2. Upload this folder or connect the GitHub repository.
3. Select Node.js.
4. Set build command to `npm install`.
5. Set start command to `npm start`.
6. Add `ADMIN_PIN` as an environment variable.
7. Deploy.
8. Open the HTTPS URL on a phone.
9. In Admin, create a class session and tap "Use my location" while physically in the class.
10. Students open the same HTTPS URL, register once, allow location, enter the class code, and mark attendance.

## Production Upgrade Notes

This is enough for a pilot test, but a real university deployment should later add:

- Proper admin and student login
- PostgreSQL or MySQL database
- Lecturer/course roles
- Device-change approval workflow
- Audit logs
- Backups
- Fake GPS/emulator detection signals
- CSV or Excel export
