This project includes a local Go installation, so you don't need to install Go system-wide.
You can use the provided shell script to run Go commands:
# Run the hello world example
./go.sh run src/main.go
# Build a binary
./go.sh build -o bin/app src/main.go
# Get dependencies
./go.sh mod tidy
# Run any other Go command
./go.sh <command> [arguments]goroot/- Contains the local Go installationsrc/- Source codepkg/- Package objectsbin/- Compiled binaries
A high-performance Go web service that processes CSV files, validates royalty percentages and date formats, and converts the data to JSON.
- Fast Parallel Processing: Configurable number of worker goroutines
- Web Interface: Easy-to-use upload form
- REST API: Simple endpoint for programmatic access
- Validation: Checks royalty percentages and date formats
- Containerized: Ready to deploy with Docker
The easiest way to run the application is with Docker and Docker Compose:
# Build and start the service
make deploy
# Or manually:
docker-compose up -dThis will start the service on port 8080. Access the web interface at http://localhost:8080
# Build the Docker image
docker build -t csv-processor-api .
# Run the container
docker run -p 8080:8080 --name csv-api csv-processor-apiThe project includes a Makefile with helpful commands:
# Show available commands
make help
# Build Docker image
make build
# Run Docker container
make run-docker
# Stop Docker container
make stop
# Clean up Docker resources
make cleanOpen http://localhost:8080 in your browser and use the upload form.
Use the /upload endpoint to programmatically process CSV files:
# Using curl
curl -X POST \
-F "csvFile=@/path/to/your/file.csv" \
-F "workers=4" \
http://localhost:8080/upload > results.jsonThe CSV file should have the following headers:
Release ID, Release Title, Track ID, Track Title, ISRC, Artist Name, Genre,
Release Date, Label Name, UPC, Language, Explicit, Territories, Rights Holder,
File URL, Royalty Artist %, Royalty Label %, Royalty Distributor %, Royalty Publisher %
The API returns a JSON object with two main sections:
validation: Validation results for each row, keyed by Track IDconversion: The converted CSV data as an array of objects
Example:
{
"validation": {
"TRK001": {
"release_id": "RLS001",
"track_id": "TRK001",
"royalties_sum": true,
"date_format": true
},
...
},
"conversion": [
{
"Release ID": "RLS001",
"Release Title": "Midnight Drive",
...
},
...
]
}If you have Go installed locally (version 1.22 or later), you can build and run without Docker:
# Using the local go.sh script (if available)
./go.sh run src/main.go
# Or using the standard Go command
go run src/main.go
# Build a binary
go build -o bin/csvapi src/main.go
./bin/csvapiThe Docker image is ready for deployment to various cloud platforms:
- AWS ECS/Fargate: Use the provided Dockerfile
- Google Cloud Run: Deploy directly from the Docker image
- Kubernetes: Use the provided Docker image with your K8s configuration
- Digital Ocean App Platform: Deploy directly from the Docker image
PORT: The port on which the server will listen (default: 8080)
The repository includes sample CSV files for testing:
src/sample-data/sample.csv: A clean sample with valid datasrc/sample-data/sample-with-errors.csv: A sample with validation errors to test error handling
You can use these files to test the application:
# Upload via web interface
# Navigate to http://localhost:8080 and select one of the sample files
# Or using curl
curl -X POST \
-F "csvFile=@src/sample-data/sample.csv" \
-F "workers=4" \
http://localhost:8080/upload > results.json
# Test with invalid data
curl -X POST \
-F "csvFile=@src/sample-data/sample-with-errors.csv" \
-F "workers=4" \
http://localhost:8080/upload > error_results.json