# HeartMatch

HeartMatch is an MVP iOS dating app inspired by swipe-based matching apps. This repo now includes a backend shaped for deployment behind `tamilcanada.com`.

- A native SwiftUI iPhone client in `HeartMatch/`
- A zero-dependency Node 24 backend with SQLite in `server/`
- A Dockerfile so you can deploy the backend on your own server

## What is included

- Password-based sign up and login
- Swipe deck with like and pass actions
- Automatic match creation on mutual likes
- Match list and chat list
- In-app chat for matched users
- Editable profile screen
- Seeded demo profiles so the app feels alive immediately
- Admin login endpoints for backend/dashboard access

## Project structure

- `HeartMatch.xcodeproj`: Xcode project for the iOS app
- `HeartMatch/`: SwiftUI source files
- `server/index.js`: API server and SQLite schema
- `server/Dockerfile`: container image for deployment

## Run the backend locally

The backend uses only built-in Node modules. Node `24.x` is recommended because this scaffold uses the built-in `node:sqlite` module.

```bash
node server/index.js
```

The API starts on `http://127.0.0.1:8080` by default.

Optional environment variables are documented in [server/.env.example](/Users/mayukutty/Documents/New%20project%204/server/.env.example).

Health check:

```bash
curl http://127.0.0.1:8080/api/health
```

## Open the iOS app

1. Open [HeartMatch.xcodeproj](/Users/mayukutty/Documents/New project 4/HeartMatch.xcodeproj).
2. Choose an iPhone simulator.
3. Build and run the `HeartMatch` scheme.

The app is configured to talk to `http://127.0.0.1:8080`, which works in the simulator.

If you run the app on a physical iPhone, update `baseURLString` in [AppConfig.swift](/Users/mayukutty/Documents/New project 4/HeartMatch/AppConfig.swift) to your Mac IP or production domain.

## Deploy the backend to your server

### Option 1: plain Node on a VPS

1. Install Node `24.x` on the server.
2. Upload the `server/` folder.
3. Run:

```bash
PORT=8080 \
HOST=0.0.0.0 \
ALLOWED_ORIGINS=https://tamilcanada.com,https://www.tamilcanada.com \
ADMIN_EMAIL=admin@tamilcanada.com \
ADMIN_PASSWORD='change-this-now' \
node server/index.js
```

4. Put Nginx or Caddy in front of it and proxy `/api` from `tamilcanada.com` to this Node server.
5. If you want the iOS app to use production directly, change `baseURLString` to `https://tamilcanada.com`.

### Option 2: Docker

```bash
cd server
docker build -t heartmatch-api .
docker run -d -p 8080:8080 --name heartmatch-api heartmatch-api
```

## API summary

- `POST /api/auth/signup`
- `POST /api/auth/login`
- `POST /api/admin/login`
- `GET /api/admin/me`
- `GET /api/admin/stats`
- `GET /api/admin/users`
- `GET /api/me`
- `PUT /api/me`
- `GET /api/discover`
- `POST /api/swipes`
- `GET /api/matches`
- `GET /api/chats`
- `GET /api/matches/:matchId/messages`
- `POST /api/matches/:matchId/messages`

All authenticated routes expect:

```text
Authorization: Bearer <token>
```

## Default credentials

Demo user password:

```text
TamilLove123!
```

Default admin login:

```text
email: admin@tamilcanada.com
password: ChangeMeNow123!
```

Change the admin password immediately in production with the `ADMIN_PASSWORD` environment variable.

## Next steps for a production app

- Add phone OTP or Apple Sign In
- Add image upload with S3 or Cloudflare R2
- Add moderation and reporting
- Add push notifications
- Move from local SQLite to PostgreSQL
- Add realtime chat via WebSockets
