- Project Features
- Prerequisites
- Project Setup
- Database Seeding
- API Documentation
- Contributing
- Testing
-
All required Endpoints
- Comprehensive implementations of all required endpoints and workflows.
-
Swagger Documentation
- Comprehensive API documentation using Swagger.
-
Automated Testing
- Unit tests for services and controllers.
- e2e tests to cover API endpoints and middleware.
Make sure you have the following installed on your machine:
- Node.js (v14 or later)
- MongoDB (can be local or cloud-based like MongoDB Atlas)
- NestJS CLI (optional but useful for development)
- Prisma (ORM for MongoDB)
-
Clone the repository:
git clone git@github.com:Skillz-systems/energy-project-backend.git cd energy-project-backend -
Install Dependencies
pnpm i
npx prisma generate- Configure MongoDB You need a MongoDB instance running. If you don't have MongoDB installed locally, you can either:
- Install it locally
- Use MongoDB Atlas, a cloud-hosted MongoDB solution: MongoDB Atlas Setup Guide
Once your MongoDB instance is ready, make sure you have your connection string.
-
Set Up Environment Variables
cp .env.example .env
Edit the .env file with your MongoDB connection string and other configurations
-
Run the Application
npm run start:dev
A seed.ts file has been made availble in the prisma folder to help seed the database. Add your custom logic and run
npx prisma db seedSwagger is integrated into this project for automatic API documentation. After running the application, you can access the Swagger UI to view and interact with the API endpoints:
http://localhost:3000/api-docsThe Swagger documentation will include all the available routes and their respective methods, parameters, and expected responses.
If you wish to contribute to the project:
Create a new feature branch (git checkout -b feature-branch). Commit your changes (git commit -m 'Add new feature'). Push the branch (git push origin feature-branch). Open a pull request.
Ensure all independently developed units of software work correctly when they are connected to each other by running tests.
for unit tests
pnpm testfor integration/e2e tests
pnpm test:e2e