improved README.md
This commit is contained in:
61
README.md
61
README.md
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
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.
|
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
|
## 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:
|
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
|
docker run --name intrasys-pg -d -e POSTGRES_PASSWORD=password -p 127.0.0.1:5432:5432 postgres:alpine
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Configure Environment
|
### 2. Run the Application
|
||||||
|
|
||||||
Create a `.env` file in the project root:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
echo "DATABASE_URL=postgres://postgres:password@localhost:5432/postgres" > .env
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Run the Application
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo run
|
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
|
## API Endpoints
|
||||||
|
|
||||||
@@ -81,37 +87,16 @@ The application will be available at `http://localhost:3000`
|
|||||||
"destination_account_id": 456,
|
"destination_account_id": 456,
|
||||||
"amount": "50.12345"
|
"amount": "50.12345"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## 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
|
## Assumptions
|
||||||
|
|
||||||
- All accounts use the same currency
|
- All accounts use the same currency
|
||||||
- No authentication or authorization is implemented
|
- 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 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.
|
|
||||||
|
Reference in New Issue
Block a user