This guide explains how to set up and run HamsterCare (both Frontend and Backend) on your local machine.
Before you begin, make sure you have the following installed:
- Go (Golang): Version 1.23.0 or later
- PostgreSQL: Needed to store hamster data
Clone both the Frontend and Backend repositories to your local machine:
git clone https://github.com/jncmtam/DADN-SE.gitEnsure you have Flutter (version 3.5.3 or later) installed on your system. If not, follow the official Flutter installation guide for your operating system at https://flutter.dev/docs/get-started/install
Verify your installation:
flutter --versioncd hamsFEInstall all required packages:
flutter pub getKey dependencies include:
- google_fonts
- flutter_svg
- http
- flutter_secure_storage
- web_socket_channel
- fl_chart
- flutter_local_notifications
- image_picker
The app is configured to connect to the backend at localhost:8080. If you need to modify this:
- Open
lib/views/constants.dart - Update the
apiUrlconstant with your backend URL
For development:
flutter runThis will launch the app on your connected device or emulator.
Supported platforms:
- Android
- iOS
- Web
- macOS
- Linux
- Windows
Note: For iOS and macOS development, ensure you have Xcode installed and CocoaPods dependencies are up to date:
cd ios/ # or macos/
pod installcd hamsBE
go mod tidyCreate or modify the .env file with your configuration details. Example of .env configuration:
# Go
PORT=8080
# Postgre config
DB_HOST=localhost
DB_PORT=5432
DB_USER=hamster
DB_PASSWORD=hamster
DB_NAME=hamster
JWT_SECRET_KEY=<your_jwt_secret_key>
# Địa chỉ MQTT Broker server (ví dụ: 10.28.129.171:1883 hoặc mqtt.example.com:1883)
MQTT_BROKER=<your_mqtt_broker_address>
# Email dùng để gửi email notification và OTP
EMAIL=<your_email_address>
# API Key của SendGrid để gửi email
SENDGRID_API_KEY=<your_sendgrid_api_key>
Using Go:
go run main.goFor hot-reload with air:
air(Optional) Using Docker:
docker-compose up --buildThis will start the backend server, which will be accessible at http://localhost:8080.