Get Started in 5 Minutes
This guide will help you quickly set up and run the EPR LAPS Backend API on your local machine.Prerequisites
Ensure you have the required tools installed:If using nvm, switch to the correct Node.js version:
- Node.js >= v22.16.0
- npm >= v11
- MongoDB (or use Docker Compose)
We recommend using nvm to manage Node.js versions.
Clone and Install
Clone the repository and install dependencies:The installation will automatically set up Husky git hooks for code quality checks.
Configure Environment
Set up your environment variables. Create a
.env file or export the following:Start the Server
Run the API in development mode:The server will start on
http://0.0.0.0:3001 with hot-reloading enabled.Development mode includes:
- Automatic restart on file changes (via nodemon)
- Debug inspector on port 9229
- Pretty-printed logs
Alternative: Docker Compose
For a complete local development environment with all dependencies, use Docker Compose:Start Docker Environment
Launch the entire stack:This starts:
- EPR LAPS Backend API on port 3001
- MongoDB on port 27017
- Redis on port 6379
- Localstack (AWS services) on port 4566
Available Scripts
The following npm scripts are available for development:Test the API Endpoints
Once running, you can test the API endpoints:Health Check
Bank Details (requires authentication)
Documents (requires authentication)
For authenticated endpoints, you’ll need to obtain a valid JWT token from your Defra ID provider.
Development Features
Hot Reloading
The development server uses nodemon to automatically restart when you modify:- JavaScript files (
.js) - JSON files (
.json)
Debug Mode
Connect a debugger to port 9229:MongoDB Locks
For write operations requiring locks:Proxy Configuration
The API includes forward-proxy support using undici:Troubleshooting
Connection refused to MongoDB
Connection refused to MongoDB
Ensure MongoDB is running:
Port 3001 already in use
Port 3001 already in use
Change the port via environment variable:
Prettier formatting issues on Windows
Prettier formatting issues on Windows
Update your global git config:
Module not found errors
Module not found errors
Reinstall dependencies:
Next Steps
Installation Guide
Detailed installation and configuration instructions
API Reference
Complete API endpoint documentation