Gard is an inventory management system built with FastAPI, SQLModel, and MySQL. It allows stores to manage categories, products, and inventory processes, with history tracking and media uploads.
- Branch authentication and registration
- Category and product management with custom ordering
- Inventory process tracking (start, continue, finish)
- History of inventory operations
- Media upload and retrieval for product images
- RESTful API with OpenAPI docs
-
Clone the repository
git clone https://github.com/yourusername/gard.git cd gard -
Create and configure
.envfileMYSQL_USER=youruser MYSQL_PASSWORD=yourpassword MYSQL_HOST=db MYSQL_PORT=3306 MYSQL_DB=garddb SECRET_KEY=your_secret_key ALGORITHM=HS256 UPLOADS=/uploads BASE_URL=http://localhost:8000/ -
Build and run with Docker Compose
docker-compose up --build
-
Access API docs
app/: FastAPI application codemodel/: SQLModel ORM modelsrouters/: API endpointsservice/: Business logicmain.py: App entrypointdependencies.py: Dependency injection
uploads/: Uploaded product imagesDockerfile: Container build instructionsdocker-compose.yml: Multi-service orchestration.github/workflows/deploy.yml: CI/CD workflow for deployment
-
Configure server and secrets
- Generate SSH keys and add them to your server and GitHub secrets as described in
.github/workflows/deploy.yml.
- Generate SSH keys and add them to your server and GitHub secrets as described in
-
Push to
mainbranch- The GitHub Actions workflow will deploy your code to the server, rebuild containers, and restart the app.
-
Persistent uploads
- The
uploadsfolder is mounted as a Docker volume for persistent media storage.
- The
- Login/Register branch
- Manage categories and products
- Start and process inventory
- View history and continue unfinished inventories
- Upload and fetch product images
For more details, see the API documentation at http://localhost:8000/docs.