acadflow / README.md
Vijayadhith7's picture
Upload 16 files
3d777f1 verified
metadata
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
  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
  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