imkFinal/backend
2025-04-26 20:00:45 +02:00
..
prisma
scripts
src password reset link fix 2025-04-26 20:00:45 +02:00
.dockerignore
.env
docker-compose.dev.yml
docker-compose.yaml
Dockerfile
Dockerfile.dev
env.development
nest-cli.json
package-lock.json
package.json
README.md
start-dev.sh
temp.sql
tsconfig.build.json
tsconfig.json

Add the necessary environment variables to your .env file:

# Default Admin Configuration
DEFAULT_ADMIN_EMAIL=admin@imk.com
DEFAULT_ADMIN_PASSWORD=admin123456
DEFAULT_ADMIN_NAME=System Admin

To use this setup:

  1. The seed script will run automatically during deployment when you run:
npx prisma db push
npx prisma db seed
  1. Alternatively, you can manually trigger the initialization by making a POST request to:
POST /init/system

This gives you two ways to ensure the default admin user is created:

  1. Automatically during deployment via the seed script
  2. Manually via the initialization endpoint

To deploy, you would:

  1. Set up your environment variables
  2. Run the database migrations
  3. Run the seed script
npm run prisma:deploy
npm run prisma:seed

The default admin credentials will be:

  • Email: admin@imk.com (or whatever you set in env)
  • Password: admin123456 (or whatever you set in env)

Make sure to:

  1. Change the default password after first login
  2. Use strong passwords in production
  3. Properly secure the initialization endpoint in production
  4. Keep your environment variables secure

This setup ensures you always have an admin user available after deployment while maintaining security and flexibility.