Skip to content
This repository was archived by the owner on Oct 26, 2025. It is now read-only.

CinePik/auth

Repository files navigation

Nest Logo Keycloak Logo

Catalog CI Workflow Status Catalog CD Workflow Status

CinePik Auth

Node.js microservice for authorization and authentication using Keycloak.

Documentation

OpenAPI documentation available at http://localhost:3000/api.
For accessing secured endpoints add your access_token provided to you at login to the Authorization header.

Installation

npm install

Running the app

# development
npm run start

# watch mode
npm run start:dev

# production mode
npm run start:prod

Test

# unit tests
npm run test

# e2e tests
npm run test:e2e

# test coverage
npm run test:cov

Docker

To run the app in a docker container, run the following commands.

docker network create cinepik-network

docker build -t cinepik-auth .

docker run -d -t --env-file .env --network cinepik-network -p 3000:3000 cinepik-auth

To manually upload the image to Docker Hub, run the following commands.

docker build -t cinepik-auth .

docker tag cinepik-auth:latest <dockerhub_username>/cinepik-auth:latest

docker push <dockerhub_username>/cinepik-auth:latest

Docker Compose (recommend)

You can also setup the application with docker-compose.

docker-compose up

docker-compose down

Kubernetes Deployment

Create config map for keycloak

kubectl create configmap keycloak-config --from-literal=KEYCLOAK_BASE_URL="http://cinepik-keycloak" --from-literal=KEYCLOAK_CLIENT_ID="nest-auth" --from-literal=KEYCLOAK_PORT=8080 --from-literal=KEYCLOAK_REALM="cinepik"

Create secret for keycloak

kubectl create secret generic keycloak-config --from-literal=KEYCLOAK_ADMIN="admin" --from-literal=KEYCLOAK_ADMIN_PASSWORD="<REPLACE_ME>" --from-literal=KEYCLOAK_CLIENT_SECRET="<REPLACE_ME>" --from-literal=KEYCLOAK_REALM_RSA_PUBLIC_KEY="<REPLACE_ME>"

Apply changes

Apply deployment

kubectl apply -f k8s/cinepik-auth.yml

Apply service

kubectl apply -f k8s/cinepik-auth-svc.yml

Other useful commands

kubectl get pods
kubectl delete deployment cinepik-auth-deployment
kubectl delete configmap <configmap name>
kubectl rollout restart deployment/cinepik-auth-deployment
kubectl logs <pod-id>
kubectl describe secret <secret-name>
kubectl get secret <secret-name>
kubectl get service
kubectl describe pods

About

Node.js microservice for authorization and authentication.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages