Skip to content

Latest commit

 

History

History
137 lines (104 loc) · 2.99 KB

File metadata and controls

137 lines (104 loc) · 2.99 KB

PenK Logo PenK Backend

A monorepo of microservices-based backend system for PenK Assistant.

PenK Architecture

Table of Contents

Prerequisites

Dev Tools

VSCode Setup

  1. Install the Go extension
  2. Install gofumpt:
    go install mvdan.cc/gofumpt@latest
  3. Configure VSCode settings (Ctrl/Cmd + Shift + P → "Preferences: Open User Settings (JSON)"):
    {
      "go.useLanguageServer": true,
      "gopls": {
        "formatting.gofumpt": true
      }
    }

Install dependencies

# Install golang dependencies of all modules 
make tidy

# Install node modules
cd services/gateway
npm install

Getting Started

  1. Create .env.development file at the root level of the project
  2. Copy .env.example to .env.development and fill in secrets
  3. Prepare some credential files of Firebase and OpenAI
  4. Run microsevices and gateway

Database Management

MongoDB Migrations

Using migrate-mongo:

# Install migrate-mongo
npm i -g migrate-mongo

# Migration commands
migrate-mongo up
migrate-mongo down
migrate-mongo status

MongoDB Tools

# Backup entire database
make dump

# Restore entire database
make restore

# Restore specific collection
make restore-col COL=<collection-name>

Running microservices

# Run a specific service
make core

# Run microservices (Test DB)
make test SERVICE="core analytic timetracking notification penk payment"

# Run microservices (Dev DB)
make dev SERVICE="core analytic timetracking notification penk payment"

# Run gateway 
make gateway

# Run unit tests
make unit-test

# Run API tests
make api-test

Linters

# Code linting check and fix
make lint
make lint-fix

# Protocol Buffer linting check and fix
make protolint
make protolint-fix

Docker

# Build and start containers
make up

# Stop containers
make down

# Stop containers and remove images
make down-rmi

# Clean up unused resources
make clean

# View container logs
make logs