Skip to content

reergymerej/legendary-rotary-phone

Repository files navigation

Eligibility Engine

CI codecov Lint

A small TypeScript service that determines whether an action is allowed right now, based on historical records, time windows, and policy rules stored in a database.

Quick Start

# Setup the project
make setup

# Start the development server
make dev

The API will be running at http://localhost:3030

API Examples

Health Check

curl http://localhost:3030/health

Check Eligibility

curl -X POST http://localhost:3030/eligibility/check \
  -H "Content-Type: application/json" \
  -d '{"userId": "user123", "action": "api_call", "amount": 1}'

Record an Action

curl -X POST http://localhost:3030/eligibility/record \
  -H "Content-Type: application/json" \
  -d '{"userId": "user123", "action": "api_call", "amount": 1}'

Get User Action History

curl http://localhost:3030/eligibility/history/user123

List Policies

curl http://localhost:3030/policies

Create a Policy

curl -X POST http://localhost:3030/policies \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Daily API Limit",
    "action": "api_call",
    "limit": 1000,
    "window": "daily"
  }'

Development

# Start database containers
make docker-up

# Run migrations
make db-migrate

# Start development server
make dev

# Run tests
make test

# Run e2e tests
make test-e2e

About

A small TypeScript service that determines whether an action is allowed right now, based on historical records, time windows, and policy rules stored in a database.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors