Follow the steps below to set up and run the project on your local machine.
Ensure you have the following installed on your system:
- Node.js (v24 or higher)
- npm (v11.6.1 or higher)
- PostgreSQL (v13 or higher)
Create a .env file in the root directory of the project and configure the following variables:
NODE_ENV="development"
PORT="4000"
DATABASE_URL="postgresql://<username>:<password>@localhost:5432/internshipDB"
JWT_SECRET="<your-secret-key>"
SADMIN_ID="6df46fd7-d048-44c7-977b-a561c017e4a3"
CACHE_PROVIDER="node-cache"
STORAGE_DRIVER="fs"
APP_URL="http://localhost:4000"
UPLOAD_DIR="uploads"
MAX_FILE_SIZE_MB="20"
TX_MAX_WAIT_MS="120000"
TX_TIMEOUT_MS="120000"
COOKIE_DOMAIN=".localhost.com"
CORS_ORIGINS="http://localhost:3000"
SMTP_HOST="smtp.gmail.com"
SMTP_PORT="587"
SMTP_SECURE="FALSE"
SMTP_USER="<your-smtp-email>"
SMTP_PASS="<your-smtp-password>"
SMTP_FROM="no-reply@localhost.com"
OTP_EXPIRY_MINUTES="5"- Create a PostgreSQL database named
internshipDB. - Update the
DATABASE_URLin the.envfile with your PostgreSQL credentials.
Run the following command to install all required dependencies:
npm installEnsure the database schema is up-to-date by running:
npm run prisma:generate
npm run prisma:migrateRun the following commands to seed the database:
npx ts-node src/modules/auth/auth.seeder.ts
npx ts-node scripts/seed-csv.ts role ./data/seed-role.csv
npx ts-node scripts/seed-csv.ts permissionGroup ./data/seeders-permission_group.csv
npx ts-node scripts/seed-csv.ts permission ./data/seeders-permission.csv
npx ts-node scripts/seed-csv.ts rolePermission ./data/seeders-role_permission.csv
npx ts-node scripts/seed-csv.ts userRole ./data/seeders-user_roles.csv
npx ts-node scripts/seed-csv.ts metadataSchema ./data/seeders-meta_schema.csv
npx ts-node scripts/seed-csv.ts unit ./data/seeders-units.csvThis project uses Gmail for SMTP. Follow this guide to generate SMTP credentials. Update the SMTP_USER and SMTP_PASS in the .env file with the generated credentials.
Start the development server using:
npm run devThe server will be available at http://localhost:4000.
- data/: Contains seeders data in CSV format.
- scripts/: Contains logic for importing seeders.
- postman-collection/: Contains Postman collections and environment files for API testing.
- src/: Contains the main project source code.
You can find the Postman collection and environment files in the postman-collection folder. Import these files into Postman to test the APIs.
- Ensure the
UPLOAD_DIRspecified in the.envfile exists or create it manually. - The
MAX_FILE_SIZE_MBspecifies the maximum file upload size in MB. - The
OTP_EXPIRY_MINUTESspecifies the validity duration of OTPs in minutes.
This project is licensed under the MIT License.