Bento is a School Canteen Automated Reporting System for the Department of Education (DepEd) Schools Division Office (SDO) of the City of Baliwag in the Philippines.
Why Bento?
"A bento is a Japanese-style single-portion take-out or home-packed meal, often for lunch, typically including rice and packaged in a box with a lid. The term bento is derived from the Chinese term biandang, which means "convenient" or "convenience"."
Component | Open Issues | Last Commit | Test Results | Code Coverage |
---|---|---|---|---|
Central Server | ||||
Web Client |
Code Coverage Graph
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Component | Stack |
---|---|
Central Server | |
Web Client |
The central server is written in Python using the FastAPI framework and utilizes SQLite or MySQL as its database, depending on the selected configuration. It also uses either a pure-Python file object storage or a third-party S3-compatible object storage for storing user avatars and exported PDFs. It is responsible for handling the backend logic and storing the submitted data of canteen managers.
The hard requirements are as follows:
-
Install the required software.
-
Clone the repository.
git clone https://github.com/Chris1320/ProjectSCARS.git
-
Navigate to the
CentralServer
directory.cd ProjectSCARS/CentralServer
-
Install dependencies.
uv sync
-
Copy and edit the configuration file.
cp .config.example.json config.json uv run ./scripts/secret.py sign # Generate secure secret keys uv run ./scripts/secret.py encrypt # and write it to `config.json` uv run ./scripts/secret.py refresh
Edit the
config.json
file to their appropriate values. -
Select the database you want to use. See Database Setup for more information.
-
Select the object store you want to use. See Object Store Setup for more information.
-
Run the FastAPI development server.
uv run fastapi dev centralserver --host 0.0.0.0 --port 8081
Important
The default credentials are:
- username:
scars
- password:
ProjectSCARS1
The central server supports the following databases:
- SQLite (default)
- MySQL
Central Server SQLite Database
To start using SQLite, just edit ./CentralServer/config.json
and adjust the
database
property to use SQLite. The connect_args
property is optional
and can be used to pass additional SQLAlchemy connection arguments.
On startup, the central server will create a SQLite database file
in the file path specified in the filepath
property. The default
is centralserver.db
in the root directory of the central server.
This database is sufficient for development and testing purposes, but for production use, it is recommended to use MySQL or similar database server.
Central Server MySQL Database
Since SQLite is a file-based database and lacks the ability to run multiple instances, it is not suitable for production use which needs high throughput and availability. Therefore, the central server also supports MySQL as a database. The MySQL database can be run in a containerized environment using Docker or Podman.
-
Create a
.env
file in./CentralServer/system/mysql/
using the example file.cd ./system/mysql/ cp .env.example .env
-
Adjust the environment variables in
./CentralServer/system/mysql/.env
. For more information about MySQL Docker environment variables, see their documentation. -
Run the MySQL container.
docker-compose up -d # Run this if you are using Docker. podman-compose up -d # Run this if you are using Podman. cd ../..
-
If successful, you should be able to access PHPMyAdmin at
http://localhost:8083
.
Important
You might need to log in as the root user in the database in the future. The root password is randomly generated, which can be seen in the logs of the MySQL container with the following format:
[Note] [Entrypoint]: GENERATED ROOT PASSWORD: bfPy...lqLL
-
Update
./CentralServer/config.json
to use MySQL. Use the same database credentials as the ones in the.env
file. Theconnect_args
property is optional and can be used to pass additional SQLAlchemy connection arguments.{ /* ... */ "database": { "type": "mysql", "config": { "username": "ProjectSCARS_DatabaseAdmin", "password": "ProjectSCARS_mysql143", "host": "localhost", "port": 3306, "database": "ProjectSCARS_CentralServer", "connect_args": { // sqlalchemy connection arguments }, }, }, /* ... */ }
The central server supports the following object stores:
- Local file object store (default)
- MinIO S3-compatible object store
Local File Object Store
To start using the local file object store, just edit
./CentralServer/config.json
and adjust the object_store
property to match the following structure:
{
/* ... */
"object_store": {
"type": "local",
"config": {
"filepath": "./data/",
},
},
/* ... */
}
When the central server starts, it will use the provided
filepath to store the files (objects). Make sure that the
filepath is writable by the server. The default is ./data/
in the root directory of the central server. It is already
created in the repository, so no further action is needed.
Because the local file object store is implemented in the central server itself, it does not provide any integrity and redundancy systems. Therefore, it is recommended to use a dedicated object store for production use, and use the local file object store only for development purposes.
MinIO S3-Compatible Object Store
Using MinIO, it is possible to provide multiple nodes to store the objects. This is useful for redundancy and high availability, therefore it is recommended to be used in production. The MinIO object store can be run in a containerized environment using Docker or Podman.
-
Create a
.env
file in./CentralServer/system/minio/
using the example file.cd ./system/minio/ cp .env.example .env
-
Adjust the environment variables in
./CentralServer/system/minio/.env
. -
Run the MinIO container.
docker-compose up -d # Run this if you are using Docker. podman-compose up -d # Run this if you are using Podman. cd ../..
-
If successful, you should be able to access the MinIO dashboard at
http://localhost:8084
. -
Log in to the dashboard using the credentials in the
.env
file. -
Navigate to the
Access Keys
tab and create a new access key. Make sure to copy the keys, as they will not be shown again. -
Edit
./CentralServer/config.json
and adjust theobject_store
to match the following structure:{ /* ... */ "object_store": { "type": "minio", "config": { "endpoint": "localhost:9000", "access_key": "YOUR_ACCESS_KEY", "secret_key": "YOUR_SECRET_KEY", "secure": false, }, }, /* ... */ }
The following environment variables are used by the central server to further configure its behavior. These variables are optional.
Environment Variable | Value | Description |
---|---|---|
CENTRAL_SERVER_CONFIG_FILE |
./config.json |
The path of the configuration file to use. |
CENTRAL_SERVER_CONFIG_ENCODING |
utf-8 |
The encoding of the configuration file. |
The web client is written in TypeScript using the Next.js framework. It is the user-facing application that allows canteen managers to submit their monthly financial reports to the central server. The web client also optionally communicates with the local server to provide inventory and sales functionality.
The web client is written in TypeScript v5, and is run via NodeJS v23.6.0.
-
Install the required software.
-
Clone the repository.
git clone https://github.com/Chris1320/ProjectSCARS.git
-
Navigate to the
WebClient
directory.cd ProjectSCARS/WebClient
-
Install dependencies.
npm install
-
Run the development server.
npm run dev
Important
Look at the central server and local server documentation for the default credentials.