{"id":28928037,"url":"https://github.com/ticklemycode/locker-rental-backend","last_synced_at":"2025-08-16T11:07:21.458Z","repository":{"id":297860281,"uuid":"998123874","full_name":"ticklemycode/locker-rental-backend","owner":"ticklemycode","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-07T23:11:47.000Z","size":128,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-08T00:22:46.592Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ticklemycode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-07T23:03:51.000Z","updated_at":"2025-06-07T23:11:51.000Z","dependencies_parsed_at":"2025-06-08T00:33:26.217Z","dependency_job_id":null,"html_url":"https://github.com/ticklemycode/locker-rental-backend","commit_stats":null,"previous_names":["ticklemycode/locker-rental-backend"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ticklemycode/locker-rental-backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ticklemycode%2Flocker-rental-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ticklemycode%2Flocker-rental-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ticklemycode%2Flocker-rental-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ticklemycode%2Flocker-rental-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ticklemycode","download_url":"https://codeload.github.com/ticklemycode/locker-rental-backend/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ticklemycode%2Flocker-rental-backend/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261304279,"owners_count":23138304,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-22T14:11:50.400Z","updated_at":"2025-08-16T11:07:21.447Z","avatar_url":"https://github.com/ticklemycode.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Locker Rental Backend\n\nA comprehensive backend API for a locker rental platform built with NestJS, MongoDB, and TypeScript. This application allows users to find and rent lockers at various businesses across Atlanta.\n\n## Features\n\n### 🔐 Authentication \u0026 Authorization\n- JWT-based authentication\n- User registration and login\n- Role-based access control (user, business, admin)\n- Secure password hashing with bcrypt\n\n### 🏢 Business Management\n- Business owner registration and profile management\n- Location-based business search using MongoDB geospatial queries\n- Business categorization (restaurants, cafes, offices, etc.)\n- Operating hours and amenities management\n- Rating and review system\n\n### 📅 Booking System\n- Real-time locker availability checking\n- Time-based booking conflicts prevention\n- Flexible booking duration (max 10 hours)\n- Booking status management (pending, confirmed, active, completed, cancelled)\n- Automatic booking expiration and cleanup\n\n### 🗺️ Location Services\n- Geographic location indexing with 2dsphere indexes\n- Find nearby businesses within specified radius\n- Address and zip code-based searching\n- Coordinate-based distance calculations\n\n### 👥 User Management\n- User profile management\n- Booking history and statistics\n- Account status management\n- Phone number and email verification\n\n## Technology Stack\n\n- **Framework**: NestJS\n- **Database**: MongoDB with Mongoose ODM\n- **Authentication**: JWT with Passport\n- **Validation**: Class Validator \u0026 Class Transformer\n- **Documentation**: Swagger/OpenAPI\n- **Testing**: Jest\n- **Language**: TypeScript\n\n## Environment Setup\n\n1. **Clone the repository**\n```bash\ngit clone \u003cyour-repository-url\u003e\ncd locker-rental-backend\n```\n\n2. **Install dependencies**\n```bash\nnpm install\n```\n\n3. **Environment Configuration**\n```bash\n# Copy the example environment file\ncp .env.example .env\n```\n\nEdit `.env` with your configuration:\n```env\n# Database\nMONGODB_URI=mongodb://localhost:27017/locker-rental\n\n# JWT Configuration\nJWT_SECRET=your-super-secret-jwt-key-here\nJWT_EXPIRES_IN=24h\n\n# Application\nPORT=3002\nNODE_ENV=development\n\n# Optional: Google Maps API for enhanced location services\nGOOGLE_MAPS_API_KEY=your-google-maps-api-key\n```\n\n4. **Database Setup**\n- Install and start MongoDB locally, or use MongoDB Atlas\n- The application will automatically create the necessary collections\n- Run the seed script to populate with sample data:\n```bash\nnpm run seed\n```\n\n## Running the Application\n\n```bash\n# Development mode with hot reload\nnpm run start:dev\n\n# Production mode\nnpm run start:prod\n\n# Debug mode\nnpm run start:debug\n```\n\nThe application will start on `http://localhost:3002`\n\n## API Documentation\n\nOnce the application is running, access the Swagger API documentation at:\n`http://localhost:3002/api/docs`\n\n## Database Schema\n\n### Users\n- Personal information (firstName, lastName, email, phone)\n- Authentication credentials (password hash)\n- Role-based permissions\n- Account status tracking\n\n### Businesses\n- Business details (name, description, type)\n- Location data with geospatial indexing\n- Operating hours and contact information\n- Locker inventory (total and available counts)\n- Pricing and amenities\n- Owner relationship and verification status\n\n### Bookings\n- User and business relationships\n- Time slot management (start/end times)\n- Locker assignment and duration tracking\n- Status workflow (pending → confirmed → active → completed)\n- Payment integration readiness\n- Access code generation for lockers\n\n## API Endpoints\n\n### Authentication (`/auth`)\n- `POST /auth/register` - User registration\n- `POST /auth/login` - User login\n- `GET /auth/profile` - Get user profile (protected)\n\n### Users (`/users`)\n- `GET /users/profile` - Get current user profile\n- `PATCH /users/profile` - Update user profile\n- `GET /users/stats` - Get user booking statistics\n\n### Businesses (`/businesses`)\n- `GET /businesses` - List all businesses with filters\n- `POST /businesses` - Create new business (business owners)\n- `GET /businesses/:id` - Get business details\n- `PATCH /businesses/:id` - Update business details\n- `DELETE /businesses/:id` - Soft delete business\n- `GET /businesses/search` - Search businesses by criteria\n- `GET /businesses/nearby` - Find businesses by location\n- `GET /businesses/owner/:ownerId` - Get businesses by owner\n\n### Bookings (`/bookings`)\n- `GET /bookings` - List bookings with filters\n- `POST /bookings` - Create new booking\n- `GET /bookings/:id` - Get booking details\n- `PATCH /bookings/:id` - Update booking\n- `DELETE /bookings/:id/cancel` - Cancel booking\n- `GET /bookings/my-bookings` - Get current user's bookings\n- `GET /bookings/business/:businessId` - Get business bookings\n- `GET /bookings/available-lockers/:businessId` - Check locker availability\n\n## Testing\n\n```bash\n# Unit tests\nnpm run test\n\n# e2e tests\nnpm run test:e2e\n\n# Test coverage\nnpm run test:cov\n\n# Watch mode\nnpm run test:watch\n```\n\n## Code Quality\n\n```bash\n# Linting\nnpm run lint\n\n# Formatting\nnpm run format\n```\n\n## Sample Data\n\nThe application includes a seed script that creates sample data for testing:\n\n- **Test Users**: Regular user, business owner, and admin accounts\n- **Sample Businesses**: Atlanta locations including:\n  - Ponce City Market (restaurant/food hall)\n  - Krog Street Market (restaurant/food hall)\n  - The Battery Atlanta (entertainment complex)\n  - ADP Alpharetta Office (corporate office)\n- **Sample Bookings**: Active and completed bookings for demonstration\n\nRun with: `npm run seed`\n\n## Project Structure\n\n```\nsrc/\n├── auth/                 # Authentication module\n│   ├── auth.controller.ts\n│   ├── auth.service.ts\n│   ├── jwt.strategy.ts\n│   └── jwt-auth.guard.ts\n├── users/               # User management module\n├── businesses/          # Business management module\n├── bookings/           # Booking system module\n├── schemas/            # MongoDB schemas\n│   ├── user.schema.ts\n│   ├── business.schema.ts\n│   └── booking.schema.ts\n├── dto/                # Data Transfer Objects\n│   ├── auth.dto.ts\n│   ├── business.dto.ts\n│   └── booking.dto.ts\n└── main.ts             # Application entry point\n```\n\n## Key Features Deep Dive\n\n### 🔍 Intelligent Location Search\n- **Geospatial Queries**: Uses MongoDB's 2dsphere indexes for efficient location-based searches\n- **Radius Search**: Find businesses within customizable distance ranges\n- **Address Lookup**: Search by street address, city, or zip code\n- **Business Categorization**: Filter by restaurant, cafe, office, or other business types\n\n### ⏰ Advanced Booking Management\n- **Real-time Availability**: Prevents double-booking with conflict detection\n- **Flexible Duration**: Support for 1-10 hour rental periods\n- **Automatic Cleanup**: Expired booking management and status updates\n- **Cancellation Policy**: 1-hour advance cancellation requirement\n- **Access Codes**: Secure locker access with generated codes\n\n### 🛡️ Security \u0026 Validation\n- **Input Validation**: Comprehensive DTO validation with class-validator\n- **JWT Authentication**: Secure token-based authentication\n- **Role-based Access**: Different permissions for users, business owners, and admins\n- **Data Sanitization**: Protected against common security vulnerabilities\n\n### 📊 Business Analytics Ready\n- **Booking Statistics**: Track user booking patterns and business performance\n- **Revenue Tracking**: Built-in total amount calculation for financial reporting\n- **Rating System**: User feedback and business rating infrastructure\n- **Usage Metrics**: Detailed logging for business intelligence\n\n## Deployment\n\n### Docker Deployment (Recommended)\n```bash\n# Build the application\nnpm run build\n\n# Create Docker image\ndocker build -t locker-rental-backend .\n\n# Run with Docker Compose (include MongoDB)\ndocker-compose up -d\n```\n\n### Traditional Deployment\n```bash\n# Build for production\nnpm run build\n\n# Start production server\nnpm run start:prod\n```\n\n### Environment Variables for Production\n```env\nNODE_ENV=production\nPORT=3002\nMONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/locker-rental\nJWT_SECRET=your-production-jwt-secret-256-bit\nJWT_EXPIRES_IN=24h\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## Future Enhancements\n\n- 💳 **Payment Integration**: Stripe/PayPal integration for booking payments\n- 📱 **Push Notifications**: Real-time booking updates and reminders\n- 🔐 **QR Code Access**: QR code generation for locker access\n- 📈 **Analytics Dashboard**: Business owner analytics and reporting\n- 🌐 **Multi-language Support**: Internationalization for global markets\n- 🔄 **Real-time Updates**: WebSocket integration for live availability\n\n## License\n\nThis project is private and unlicensed. All rights reserved.\n\n## Support\n\nFor support and questions, please contact the development team or create an issue in the repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fticklemycode%2Flocker-rental-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fticklemycode%2Flocker-rental-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fticklemycode%2Flocker-rental-backend/lists"}