A Rust-based payment gateway service with PostgreSQL database.
- Docker
- Docker Compose
-
Start the services:
docker-compose up -d
-
Wait for PostgreSQL to be ready and run migrations:
./scripts/setup.sh
-
Build and run the application:
docker-compose up app
-
Start only PostgreSQL:
docker-compose up -d postgres
-
Set environment variables:
export DATABASE_URL=postgresql://postgres:postgres@localhost:5432/payment_gateway -
Run migrations:
./scripts/setup.sh
-
Build and run locally:
cargo run
The application uses the following table structure:
CREATE TABLE payments (
id VARCHAR(255) PRIMARY KEY,
amount DECIMAL(10,2) NOT NULL,
status VARCHAR(50) NOT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
updated_at TIMESTAMP WITH TIME ZONE NOT NULL
);POST /payments- Create a new paymentGET /payments/{id}- Get payment by IDPUT /payments/{id}/status- Update payment status
DATABASE_URL- PostgreSQL connection stringPORT- Application port (default: 8080)
docker-compose downTo remove volumes as well:
docker-compose down -v