A comprehensive voucher management system with AdminJS panel and REST API.
- Admin Panel for CRUD Operations
- Voucher Expiry Check (Automated)
- REST API with Swagger Documentation
- Token-based API Authentication
- SQLite Database (Sequelize ORM)
- Install dependencies:
npm install
- Create .env file:
cp .env.example .env
- Run migrations:
npx sequelize-cli db:migrate
- Start the server:
npm start
- Build the Docker image:
docker build -t voucher-management .
- Run the container:
docker run -d -p 3000:3000 --name voucher-app voucher-management
- Admin Panel: http://localhost:3000/admin
- API Documentation: http://localhost:3000/api-docs
- API Base URL: http://localhost:3000/api/v1
- Username: [email protected]
- Password: adminpassword
All API endpoints require a Bearer token which can be generated from the admin panel.
- 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
- Enhanced API error responses to include more detailed information
- Updated Swagger documentation with new delete endpoint
The project uses GitHub Actions for continuous integration and delivery:
- 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)
- Branch names (e.g.,
# 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.