- Node.js v16 or higher
- Docker (for running local DynamoDB)
- AWS account (for CD deployment)
- GitHub repository
-
Clone the repository and delete the
.githubfolder (if present). -
Install dependencies:
npm install -
Start local DynamoDB in Docker:
npm run dynamodb
- Ensure port
8000is available.
- Ensure port
-
Run the server:
npm start
-
Run tests:
npm test
GET /api/v1/hello: Returns a hello messagePOST /api/v1/users: Creates a new user (requiresnameandemail)GET /api/v1/users: Lists all users
-
Uses local DynamoDB at
http://localhost:8000 -
Userstable automatically created on server startup with fields:id(partition key)nameemail
- Uses Jest and Supertest for API testing
- Tests cover basic CRUD operations and error cases
- Tests clean up the table after completion
Note: Ensure Docker is running before starting DynamoDB.
- Push your repository to GitHub.
- Create
.github/workflows/ci.yml. - Make some changes in the code (e.g., add a new API or test) and push again.
- GitHub Actions will run the CI workflow to verify your code changes.
-
Create an IAM user with access to S3 and Elastic Beanstalk.
-
Go to Security Credentials → Access Keys for the new user and save the keys.
-
Add repository secrets in GitHub:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY
-
Create an S3 bucket in AWS.
-
Create an Elastic Beanstalk application and environment.
AWS_REGION: us-east-1
EB_APP_NAME: <your-app>
EB_ENV_NAME: <your-env>
S3_BUCKET: <your-bucket>- Create
.github/workflows/cd.ymland configure it for your region. - Push changes to GitHub.
- The workflow will automatically deploy your app to Elastic Beanstalk.
After deployment, test your endpoints using the EB environment URL.