Skip to content

Repo for jr. and me to play with microk8s, Flux and GitHub Actions

Notifications You must be signed in to change notification settings

roar-skinderviken/vicx-applications

Repository files navigation

Vicx Applications

Getting started

Create next-app/.env.local

Should have the following content

OAUTH_CLIENT_SECRET=secret
OAUTH_BASE_URL=http://localhost:9000/auth-server
NEXTAUTH_SECRET=secret
NEXTAUTH_URL=http://localhost:3000/api/auth
RECAPTCHA_SITE_KEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
NEXT_PUBLIC_KMEANS_BACKEND_URL=http://localhost:8000/k-means
NEXT_PUBLIC_CALCULATOR_BACKEND_URL=http://localhost:8080/backend-spring-boot/graphql
NEXT_PUBLIC_USER_BACKEND_URL=http://localhost:8080/backend-spring-boot/api/user
SPRING_BACKEND_BASE_URL=http://localhost:8080/backend-spring-boot

Value for RECAPTCHA_SITE_KEY is a dev value.

Start the auth-server on port 9000

./gradlew -p auth-server bootRun

Start the Next app

cd next-app
npm ci
npm run dev

Next app will now be available on http://localhost:3000

Username/password for logging in with OAuth:

  • user1
  • password

Start the backend-spring-boot (optional)

./gradlew -p backend-spring-boot bootRun

Start the backend-python (optional, requires Poetry)

cd backend-python
poetry install
poetry run uvicorn src.app:app --reload

API Documentation

The OpenAPI documentation for the API is available at the following URL:

Swagger UI

You can use this interface to explore and interact with the API endpoints, view their descriptions, and test requests directly from the UI.

GraphQL

http://localhost:8080/backend-spring-boot/graphiql

mutation {
  createCalculation(
    firstValue: 1, 
    secondValue: 2, 
    operation: PLUS
  ) {
    id
    firstValue
    secondValue
    operation
    result
    username
    createdAt
  }
}
query {
  getAllCalculations(page: 0) {
    data {
      firstValue
      secondValue
      operation
      result
    },
    totalPages
  }
}
mutation {
    deleteCalculations(ids: [1,2])
}