Spaces:
Running
Running
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
- Go to huggingface.co/spaces/Vijayadhith7/acadflow
- Click the Files tab
- Upload all files from this
deploy-backendfolder- Upload everything EXCEPT
credentials.jsonand.env.example - The
Dockerfiletells HF how to build and run the app
- Upload everything EXCEPT
βοΈ 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:
- Open the
credentials.jsonfile in this folder - Copy the entire contents (the full JSON object)
- Minify it to a single line (remove newlines) β you can use jsonminify.com
- Paste the minified JSON as the value of
GOOGLE_CREDS_JSONsecret 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=5000is 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.jsonto the HF Space files β use theGOOGLE_CREDS_JSONsecret instead - DO NOT upload
.envor.env.exampleβ use HF Secrets for all sensitive values - The
notifications.jsonfile provides initial mock notifications; it gets updated at runtime