Skip to content

This is a project to testing purposes. Delivered to Deall SejutaCita company.

License

Notifications You must be signed in to change notification settings

bungambohlah/sejutacita-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SejutaCita Project Test

This is a project to testing purposes. Delivered to Deall SejutaCita company.

Just visit at sejutacita.id

Table of Contents

Stack Used

  1. Node.js as backend language
  2. Typescript as transpiler for the code
  3. Express as web framework
  4. Postgres as database
  5. Docker as containerization
  6. Swagger as documentation
  7. Jest as testing framework
  8. SWC as code minifier
  9. ESLint as code linter
  10. Prettier as code formatter
  11. Husky as git hooks
  12. Winston as logging framework

Setup

How to run on local environment

  1. First of all, copy the example file to .env.development.local file
  2. Fill the local environment variables with the correct values
  3. Install the dependencies with npm install
  4. Create a database with value that already filled from env file
  5. Run migrations with npm run migrate
  6. And last but not least, run the server with npm run dev as development mode

How to setup and run tests

  1. First of all, copy the example file to .env.test.local file
  2. Fill the local environment variables with the correct values
  3. Install the dependencies with npm install if you don't have any dependencies installed
  4. Create a database with value that already filled from env file
  5. Run migrations with npm run migrate:test
  6. And last but not least, run the test npm run test with jest as test mode

How to deploy on production environment

  1. First of all, copy the example file to .env.production.local file
  2. Fill the local environment variables with the correct values
  3. Run and deploy with current exist Dockerfile and Docker Compose file (for test you can use Railway)

How to deploy production with kubernetes

  1. First of all, copy the example file to .env.production.local file
  2. Use Docker Desktop Kubernetes or you can use kinD to run the cluster
  3. build your docker image with docker image build -t YOUR_DOCKERHUB_USERNAME/sejutacita:latest .
    • or use my image at my docker repo here
  4. create a deployment or pod with kubectl apply -f pod.yml
  5. create a service with kubectl apply -f service.yml
  6. check all the pod and service with kubectl get all and make sure status is Running
  7. Access your project with port from kind cluster master port (example is 30000). Then run with localhost:30000

Screenshot Kubernetes Configuration (this example with Docker Desktop)

Apply pod and service with kubectl apply -f pod.yml and kubectl apply -f service.yml

apply

Kube ctl get all pods & services

kubectl_get_all

Access the project at index API

access_pod_1

Access the project at Swagger API Docs Page

access_pod_2

Credentials

As seeding data, use the following credentials:

Admin:

Username: admin
Password: password

User:

Username: user
Password: password

Link Deployed to Production with Railway Cloud Platform

you can acess the api at visit at sctest.afif.dev

API Docs (Swagger)

Visit at sctest.afif.dev/api-docs

About Me

Hello there 👋🏻, my name is Afif Abdillah Jusuf and I'm a software engineer.

I'm currently working as a Full Stack Developer.

Graduated from Politeknik Elektronika Negeri Surabaya as Associate Degree in Informatics Engineering.

Nice to meet you.

Visit my personal site at afif.dev

License

This project is open-sourced software licensed under the MIT license.