SIAKAD - Sistem Informasi Akademik

SIAKAD is a project that I worked on with a team of developers that we established from community. The purpose of this project is to practice microservice architecture, practicing SDLC and teamwork.

Login Page

In this project, my primary focus has been on backend development, this includes API development, database design, and deployment.

The architecture of the project is based on a microservices approach on backend.

Contributions

  1. Designed the database schema for the application.

    ERD
  2. Initialize API Gateway using Kong API Gateway and route the request to the appropriate microservice.

    _format_version: "2.1"
    _transform: true
    
    plugins:
    - name: cors
        config:
        origins:
            - "*"
        methods:
            - GET
            - POST
            - PUT
            - PATCH
            - DELETE
            - OPTIONS
    services:
    - name: example-service
        url: https://mockbin.org
        routes:
        - name: public-route
            paths:
            - /api
            plugins:
            - name: auth
    - name: announcement-service
        # url: http://siakad-announcement-api.default.svc.cluster.local:5007
        url: http://announcement-service:5007
        plugins:
        - name: auth
        routes:
        - name: announcement-route
            paths:
            - /api/v1/announcement
            strip_path: false
            preserve_host: false
    // ... other services
    
    Repo Snippet
  3. Developed authentication service using JWT and built custom plugin for Kong Gateway to validate the JWT token.

     class AuthPlugin {
         constructor(config) {
             this.config = config;
         }
    
         async access(kong) {
             try {
                 const requestHeaders = await kong.request.getHeaders();
                 kong.log.info("Auth Headers:", JSON.stringify({ requestHeaders }));
                 if (!isEmpty(requestHeaders.authorization)) {
                     const token = requestHeaders.authorization[0].split(" ")[1];
                     const decoded = jwt.verify(token, this.config.SECRET, {
                         algorithms: ["HS256"],
                         ignoreExpiration: false,
                         issuer: this.config.ISSUER,
                         audience: this.config.AUDIENCE,
                     });
    
                     if (isEmpty(decoded)) {
                         kong.log.err("Error Auth Plugin:", "Unauthorized");
                         return BaseResponse.ErrorResponse(kong, 401, "Unauthorized");
                     }
    
                     kong.log.info("Decoded:", JSON.stringify({ decoded }));
                     kong.service.request.add_header(
                         "X-User-Profile",
                         JSON.stringify(decoded)
                     );
                     return decoded;
                 } else {
                     return BaseResponse.ErrorResponse(kong, 401, "Unauthorized");
                 }
             } catch (error) {
                 kong.log.err("Error Auth Plugin:", error.message);
                 return BaseResponse.ErrorResponse(kong, 401, "Unauthorized");
             }
         }
     }
    
    Repo Snippet
  4. Manage the github workflow to push to container registry

     name: Docker Image Auth Service
    
     on:
     push:
         branches:
         - "staging/sprint-2"
         paths:
         - 'apps/auth-service/**'
    
     jobs:
     build_and_publish_auth_service:
         runs-on: ubuntu-latest
         steps:
         - name: Set up QEMU
             uses: docker/setup-qemu-action@v3
    
         - name: Set up Docker Buildx
             uses: docker/setup-buildx-action@v3
    
         - name: Login to ghcr.io
             uses: docker/login-action@v3
             with:
             registry: ghcr.io
             username: coder-automation
             password: ${{ secrets.GH_TOKEN }}
    
         - name: Checkout Repository
             uses: actions/checkout@v3
    
         - name: Determine the next version
             id: version
             run: echo "::set-output name=date::$(date +'%Y%m%d%H%M%S')"
    
         - name: Build and push image
             uses: docker/build-push-action@v2
             with:
             context: .
             file: ./apps/auth-service/Dockerfile
             push: true
             tags: ghcr.io/coder-repository/auth-service:${{ steps.version.outputs.date }}`
    
    Repo Snippet
  5. Developed manual payment service using GO

     // ... rest of function
     sanitizedFileName := utils.SanitizeFilename(proofOfPaymentFile.Filename, "payment")
    
     // Initialize Cloudinary Client
     cld, err := utils.CloudinaryUpload()
     if err != nil {
     	log.Error("Error Initializing Cloudinary Client ", err)
     	return internalServerErrorResponse(c)
     }
    
     resp, err := cld.Upload.Upload(context.Background(), proofOfPaymentFile, uploader.UploadParams{
     	Folder:   "proof_of_payment",
     	PublicID: sanitizedFileName,
     })
    
     if err != nil {
     	log.Error("Error Uploading Proof Of Payment To Cloudinary ", err)
     	return internalServerErrorResponse(c)
     }
    
    Repo Snippet

Technologies Used

  1. Kotlin - Mobile App
  2. ExpressJs - Backend
  3. Lumen PHP - Backend
  4. Go Fiber - Backend
  5. PostgreSQL - Database
  6. Kong - API Gateway