A robust NestJS-based REST API for a sample api
with Azure deployment capabilities. This repository contains Bicep templates for deploying a complete Azure infrastructure stack.
- A Sample REST API placeholder in NestJS
- OpenAPI/Swagger documentation
- Azure Container Apps deployment setup in Bicep
- Azure Container Registry setup in Bicep
- Azure API Management setup in Bicep
- Azure Log Analytics workspace
- Github Action for CICD (support for 3 environments (dev, qa, prod))
- Docker containerization
- NestJS v11
- TypeScript
- Jest for testing
- Docker
- Azure Container Apps
- Azure Container Registry
- Azure API Management Service
- Management Service
- Product
- API
- Azure Log Analytics workspace
- Bicep for Infrastructure as Code
- Node.js >= v22.14.0
- npm >= 10.9.2
- Docker (for containerization)
- Azure CLI (for deployment)
# Install dependencies
npm install
# Development mode
npm run start
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:cov
- Azure subscription
- Azure Container Registry
- Azure credentials configured in GitHub Secrets
- Resource Group: Logical container for Azure resources
- Azure Container Registry (ACR): Private container registry for Docker images
- Azure Container Apps: Serverless container hosting platform
- API Management Service: API gateway for managing and securing APIs
.
├── Dockerfile
├── README.md
├── bicep
│ ├── main.bicep
│ ├── modules
│ │ ├── apim.bicep
│ │ ├── containerEnvironment.bicep
│ │ ├── containerRegistry.bicep
│ │ └── resourceGroup.bicep
│ └── parameters
│ ├── dev.parameters.json
│ ├── prod.parameters.json
│ └── qa.parameters.json
├── eslint.config.mjs
├── nest-cli.json
├── package-lock.json
├── package.json
├── src
│ ├── app.module.ts
│ ├── auth
│ │ ├── auth.controller.ts
│ │ ├── auth.module.ts
│ │ └── auth.service.ts
│ ├── main.ts
│ └── user
│ └── user.module.ts
├── test
│ ├── app.e2e-spec.ts
│ └── jest-e2e.json
├── tsconfig.build.json
└── tsconfig.json
8 directories, 24 files
This project has one workflow to deploy the app and the infrastructure. The workflow requires AZURE_CREDENTIALS
as a secret in Github. To create a secret, follow below:
az ad sp create-for-rbac --name "myApp" --role Contributor --scopes /subscriptions/{subscription-id}
For the AZURE_CREDENTIALS
, store a JSON per below. Please note that you will need to map the fields per below:
{
"clientSecret": "your client secret to be here",
"subscriptionId": "your subscription id to be here",
"tenantId": "your tenant id to be here",
"clientId": "your client id to be here"
}
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License.