Spenser is a RESTful API server built with Rust, Actix Web, SeaORM, MySQL, and Docker. It provides authentication and transaction management functionalities.
- Rust
- Docker & Docker-Compose
- MySQL
The application requires the following environment variables:
DATABASE_URL=mysql://<USER>:<PASSWORD>@localhost:3306/<DB_NAME>
MYSQL_URL=mysql://<USER>:<PASSWORD>@db:3306/<DB_NAME>
MYSQL_USER=<USER>
MYSQL_DB=<DB_NAME>
MYSQL_PASSWORD=<PASSWORD>
MYSQL_ROOT_PASSWORD=<ROOT_PASSWORD>
JWT_SECRET=<YOUR_SECRET>
docker-compose up --build
Method | Path | Auth? | Description |
---|---|---|---|
POST | /auth/sign-up |
❌ | Create a new account. |
POST | /auth/sign-in |
❌ | Sign in, returns JWT on success. |
GET | /api/categories |
✅ | List categories. |
POST | /api/categories |
✅ | Create a new category. |
GET | /api/categories/{id} |
✅ | Get category by ID. |
PUT | /api/categories/{id} |
✅ | Update category by ID. |
DELETE | /api/categories/{id} |
✅ | Delete category by ID. |
GET | /api/categories/{id}/transactions |
✅ | List transactions in a category. |
GET | /api/transactions |
✅ | List all transactions. |
POST | /api/transactions |
✅ | Create a new transaction. |
GET | /api/transactions/{id} |
✅ | Get transaction by ID. |
PUT | /api/transactions/{id} |
✅ | Update transaction by ID. |
DELETE | /api/transactions/{id} |
✅ | Delete transaction by ID. |
Authentication: Include Authorization: Bearer <JWT>
in the header for authenticated requests.
The service uses MySQL as the database and runs inside a Docker container. Ensure MySQL is configured correctly before running the app.
cargo build --release
./target/release/Spenser
- Ensure
.env
is correctly configured before running. - Uses JWT-based authentication with a token lifetime of 4 hours.