Lab Exam: Build and Deploy a NestJS Backend with PostgreSQL Using Docker
Your goal is to create a NestJS backend application that connects to a PostgreSQL database. The backend must be containerized using Docker, and the services managed using Docker Compose. The application should include CRUD functionality for a User entity.
Lab Exam: Build and Deploy a NestJS Backend with PostgreSQL Using Docker
Objective
Your goal is to create a NestJS backend application that connects to a PostgreSQL database. The backend must be containerized using Docker, and the services managed using Docker Compose. The application should include CRUD functionality for a User entity.
Instructions
- Ensure the following tools are installed:
- Node.js and npm
- Docker and Docker Compose
- Complete the tasks outlined below.
- Submit your solution via GitHub assignment repository link.
Tasks
-
Initialize the Project
- [10 points] Set up a new NestJS project using the NestJS CLI:
- Install the CLI globally.
- Create a new project named nestjs-docker-exam.
-
Configure PostgreSQL
- [30 points] Set up a PostgreSQL database for the project:
- Install and configure PostgreSQL-related dependencies.
- Update the project configuration to use TypeORM with environment variables.
- Create a .env file to define the database connection details.
-
Implement the User Resource
- [20 points] Create and implement the User resource:
- Generate a User entity using the CLI.
- The entity should have the following fields:
- id (Primary Key, UUID)
- name (String)
- email (String, unique)
- createdAt (Date)
- Implement CRUD endpoints for the User resource.
-
Dockerize the Application
- [30 points] Create a containerized environment:
- Write a Dockerfile to containerize the application.
- Configure a docker-compose.yml file to define the application and database services.
-
Verify and Test
- [10 points] Test the application functionality:
- Start the application using Docker Compose.
- Test the CRUD endpoints using Postman or cURL to ensure the application works as expected.
-
Bonus
- [+5 points] Add a /health endpoint to verify database connectivity.
Submission
- Push your project to a GitHub repository or compress the project folder into a .zip file.****
- Include a README.md file with the following details:
- Project description.
- Instructions for running the application.
- Environment variables required.
Grading Rubric
| Task | Points |
|---|---|
| Project Initialization | 10 |
| PostgreSQL Configuration | 30 |
| User Resource | 20 |
| Docker Configuration | 30 |
| Testing and Verification | 10 |
| Bonus Task | +5 |
Related Documents
Character Persona
**Name:** (set during character creation; must be said like it’s a brand)
DiffusionDB
annotations_creators:
coding: utf-8
from openai import OpenAI
Claude Tool Use (Function Calling) Documentation
Tool use (formerly called function calling) allows Claude to interact with external tools, APIs, and functions. Released on April 4, 2024, and made generally available on May 30, 2024, this feature enables Claude to perform actions beyond text generation.