{"id":27064799,"url":"https://github.com/beastmp/msc-devops-bootcamp-backend","last_synced_at":"2025-06-14T12:04:53.386Z","repository":{"id":283577674,"uuid":"948792741","full_name":"beastmp/msc-devops-bootcamp-backend","owner":"beastmp","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-21T00:10:58.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T17:19:06.543Z","etag":null,"topics":["devops","javascript","nodejs","project-devops-bootcamp"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/beastmp.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}},"created_at":"2025-03-15T01:10:40.000Z","updated_at":"2025-03-21T22:08:18.000Z","dependencies_parsed_at":"2025-03-22T01:31:46.587Z","dependency_job_id":null,"html_url":"https://github.com/beastmp/msc-devops-bootcamp-backend","commit_stats":null,"previous_names":["beastmp/msc-devops-bootcamp-backend"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/beastmp/msc-devops-bootcamp-backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastmp%2Fmsc-devops-bootcamp-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastmp%2Fmsc-devops-bootcamp-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastmp%2Fmsc-devops-bootcamp-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastmp%2Fmsc-devops-bootcamp-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beastmp","download_url":"https://codeload.github.com/beastmp/msc-devops-bootcamp-backend/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastmp%2Fmsc-devops-bootcamp-backend/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259813010,"owners_count":22915198,"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":["devops","javascript","nodejs","project-devops-bootcamp"],"created_at":"2025-04-05T17:19:08.416Z","updated_at":"2025-06-14T12:04:53.297Z","avatar_url":"https://github.com/beastmp.png","language":"JavaScript","readme":"# DevOps Bootcamp - Backend\n\nThis repository contains the backend application for the DevOps Bootcamp project. The backend provides REST APIs and services that support the frontend application and other system components.\n\n## Features\n\n- RESTful API endpoints for products and orders\n- AWS DynamoDB integration for data storage\n- AI capabilities with OpenAI Assistant and AWS Bedrock integration\n- AWS Lambda function for serverless operations\n- Environment configuration via dotenv\n- Error handling and validation\n- Cross-origin resource sharing (CORS) support\n\n## Technology Stack\n\n- **Runtime**: Node.js with Express\n- **Database**: AWS DynamoDB\n- **AI Services**: \n  - OpenAI API\n  - AWS Bedrock\n- **AWS SDK**: AWS SDK for JavaScript\n- **Other AWS Services**: Lambda, IAM (Web Identity Tokens)\n- **Utilities**: UUID for ID generation\n- **Development**: Nodemon for hot reloading\n- **Containerization**: Docker (implied by project structure)\n\n## Prerequisites\n\n- Node.js 14+\n- npm 6+\n- AWS account with appropriate permissions for:\n  - DynamoDB\n  - Bedrock\n  - Lambda\n  - IAM\n- OpenAI API key\n- Git\n\n## Installation and Setup\n\n1. Clone the repository:\n   ```\n   git clone https://github.com/beastmp/msc-devops-bootcamp-backend.git\n   cd msc-devops-bootcamp-backend\n   ```\n\n2. Install dependencies:\n   ```\n   npm install\n   ```\n\n3. Set up environment variables:\n   - Create a `.env` file in the root directory\n   - Add the following variables:\n     ```\n     PORT=5000\n     AWS_REGION=us-east-1\n     DYNAMODB_PRODUCTS_TABLE=cloudmart-products\n     DYNAMODB_ORDERS_TABLE=cloudmart-orders\n     OPENAI_API_KEY=your-openai-api-key\n     OPENAI_ASSISTANT_ID=your-openai-assistant-id\n     BEDROCK_AGENT_ID=your-bedrock-agent-id\n     BEDROCK_AGENT_ALIAS_ID=your-bedrock-agent-alias-id\n     ```\n\n4. Start the application:\n   ```\n   npm start\n   ```\n\n   Or for development with auto-reload:\n   ```\n   npm run dev\n   ```\n\nThe API should now be running on [http://localhost:5000](http://localhost:5000).\n\n## Available Commands\n\n- `npm start` - Run the application\n- `npm run dev` - Run the application with Nodemon for development\n\n## Project Structure\n\n```\nsrc/\n├── controllers/           # Request handlers\n│   ├── aiController.js    # AI integration controller\n│   ├── orderController.js # Order management controller\n│   └── productController.js # Product management controller\n├── routes/                # API routes\n│   ├── aiRoutes.js        # AI endpoints\n│   ├── orderRoutes.js     # Order endpoints\n│   └── productRoutes.js   # Product endpoints\n├── services/              # Business logic\n│   ├── aiService.js       # OpenAI and Bedrock integration\n│   ├── orderService.js    # Order operations with DynamoDB\n│   └── productService.js  # Product operations with DynamoDB\n├── lambda/                # AWS Lambda functions\n│   └── index.js           # Lambda handler for product recommendations\n└── server.js              # Express server configuration and startup\n```\n\n## API Endpoints\n\n### Products API\n- `GET /api/products` - Get all products\n- `GET /api/products/:id` - Get product by ID\n- `POST /api/products` - Create a new product\n- `PUT /api/products/:id` - Update product\n- `DELETE /api/products/:id` - Delete product\n\n### Orders API\n- `GET /api/orders` - Get all orders\n- `GET /api/orders/:id` - Get order by ID\n- `GET /api/orders?email={email}` - Get orders by user email\n- `POST /api/orders` - Create a new order\n- `PUT /api/orders/:id` - Update order status\n- `DELETE /api/orders/:id` - Delete order\n\n### AI API\n- `POST /api/ai/openai/conversation` - Start an OpenAI conversation\n- `POST /api/ai/openai/message` - Send a message to OpenAI assistant\n- `POST /api/ai/bedrock/conversation` - Start an AWS Bedrock conversation\n- `POST /api/ai/bedrock/message` - Send a message to AWS Bedrock agent\n\n## Database\n\nThe application uses AWS DynamoDB for data storage, with two main tables:\n- `cloudmart-products`: Stores product information\n- `cloudmart-orders`: Stores order information\n\n### Data Models\n\n#### Product\n```javascript\n{\n  id: String,          // UUID\n  name: String,        // Product name\n  price: Number,       // Product price\n  description: String, // Product description\n  image: String,       // Image URL\n  createdAt: String    // ISO timestamp\n}\n```\n\n#### Order\n```javascript\n{\n  id: String,          // UUID\n  userEmail: String,   // Customer email\n  items: Array,        // Array of ordered products\n  status: String,      // Order status (e.g., \"Pending\", \"Shipped\", \"Delivered\", \"Canceled\")\n  createdAt: String    // ISO timestamp\n}\n```\n\n## AI Integration\n\nThis project integrates with both OpenAI's API and AWS Bedrock for AI capabilities:\n\n1. **OpenAI Assistant**: Provides conversational AI with the ability to perform order operations like deletion and cancellation.\n\n2. **AWS Bedrock**: Used for advanced AI features through Amazon's Bedrock Agent service.\n\n## AWS Lambda Function\n\nThe project includes a Lambda function that can be deployed to AWS for serverless compute:\n- Function: Retrieves product information from DynamoDB\n- Trigger: Can be set up with API Gateway or other event sources\n- Configuration: Uses environment variables for DynamoDB table name\n\n## Deployment\n\n### Docker\n\n1. Build the Docker image:\n   ```\n   docker build -t msc-devops-bootcamp-backend .\n   ```\n\n2. Run the Docker container:\n   ```\n   docker run -p 5000:5000 -e AWS_REGION=us-east-1 -e DYNAMODB_PRODUCTS_TABLE=cloudmart-products -e DYNAMODB_ORDERS_TABLE=cloudmart-orders msc-devops-bootcamp-backend\n   ```\n\n### AWS Deployment\n\nFor AWS deployment instructions including Lambda functions and DynamoDB configuration, see the companion repository: `msc-devops-bootcamp-infrastructure`.\n\n## Kubernetes Deployment\n\nFor Kubernetes deployment instructions, see the companion repository: `msc-devops-bootcamp-kubernetes`.\n\n## Contributing\n\n1. Fork the repository\n2. Create your 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## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## Contact\n\nProject Link: [https://github.com/beastmp/msc-devops-bootcamp-infrastructure](https://github.com/beastmp/msc-devops-bootcamp-infrastructure)\n\nProject Link: [https://github.com/beastmp/msc-devops-bootcamp-kubernetes](https://github.com/beastmp/msc-devops-bootcamp-kubernetes)\n\nProject Link: [https://github.com/beastmp/msc-devops-bootcamp-frontend](https://github.com/beastmp/msc-devops-bootcamp-frontend)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeastmp%2Fmsc-devops-bootcamp-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeastmp%2Fmsc-devops-bootcamp-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeastmp%2Fmsc-devops-bootcamp-backend/lists"}