npm install
npm run setup
# Edit server/.env.local and client/.env.local with your valuesnpm run devRuns on:
- Client: http://localhost:3000
- API: http://localhost:8080
npm run build
npm startCreate server/.env.local:
NODE_ENV=development
PORT=8080
MONGO_URI=mongodb://localhost:27017/taskstars
JWT_SECRET=dev-secret-key
CLIENT_URL=http://localhost:3000
SERVER_URL=http://localhost:8080
GOOGLE_CLIENT_ID=your-dev-google-id
GOOGLE_CLIENT_SECRET=your-dev-google-secret
GITHUB_CLIENT_ID=your-dev-github-id
GITHUB_CLIENT_SECRET=your-dev-github-secretCreate client/.env.local:
NEXT_PUBLIC_API_URL=http://localhost:8080
NEXT_PUBLIC_SOCKET_URL=http://localhost:8080Create server/.env.production:
NODE_ENV=production
PORT=8080
MONGO_URI=your-mongodb-atlas-uri
JWT_SECRET=strong-random-production-secret
CLIENT_URL=https://taskstars.onrender.com
SERVER_URL=https://taskstars.onrender.com
GOOGLE_CLIENT_ID=your-prod-google-id
GOOGLE_CLIENT_SECRET=your-prod-google-secret
GITHUB_CLIENT_ID=your-prod-github-id
GITHUB_CLIENT_SECRET=your-prod-github-secretCreate client/.env.production:
NEXT_PUBLIC_API_URL=https://taskstars.onrender.com
NEXT_PUBLIC_SOCKET_URL=https://taskstars.onrender.com| What You Want | Command | Requires |
|---|---|---|
| Develop locally | npm run dev |
.env.local files |
| Run production build | npm start |
.env.production files |
| Build for production | npm run build |
Nothing special |
CORS errors?
→ Check CLIENT_URL in server/.env.local
OAuth not working?
→ Verify callback URLs use the correct SERVER_URL
Can't connect to database?
→ Check MONGO_URI format and MongoDB is running
Changes not taking effect?
→ Restart the server after editing .env files
- ✅
.envfiles are gitignored - ✅ Never commit secrets to git
- ✅ Use different OAuth apps for dev/prod
- ✅ Use strong JWT secrets in production
See ENVIRONMENT_SETUP.md for complete documentation.