A comprehensive attendance management system featuring a Flutter mobile application and a Node.js backend. This project handles user authentication, live face verification via ML Kit, precise geofence checking, and offline queue synchronization.
attendance_management_system/: The Flutter frontend application.backend/: The Node.js and Express backend server, with PostgreSQL & Prisma.
Your Node.js backend handles all authentication, business logic, and geofence verification.
Ensure that your PostgreSQL server (like Postgres.app or Docker) is running on your Mac.
Open the backend/.env file and verify your credentials are correct. It should look like this:
DATABASE_URL="postgresql://USERNAME:PASSWORD@localhost:5432/attendance_db?schema=public"
JWT_SECRET="your_super_secret_key"
PORT=3000Open a terminal in the backend/ folder and run the following commands:
# 1. Install all backend dependencies
npm install
# 2. Push the Prisma Schema to your database (creates tables)
npx prisma migrate dev --name init
# 3. Seed initial data (Creates 1 Admin, 1 Employee, and 1 Geofence)
npx prisma db seednpm run dev(Leave this terminal open. You should see "Server running on port 3000")
If you want to look at the raw database tables, users, and attendances via a clean web GUI, open a new terminal in the backend/ folder and run:
npx prisma studioThis will automatically open your web browser to http://localhost:5555 where you can manually view and edit your data!
Because you are using a real phone, your phone cannot use localhost or 10.0.2.2 to connect to the computer's backend. They are two different physical devices. Your phone must connect to your Mac's external Wi-Fi IP address.
Open a new terminal tab and run this command to find your Mac's IP address:
ipconfig getifaddr en0(Example output: 192.168.1.45)
Ensure your physical phone and your Mac are connected to the exact same Wi-Fi network.
Open attendance_management_system/lib/core/constants/api_constants.dart.
Change the baseUrl string to use the IP address you found in Step 1.
// Change this:
static const String baseUrl = 'http://10.0.2.2:3000/api';
// To this (Use YOUR specific IP address):
static const String baseUrl = 'http://192.168.1.45:3000/api'; - Plug your physical Android or iPhone into your Mac via USB.
- Ensure Developer Mode & USB Debugging are enabled on your phone.
- Open a terminal inside the
attendance_management_system/folder. - Run:
# Get Flutter dependencies
flutter pub get
# Launch the app on your physical device
flutter runOnce the app opens on your phone, test the core system flows to ensure hardware configurations are properly tuned:
- Goal: Ensure the app can successfully reach your Node.js server.
- Action: Try logging in with the default seeded credentials. Check your backend terminal—you should see a
[POST] /auth/loginnetwork log hit the server!
- Goal: Verify OS permissions and ML Kit capabilities.
- Action: Tap "Record Check-In". The app will prompt you for Camera Permissions. Allow it. Verify the camera stream starts smoothly and doesn't crash the app.
- Goal: Check if the device's native GPS hooks are working.
- Action: When you attempt to check in, look at the VS Code debug console. The
AppLoggerwill print:🔵 [INFO] GPS retrieved: [12.9716, 77.5946]. - Note: If it says you are out of bounds, you will need to log into the Admin Account, go to Locations, and create a Geofence explicitly covering the real-world GPS coordinates of your current house/office!
- Goal: Verify resilience against total network failure.
-
- Pull down your phone's status bar and turn Airplane Mode ON.
-
- Attempt a Check-Out. You will see a warning that the network is dead, but it has been queued locally.
-
- Turn Airplane Mode OFF.
-
- Pull-to-refresh the screen or navigate away and back.
-
- Look at your VSCode Terminal;
AppLoggershould trace an event verifying the background queue successfully purged the data to the backend!
- Look at your VSCode Terminal;