Empowering communities through resource sharing
A robust, scalable REST API built with Node.js and Express.js that powers a community-driven platform for sharing resources and connecting neighbors. This project demonstrates modern backend development practices, secure authentication, and cloud-native deployment strategies.
- API Base URL: https://ii-practicum-team-1-back.onrender.com
- Frontend Application: https://ii-practicum-team-1-front.onrender.com/
- JWT-based authentication with refresh tokens
- Google OAuth 2.0 integration for social login
- Password reset with secure email verification
- Account lockout protection against brute force attacks
- Input validation and sanitization using Joi
- Rate limiting to prevent API abuse
- Complete user registration and profile management
- Email verification system with secure tokens
- Avatar upload and management via Cloudinary
- Zip code-based location services
- Full CRUD operations for shared items
- 14 predefined categories (Books, Electronics, Tools, etc.)
- Advanced search and filtering capabilities
- Image upload with automatic optimization
- Geolocation-based item discovery
- Secure item exchange tracking
- Transaction history and status management
- Delivery coordination features
- Built-in feedback and rating system
- Automated email notifications via Nodemailer
- SMTP integration for reliable delivery
- Transactional email templates
- Node.js - Runtime environment
- Express.js - Web application framework
- Sequelize ORM - Database management with PostgreSQL
- Passport.js - Authentication middleware
- bcrypt - Password hashing
- jsonwebtoken - JWT implementation
- express-rate-limit - API rate limiting
- PostgreSQL on Render - Production database
- Cloudinary - Image storage and optimization
- Render - Application hosting and deployment
- Nodemon - Development server with hot reload
- Jest - Testing framework
- cross-env - Environment variable management
- Morgan - HTTP request logging
src/
βββ controllers/ # Business logic and request handling
βββ models/ # Database models and relationships
βββ routes/ # API endpoint definitions
βββ middleware/ # Custom middleware functions
βββ services/ # External service integrations
βββ validators/ # Input validation schemas
βββ config/ # Database and service configurations
βββ errors/ # Custom error handling classes
- Normalized relational database with proper foreign key constraints
- User-centric design with email as primary identifier
- Transaction tracking with status management
- Image metadata storage with Cloudinary integration
- Automated timestamps for audit trails
- RESTful endpoints following HTTP standards
- Consistent error handling with proper status codes
- Input validation on all routes
- Pagination support for large datasets
- CORS configuration for cross-origin requests
npm run db:setup # Full database initialization
npm run db:reset # Quick database restoration
npm run build # Production deployment preparation- Multi-environment support (development, testing, production)
- Secure environment variable management
- Database connection pooling for optimal performance
- SSL/TLS enforcement in production
- Health check endpoints for monitoring
- Graceful error handling with custom error classes
- Request logging for debugging and analytics
- Connection retry logic for database resilience
- Node.js 18+ installed
- PostgreSQL database (local or cloud)
- Cloudinary account for image storage
# Clone the repository
git clone https://github.com/Code-the-Dream-School/ii-practicum-team-1-back.git
# Install dependencies
cd ii-practicum-team-1-back
npm install
# Set up environment variables
cp .env.example .env
# Edit .env with your configuration
# Initialize database
npm run db:setup
# Start development server
npm run devnpm run dev # Development server with hot reload
npm start # Production server
npm test # Run test suite
npm run db:migrate # Run database migrations
npm run db:seed # Populate initial data
npm run db:reset # Complete database resetPOST /api/v1/auth/register- User registrationPOST /api/v1/auth/login- User loginPOST /api/v1/auth/logout- User logoutPOST /api/v1/auth/reset-password- Password reset
GET /api/v1/google-auth/google- Initiate Google OAuthGET /api/v1/google-auth/google/callback- OAuth callback
GET /api/v1/users/profile- Get user profilePUT /api/v1/users/profile- Update user profilePOST /api/v1/users/avatar- Upload user avatar
GET /api/v1/items- List items with pagination/filteringPOST /api/v1/items- Create new itemGET /api/v1/items/:id- Get item detailsPUT /api/v1/items/:id- Update itemDELETE /api/v1/items/:id- Delete item
POST /api/v1/reviews- Submit reviewGET /api/v1/reviews/:userId- Get user reviews
- Input Validation: All inputs validated using Joi schemas
- SQL Injection Protection: Sequelize ORM with parameterized queries
- XSS Prevention: Input sanitization and output encoding
- CSRF Protection: Token-based request validation
- Rate Limiting: API abuse prevention
- Secure Headers: Helmet.js integration
- Password Security: bcrypt hashing with salt rounds
- Database Indexing: Optimized queries with proper indexes
- Connection Pooling: Efficient database connection management
- Image Optimization: Cloudinary automatic image processing
- Pagination: Efficient data loading for large datasets
- Caching Strategy: Session and static content caching
- Comprehensive error handling with custom error classes
- Automated database migration and seeding scripts
- Multi-environment configuration management
- Robust authentication with multiple providers
- Image upload and processing pipeline
- Clean, modular architecture following SOLID principles
- Comprehensive input validation and error handling
- Automated testing setup with Jest
- Git workflow with feature branches
- Documentation-driven development
- Stateless API design for horizontal scaling
- Database optimization for high-traffic scenarios
- Cloud-native deployment with auto-scaling capabilities
- Microservice-ready architecture
This project was developed as part of the Code the Dream practicum program, showcasing collaborative development skills and modern backend technologies.
Tech Stack Highlights: Node.js β’ Express.js β’ PostgreSQL β’ Sequelize β’ JWT β’ OAuth 2.0 β’ Cloudinary β’ Render
Building connections, one shared resource at a time. π