📖 Project Overview

The KeepTrack Database Service is a comprehensive backend API built with Go and GoFiber framework, designed to manage organizational assets, user access, and business operations. The service provides RESTful APIs for three main interfaces: Core, Console, and Dashboard.

🏗️ Architecture

  • Framework: GoFiber (Fast HTTP framework for Go)
  • Database: Supabase (PostgreSQL with real-time features)
  • Authentication: JWT-based authentication system
  • Containerization: Docker with multi-stage builds
  • Deployment: GitHub Actions CI/CD to VPS

🎯 Key Features

  • Multi-tenant organization management
  • Role-based access control (RBAC)
  • Asset tracking and management
  • User management and authentication
  • Service provider integration
  • Real-time database operations
Status: Production Ready

⚙️ Setup & Installation

Prerequisites

  • Go 1.24.4 or higher
  • Docker and Docker Compose
  • Supabase project setup

Environment Variables

SUPABASE_URL string
SUPABASE_ANON_KEY string
SUPABASE_SERVICE_ROLE_KEY string
JWT_SECRET string
PORT int (default: 8100)

Local Development

# Clone and setup
git clone [repository-url]
cd database
go mod download
go run main.go

Docker Deployment

# Build and run with Docker
docker compose up -d --build

🔐 Authentication

The API uses JWT (JSON Web Tokens) for authentication. All protected endpoints require a valid JWT token in the Authorization header.

Authentication Flow

  1. User registers/logs in via authentication endpoints
  2. Server validates credentials and returns JWT token
  3. Client includes JWT token in subsequent requests
  4. Server validates token and grants access

Token Format

Authorization: Bearer [JWT_TOKEN]

🏢 Core APIs

Core APIs handle fundamental business operations including organizations, branches, users, and authentication.

POST
/v1/core/register
Register a new user account
email string
password string
name string
POST
/v1/core/login
Authenticate user and get JWT token
email string
password string
GET
/v1/core/organizations
Get all organizations (requires authentication)
POST
/v1/core/organizations
Create a new organization
GET
/v1/core/branches
Get all branches
POST
/v1/core/branches
Create a new branch
GET
/v1/core/employees
Get all employees
GET
/v1/core/positions
Get all positions
GET
/v1/core/profile
Get current user profile

📦 Assets APIs

Assets APIs manage inventory items, categories, and asset tracking operations.

GET
/v1/assets/categories
Get all asset categories
POST
/v1/assets/categories
Create a new asset category
GET
/v1/assets/items
Get all asset items
POST
/v1/assets/items
Create a new asset item
GET
/v1/assets/items-history
Get asset history
GET
/v1/assets/items-history-status
Get asset history status

🖥️ Console APIs

Console APIs provide administrative functions for system management and user access control.

GET
/v1/console/access
Get access control settings
GET
/v1/console/users
Get all users (admin only)
GET
/v1/console/organizations
Get all organizations (admin only)
GET
/v1/console/branches
Get all branches (admin only)
GET
/v1/console/assets-categories
Manage asset categories
GET
/v1/console/assets-items
Manage asset items
GET
/v1/console/assets-service-providers
Manage service providers

📊 Dashboard APIs

Dashboard APIs provide data for analytics, reporting, and user dashboard interfaces.

GET
/v1/dashboard/access
Get dashboard access permissions
GET
/v1/dashboard/assets-categories
Get asset categories for dashboard
GET
/v1/dashboard/assets-items
Get asset items for dashboard
GET
/v1/dashboard/assets-items-history
Get asset history for dashboard
GET
/v1/dashboard/assets-items-history-status
Get asset status for dashboard
GET
/v1/dashboard/assets-service-providers
Get service providers for dashboard
GET
/v1/dashboard/branches
Get branches for dashboard
GET
/v1/dashboard/organizations
Get organizations for dashboard
GET
/v1/dashboard/positions
Get positions for dashboard
GET
/v1/dashboard/users
Get users for dashboard

🏥 Health Check

Monitor the health and status of the database service and its connections.

🔍 Service Status

Checking...

🗄️ Database Connection

Checking...

📊 System Info

Checking...

🔐 API Testing Interface (Postman-like)

Comprehensive API testing interface with JWT authentication and database connection testing.

🔐 Authentication Setup

JWT Token: Not authenticated
User ID: -
Organization ID: -

📡 API Request Builder

🚀 Quick API Tests

📋 Response

Ready -

                            

🚀 Deployment

Docker Deployment

# Build and run
docker compose up -d --build

GitHub Actions CI/CD

The service uses GitHub Actions for automated deployment to VPS. Deployment is triggered by tag changes.

Health Check

GET
/health
Service health check endpoint

Port Configuration

  • Default Port: 8100
  • Health Check: Every 30 seconds
  • Resource Limits: 512MB RAM, 0.5 CPU