Iron Guard Server

Inventory Management System written in Rust

RustDockerfile

Project Details

🗃️ Iron Guard Server

Iron Guard Server is an inventory management system server written in Rust.


Author: Afaan Bilal


Run with Docker Docker

docker run --rm -it -p 8000:8000 \
    -e ROCKET_ADDRESS=0.0.0.0 \
    -e IRON_GUARD_SECRET=[RANDOM SECRET] \
    -e IRON_GUARD_DB_HOST=host.docker.internal \
    -e IRON_GUARD_DB_PORT=3306 \
    -e IRON_GUARD_DB_USERNAME=[DB USERNAME] \
    -e IRON_GUARD_DB_PASSWORD=[DB PASSWORD] \
    afaanbilal/iron-guard-server

Configuration

The following environment variables configure the server.

Environment VariableDefault valueDescription
IRONGUARDSECRETtestThe JWT signing secret. Must be set.
IRONGUARDDB_TYPEmysqlDatabase Type. Options: mysql.
IRONGUARDDB_HOSTlocalhostDatabase Host
IRONGUARDDB_PORT3306Database Port
IRONGUARDDB_USERNAMErootDatabase Username
IRONGUARDDB_PASSWORD[blank]Database Password
IRONGUARDDB_DATABASEiron_guardDatabase Name
ROCKET_ADDRESS127.0.0.1HTTP Server Bind Address
ROCKET_PORT8000HTTP Server Port

Run

cargo run

API

MethodPathAuth?Description
GET/⬜Index. Returns Iron Guard.
POST/auth/sign-in⬜Returns a JWT on success.
GET/dashboard✅Get the dashboard information.
GET/me✅Get the authenticated user's profile.
PUT/me✅Update the authenticated user's profile.
GET/categories✅Get a list of categories.
POST/categories✅Create a category.
GET/categories/{uuid}✅Get a category with matching the uuid.
PUT/categories/{uuid}✅Update the category matching the uuid.
DELETE/categories/{uuid}✅Delete the category matching the uuid.
GET/items✅Get a list of items.
POST/items✅Create a item.
GET/items/{uuid}✅Get a item with matching the uuid.
PUT/items/{uuid}✅Update the item matching the uuid.
DELETE/items/{uuid}✅Delete the item matching the uuid.
GET/users✅[admin] Get a list of users.
POST/users✅[admin] Create a user.
GET/users/{uuid}✅[admin] Get a user with matching the uuid.
PUT/users/{uuid}✅[admin] Update the user matching the uuid.
DELETE/users/{uuid}✅[admin] Delete the user matching the uuid.

Authentication

  • All auth required requests: Add header token with the JWT as the value.
  • Token lifetime: 4 hours.

Test

cargo test

Entity Generation

sea-orm-cli generate entity -o src/entities -u mysql://root:@localhost:3306/iron_guard

Contributing

All contributions are welcome. Please create an issue first for any feature request
or bug. Then fork the repository, create a branch and make any changes to fix the bug
or add the feature and create a pull request. That's it!
Thanks!


License

Iron Guard Server is released under the MIT License.
Check out the full license here.

License

MIT License

Copyright (c) 2023 Afaan Bilal

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.