Spaces:
Sleeping
Sleeping
| title: AcadFlow Backend | |
| emoji: π | |
| colorFrom: indigo | |
| colorTo: purple | |
| sdk: docker | |
| app_port: 5000 | |
| pinned: false | |
| # AcadFlow Backend - Hugging Face Spaces Deployment | |
| ## π Deploy to Hugging Face Spaces | |
| ### Step-by-Step Upload | |
| 1. **Go to** [huggingface.co/spaces/Vijayadhith7/acadflow](https://huggingface.co/spaces/Vijayadhith7/acadflow) | |
| 2. **Click** the **Files** tab | |
| 3. **Upload** all files from this `deploy-backend` folder | |
| - Upload everything EXCEPT `credentials.json` and `.env.example` | |
| - The `Dockerfile` tells HF how to build and run the app | |
| ### βοΈ Environment Variables (CRITICAL - Set as Secrets) | |
| Go to **Settings β Repository Secrets** and add: | |
| | Secret Name | Value | | |
| |-------------|-------| | |
| | `PORT` | `5000` | | |
| | `SUPABASE_URL` | `https://wmmcziautjlelocrprms.supabase.co` | | |
| | `SUPABASE_KEY` | `sb_publishable_G80nBYUkRqC3j2X6sevnnQ_9glfZ1dT` | | |
| | `SPREADSHEET_ID` | `1-FuEPAmLyBQFu5V3of6bY6IiF7FWiD1_-QAp0lvLCWY` | | |
| | `GOOGLE_CREDS_JSON` | *(see below)* | | |
| ### π Setting GOOGLE_CREDS_JSON | |
| The `credentials.json` file contains your Google Service Account keys. For Hugging Face: | |
| 1. Open the `credentials.json` file in this folder | |
| 2. Copy the **entire contents** (the full JSON object) | |
| 3. Minify it to a single line (remove newlines) β you can use [jsonminify.com](https://www.jsonminify.com) | |
| 4. Paste the minified JSON as the value of `GOOGLE_CREDS_JSON` secret in HF Settings | |
| **Example** (shortened): | |
| ``` | |
| {"type":"service_account","project_id":"academy-dashboard-497400","private_key_id":"b7174c...","private_key":"-----BEGIN PRIVATE KEY-----\nMIIEv...","client_email":"id-academy-crm-dashboard@academy-dashboard-497400.iam.gserviceaccount.com",...} | |
| ``` | |
| ### π Port Configuration | |
| - The app runs on port **5000** (not 7860, since your Aura project uses that) | |
| - Hugging Face will automatically proxy to whatever port your container exposes | |
| - Make sure `PORT=5000` is set in your HF Secrets | |
| ### π Structure | |
| ``` | |
| deploy-backend/ | |
| βββ Dockerfile # HF Spaces Docker build config | |
| βββ .env.example # Environment variable template (DON'T upload this) | |
| βββ credentials.json # Google Service Account key (DON'T upload - use secrets) | |
| βββ package.json # Dependencies | |
| βββ server.js # Express + Socket.IO server | |
| βββ db.js # Supabase database client | |
| βββ notifications.json # Local notification storage | |
| βββ services/ | |
| β βββ aiEngine.js # NVIDIA NIM AI insights engine | |
| β βββ googleSheets.js # Google Sheets sync service | |
| βββ database/ | |
| βββ schema.sql # Database schema reference | |
| βββ init-db.js # Database initialization script | |
| βββ ... # Other DB utility scripts | |
| ``` | |
| ### β οΈ Important Notes | |
| - **DO NOT** upload `credentials.json` to the HF Space files β use the `GOOGLE_CREDS_JSON` secret instead | |
| - **DO NOT** upload `.env` or `.env.example` β use HF Secrets for all sensitive values | |
| - The `notifications.json` file provides initial mock notifications; it gets updated at runtime | |