A robust NestJS-based API template with comprehensive features including:
- π Authentication & Authorization with JWT
- π₯ Multi-tenant architecture
- π³ Stripe integration for payments (API v2023-10-16)
- π Swagger API documentation
- π¨ Email service with Handlebars templates
- π¨ Branding customization per tenant
- π’ Role-based access control (RBAC)
- πΎ PostgreSQL database with TypeORM
- π Database migrations and seeding
- π― Request validation using class-validator
- π Docker support
- π PDF generation
- ποΈ CSV import/export capabilities
- β‘ Cache manager integration
- π Global query scopes
- π Comprehensive logging
Make sure the following are installed on your local machine:
- nvm (Node Version Manager) - Install it from the official nvm repository.
- PostgreSQL - Version 13.x or higher Download
- Git - Version control system Download
- Docker (optional) - For containerized deployment Download
-
Install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
Or, for systems using
wget
:wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
-
Close and reopen your terminal, or run:
source ~/.bashrc
(Or
.zshrc
,.bash_profile
, depending on your shell). -
Install Node.js (LTS version):
nvm install 18
-
Set the installed version as the default:
nvm use 18 nvm alias default 18
-
Verify the installation:
node -v npm -v
- Open your terminal or command prompt.
- Navigate to the directory where you want to clone the repository.
- Run the following command:
git clone <repository-url>
- Navigate into the project directory:
cd nestjs-template
Run the following command in the project directory to install all required dependencies:
npm install
- Copy the example environment file:
cp .env.example .env
- Open the
.env
file in your preferred text editor. - Update the environment variables as needed, such as database credentials, API keys, etc.
Example:
DATABASE_HOST=localhost DATABASE_PORT=5432 DATABASE_USER=your_username DATABASE_PASSWORD=your_password DATABASE_NAME=your_database
To start the application in development mode, run:
npm run start:dev
Verify that the application is running by opening your browser and navigating to:
http://localhost:3000
Run the following commands to execute the tests:
-
Unit Tests:
npm run test
-
End-to-End Tests:
npm run test:e2e
-
To lint the code, run:
npm run lint
-
To format the code, run:
npm run format
-
Start the application in production mode:
npm run start:prod
-
Generate a new module:
nest generate module <module-name>
-
Generate a new controller:
nest generate controller <controller-name>
-
Generate a new service:
nest generate service <service-name>
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature-name
- Commit your changes:
git commit -m "Add your message here"
- Push to your branch:
git push origin feature/your-feature-name
- Open a Pull Request on the main repository.
This project is licensed under the MIT License.