Skip to content

klinikpintar/voucherai

Repository files navigation

Voucher Management System

A comprehensive voucher management system with AdminJS panel and REST API.

Features

  • Admin Panel for CRUD Operations
  • Voucher Expiry Check (Automated)
  • REST API with Swagger Documentation
  • Token-based API Authentication
  • SQLite Database (Sequelize ORM)

Setup

Local Development

  1. Install dependencies:
npm install
  1. Create .env file:
cp .env.example .env
  1. Run migrations:
npx sequelize-cli db:migrate
  1. Start the server:
npm start

Docker Setup

  1. Build the Docker image:
docker build -t voucher-management .
  1. Run the container:
docker run -d -p 3000:3000 --name voucher-app voucher-management

Access Points

Default Admin Credentials

API Authentication

All API endpoints require a Bearer token which can be generated from the admin panel.

Changelog

[2024-12-30]

Added

  • DELETE endpoint /api/v1/vouchers/{code} to remove vouchers
  • Request logging middleware to track API requests with timing information
  • Improved error handling for voucher creation with detailed error messages
  • GitHub Actions workflow for automated Docker image builds
  • Container Registry integration for Docker image distribution

Changed

  • Enhanced API error responses to include more detailed information
  • Updated Swagger documentation with new delete endpoint

CI/CD Pipeline

The project uses GitHub Actions for continuous integration and delivery:

Docker Image Publishing

  • Images are automatically built and published to GitHub Container Registry
  • Tags are created for:
    • Branch names (e.g., develop, main)
    • Git SHA (for precise version tracking)
    • Latest tag (only for main branch)

Pull Images

# Pull latest main branch image
docker pull ghcr.io/[username]/voucher-management:latest

# Pull specific branch
docker pull ghcr.io/[username]/voucher-management:develop

Replace [username] with your GitHub username.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages