This project is an API built with NestJS and PostgreSQL, exposing endpoints for product management and reporting.
-
Products
GET /api/products→ Get all productsDELETE /api/products/:id→ Delete a product by ID
-
Reports
GET /api/reports/:reportType→ Get a report by type
For more details, check the Swagger documentation at:
http://localhost:3000/api/docs
- Node.js v22
- pnpm (package manager)
- Docker & Docker Compose
-
Clone the repository:
git clone https://github.com/joshnavdev/apply-digital-code-challenge cd apply-digital-code-challenge -
Create your .env file based on the example and edit it to the correct values:
cp .env.example .env
-
Install dependencies (only needed if running outside Docker):
pnpm install
Run the following command to start PostgreSQL and the API:
docker-compose up -d --buildThe API will be available at: http://localhost:3000
To test the Reports API, you need a JWT token signed with the JWT_SECRET defined in your .env.
You can easily generate one using this tool: 👉 https://jwtsecrets.com/tools/jwt-encode
Use your project’s JWT_SECRET as the signing key.
Example payload:
{
"userId": 1,
"role": "admin"
}Copy the generated token and include it in your requests (e.g., Authorization: Bearer ).
- Postgres on port 5432
- NestJS API on port 3000