A sample codebase to work with access keys written in NestJS. Note: This has no auth , please apply your own.
- Host:
host.docker.internal
- Individual config for DB connections is in individual
docker-compose
files per repository.
- Docker compose up in root directory
- cd && Docker compose up in apps/access-key-generator directory
- cd && Docker compose up in apps/key-information-service directory
- Let docker running in background
- Install dependencies:
npm i
- Build the project:
npm run build
- Run database migrations:
npx prisma migrate dev
npx prisma migrate deploy
Note : The admin app has no validation as of now - it doesnt validate for admins
- List all keys:
npm run list-all-keys
- Generate a new key:
npm run generate-key -- --level=admin --username=vineet --ratelimit=10 --expiry=10-11-2024
- Delete a key:
npm run delete-key -- --key-id=clwdrmjpu0000ax0t4jwcilt8
- Update rate limit:
npm run update-rate-limit -- -k clwdrkf830000lrz76f73rgdh -r 10
- Update expiry date:
npm run update-expiry -- -k clwdrkf830000lrz76f73rgdh -e 10-10-2024
- Update key status:
npm run update-key-status -- -k clwdrfbdq000054lt4clwrqch -s enabled
- Fetch key details:
npm run fetch-key-details -- -k clwdrfbdq000054lt4clwrqch
- Install dependencies:
npm i
- Run database migrations:
npx prisma migrate dev
npx prisma migrate deploy
- Build the project:
npm run build
- Start the service:
npm run start
Make a GET call at http://localhost:3000/key-information/key
.
Example:
http://localhost:3000/key-information/1234
This README provides a quick reference for setting up and managing access keys using the provided NestJS sample codebase.