pumpkinlog is a presence-based tax evaluation system. It evaluates users travel histories against complex, jurisdiction-specific tax residency rules to determine residency status. This repository holds the backend code.
This is a portfolio project built to demonstrate backend system design. It is under active development.
- Includes a flexible rule engine supporting the vast majority of tax residency rules.
- Stateless and horizontally scalable.
- Full suite of unit and integration tests.
Pumpkinlog models complex residency logic using in Rules using child Nodes. The general app structure follows:
Regionis an isolated tax jurisdiction, be it acountry,stateorzone.Ruleis a child of aRegion. It is the high level structure that contains an initalNode.Conditionis a child of aRegion. It defines a question, and the user-response can be used as aRuledependency. Answers are stored as anAnswer.
Nodeis a child of aRule. Nodes can be the following types:Strategynodes evaluate a users presence in aRegionand generate a residency profile.Conditionnodes depend on a region condition and subsequent user answer.AndandAnynodes can be used to combine two or more child nodes to create complex branching logic.
With this design, pumpkinlog can effictively model any day-based tax residency criteria for any tax jurisdiction globally.
pumpkinlog is structured using a clean architecture architecture to keep concerns well separated:
├── cmd/ # App entrypoint
├── internal/
│ ├── api/ # HTTP API handlers
│ ├── app/ # Core business logic
│ ├── cmd/ # Command definitions
│ ├── cmdutil/ # CLI helper utilities
│ ├── domain/ # Core types and interfaces
│ ├── engine/ # Evaluation engine logic
│ ├── engine/strategies/ # Tax rule strategies
│ ├── repository/ # PostgreSQL data access layer
│ ├── service/ # Business logic
│ ├── seed/ # App data seeder
│ ├── worker/ # RabbitMQ workers
│ └── test/mocks/ # Mocks for testing
├── migrations/ # Postgres schema migrations
├── docker-compose.yml
├── Dockerfile
The app is designed to be stateless and horizontally scalable.
Start a local development instance using Docker:
docker compose up -d --build
Run database migrations and seed initial data:
make migrate_up
make seed
Start the backend API:
make run
- API ->
http://localhost:4000 - API OpenAPI Documentation ->
http://localhost:4000/docs - Go Runtime Info & Exported Metrics ->
http://localhost:6060/debug/vars
- Implement a cache repository layer using Redis.
- Build out a notification worker to alert users of residency thresholds.