A Node.js/Express backend server for the WTWR application with user authentication, clothing item management, and weather-based recommendations.
- Frontend: https://testwtwr.jumpingcrab.com
- Backend API: https://api.testwtwr.jumpingcrab.com
- Node.js (v22+)
- MongoDB
- Git
# Clone the repository
git clone https://github.com/zimmermanjosh/se_project_express.git
cd se_project_express
# Install dependencies
npm run prebuild
# Start MongoDB
brew services start mongodb-community
# Seed the database
npm run seedUser
npm run seedClothing
# Start development server
npm run dev├.
├── README.md
├── app.js
├── controllers
│ ├── clothingItems.js
│ └── users.js
├── error.log
├── middlewares
│ ├── auth.js
│ ├── logger.js
│ └── validator.js
├── models
│ ├── clothingItem.js
│ └── user.js
├── package.json
├── request.log
├── resources
│ ├── NOTES.MD
│ ├── db.json
│ ├── seedClothingitems.js
│ └── seeduser.js
├── routes
│ ├── clothingItems.js
│ ├── index.js
│ └── users.js
├── sprint.txt
└── utils
├── config.js
├── cryptoGen.js
├── errors.js
└── serverHelp.sh
| Command | Description |
|---|---|
npm start |
Start production server |
npm run dev |
Start development server with nodemon |
npm run prebuild |
Clean install dependencies |
npm run seedUser |
Seed database with test users |
npm run seedClothing |
Seed database with clothing items |
npm run lint |
Run ESLint |
npm run db:start |
Start MongoDB and open shell |
npm run db:stop |
Stop MongoDB |
# Start service
brew services start mongodb-community
# Verify it's running
brew services list
# Open MongoDB shell
mongosh# Create test users
npm run seedUser
# Add clothing items
npm run seedClothingCreate a .env file in the root directory:
JWT_SECRET=your-super-secret-jwt-key
JWT_EXPIRATION_TIME=7d
NODE_ENV=developmentPOST /signin- User loginPOST /signup- User registration
GET /users/me- Get current userPATCH /users/me- Update user profile
GET /items- Get all clothing itemsPOST /items- Create new clothing itemDELETE /items/:itemId- Delete clothing itemPUT /items/:itemId/likes- Like itemDELETE /items/:itemId/likes- Unlike item
- JWT-based authentication
- Password hashing with bcrypt
- Request validation with Joi/Celebrate
- CORS protection
- Environment variable protection
- Request logging with Winston
- Error logging and tracking
- PM2 process management in production
The application is deployed using:
- Server: Google Cloud VM
- Process Manager: PM2
- Web Server: Nginx
- SSL: Let's Encrypt certificates
- Database: MongoDB
The application includes PM2 auto-recovery. Test with:
curl https://api.testwtwr.jumpingcrab.com/crash-test# Test user credentials
Email: joshtarget@example.com
Password: mypassword123# Restart MongoDB
brew services restart mongodb-community
# Check status
brew services list | grep mongodb# Restart application
pm2 restart app --update-env
# View logs
pm2 logs app
# Check status
pm2 statusCurrently on Sprint 15 - Full deployment with authentication and security features.
- [Avatar Generator]
- Frontend Repository
Author: Joshua Zimmerman
License: ISC