improved README.md

This commit is contained in:
2025-07-04 17:48:10 +08:00
parent b11533e819
commit 4bb65956e6

View File

@@ -2,8 +2,8 @@
![Rust](https://img.shields.io/badge/rust-%23000000.svg?logo=rust&logoColor=white)
![PostgreSQL](https://img.shields.io/badge/PostgreSQL-316192?style=for-square&logo=postgresql&logoColor=white)
![Axum](https://img.shields.io/badge/Tokio-1.46-green?style=for-square)
![Axum](https://img.shields.io/badge/Sqlx-0.8-green?style=for-square)
![Tokio](https://img.shields.io/badge/Tokio-1.46-green?style=for-square)
![Sqlx](https://img.shields.io/badge/Sqlx-0.8-green?style=for-square)
![Axum](https://img.shields.io/badge/Axum-0.8-green?style=for-square)
Intrasys is an internal financial transfers application built with Rust and Axum, providing HTTP endpoints for account management and transaction processing with PostgreSQL as the backing database.
@@ -24,7 +24,10 @@ Intrasys is an internal financial transfers application built with Rust and Axum
## Quick Start
### 1. Provision PostgreSQL Database
### 1. Ensure you have rust installed
Foolow the steps described [here](https://www.rust-lang.org/tools/install) if you don't
### 2. Provision PostgreSQL Database
The easiest way is to run a PostgreSQL container with Docker:
@@ -32,21 +35,24 @@ The easiest way is to run a PostgreSQL container with Docker:
docker run --name intrasys-pg -d -e POSTGRES_PASSWORD=password -p 127.0.0.1:5432:5432 postgres:alpine
```
### 2. Configure Environment
Create a `.env` file in the project root:
```bash
echo "DATABASE_URL=postgres://postgres:password@localhost:5432/postgres" > .env
```
### 3. Run the Application
### 2. Run the Application
```bash
cargo run
```
The application will be available at `http://localhost:3000`
The application will be available at `http://localhost:8080`
## Running unit tests
Make sure you have an available postgres database and edit `DATABASE_URL` variable in the `.env` file accordingly. If you've used the docker command mentioned in the *Quickstart*
section you don't need to change anything.
Then run
```bash
cargo test
```
## API Endpoints
@@ -83,35 +89,14 @@ The application will be available at `http://localhost:3000`
}
```
## Development Setup
1. Install Rust toolchain:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
2. Clone the repository:
```bash
git clone https://github.com/yourusername/intrasys.git
cd intrasys
```
3. Run database migrations (optional - the app will create tables if they don't exist):
```bash
sqlx migrate run
```
## Assumptions
- All accounts use the same currency
- No authentication or authorization is implemented
- Decimal precision of 10 decimal places is sufficient for financial amounts
- Decimal precision of 2 decimal places is sufficient for financial amounts, maximum allowed monetary amount is (10^18 -0.01) and the minimum is (-10^18 + 0.01)
- Account IDs are positive integers
- Account creation must NOT be idempotent since it also sets the account balance (creating an account that already exists should fail)
- Transfer money to an account that does not exist should not create a new account, but fail with an error (to prevent users from accidentally locking their money forever)
## License
MIT License
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.