This project has been migrated from Supabase to a custom Node.js + MongoDB backend.
NorthLing/
├── backend/ # Node.js + Express + MongoDB backend
│ ├── src/
│ │ ├── config/ # Database configuration
│ │ ├── models/ # Mongoose models
│ │ ├── routes/ # API routes
│ │ ├── middleware/ # Auth middleware
│ │ └── server.ts # Main server file
│ ├── package.json
│ └── tsconfig.json
├── src/ # React frontend
│ ├── lib/
│ │ └── api-client.ts # API client (replaces Supabase)
│ ├── pages/
│ ├── components/
│ └── ...
└── package.json
Option A: Local MongoDB
- Download and install MongoDB Community Server from https://www.mongodb.com/try/download/community
- Start MongoDB service:
# Windows net start MongoDB # macOS/Linux sudo systemctl start mongod
Option B: MongoDB Atlas (Cloud)
- Create a free account at https://www.mongodb.com/cloud/atlas
- Create a cluster and get your connection string
- Update
MONGODB_URIinbackend/.env
# Navigate to backend directory
cd backend
# Install dependencies
npm install
# Create .env file
copy .env.example .env
# Update .env with your MongoDB connection string
# MONGODB_URI=mongodb://localhost:27017/northling
# or
# MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/northling
# Start development server
npm run devThe backend will run on http://https://northling-backend.onrender.com/
# Navigate to root directory
cd ..
# Install dependencies (removes Supabase packages)
npm install
# Create .env file
copy .env.example .env
# Start development server
npm run devThe frontend will run on http://https://northling.vercel.app//
PORT=2000
MONGODB_URI=mongodb://localhost:27017/northling
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
NODE_ENV=development
CORS_ORIGIN=http://https://northling.vercel.app//
VITE_API_URL=http://https://northling-backend.onrender.com//api
All endpoints are prefixed with /api
POST /api/auth/signup- Register new userPOST /api/auth/signin- Login userGET /api/auth/me- Get current user (requires auth)PATCH /api/auth/profile- Update user profile (requires auth)POST /api/auth/signout- Logout user
GET /api/preferences- Get user preferences (requires auth)PATCH /api/preferences- Update preferences (requires auth)
GET /api/progress- Get user progress (requires auth)PATCH /api/progress- Update progress (requires auth)GET /api/progress/leaderboard- Get leaderboard
GET /api/activities- Get user activities (requires auth)POST /api/activities- Create activity (requires auth)GET /api/activities/all- Get all activities (admin)
- ✅ Supabase client and all related files
- ✅
@supabase/supabase-jspackage - ✅
/supabasedirectory - ✅
/src/integrations/supabasedirectory
- ✅ Node.js + Express backend
- ✅ MongoDB with Mongoose ODM
- ✅ JWT authentication
- ✅ API client for frontend
- ✅ User, UserPreferences, UserProgress, Activity models
- ✅ AuthPage to use new API client
- ✅ All authentication flows
- ✅ Package.json (removed Supabase)
cd backend
npm run dev # Start with hot reload
npm run build # Build for production
npm start # Start production servernpm run dev # Start Vite dev server
npm run build # Build for production- Set environment variables on your hosting platform
- Ensure MongoDB is accessible (use MongoDB Atlas for cloud)
- Build and deploy:
cd backend npm run build npm start
- Update
VITE_API_URLto your production backend URL - Build and deploy:
npm run build
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB
- ODM: Mongoose
- Authentication: JWT (jsonwebtoken)
- Security: Helmet, bcryptjs
- Validation: express-validator
- Language: TypeScript
- Framework: React + Vite
- UI: Shadcn/ui + Tailwind CSS
- Routing: React Router
- State: React Query
- Language: TypeScript
- Check if MongoDB is running
- Verify
MONGODB_URIin.env - Check if port 2000 is available
- Verify backend is running on port 2000
- Check
VITE_API_URLin frontend.env - Check CORS settings in backend
- Clear browser localStorage
- Check JWT_SECRET is set in backend
.env - Verify token is being sent in Authorization header