Lab Exam: Build and Deploy a NestJS Backend with PostgreSQL Using Docker
Defines a 6-task lab exam for building a NestJS backend with PostgreSQL, Docker, and TypeORM, including CRUD for a User entity.
What this file does
Defines a 6-task lab exam for building a NestJS backend with PostgreSQL, Docker, and TypeORM, including CRUD for a User entity.
When to use it
- Assigning a hands-on exam on NestJS, Docker, and PostgreSQL
- Creating a self-paced tutorial for containerized backend development
- Evaluating student skills in TypeORM and Docker Compose
- Setting up a starter project for a NestJS API with PostgreSQL
Assumes this stack
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 |
What's inside
6 tasks with point values, a grading rubric, and submission instructions
Change this for your project
- Replace
nestjs-docker-examwith your own project name - Replace
Userentity fields if your schema differs - Replace
+5bonus points with your own grading scale
Where it goes
Use as the system prompt for your model call, or as the base instructions in your agent framework.
Related Documents
Character Persona
Defines a Fallout 2 roleplay persona for an LLM agent: charming rogue with social-first combat and moral code.
How to implement tool use
Explains how to define, configure, and control tool use with the Anthropic API, including model selection, tool definitions, output control, and parallel calls.
Gemini by Example
Collects 20+ Gemini API code examples covering text, images, audio, video, PDFs, agents, and token counting.
Claude Tool Use (Function Calling) Documentation
Teaches how to define and use Claude tool use (function calling) with Python, including schema rules, execution patterns, and best practices.