A backend system for a virtual reality real estate platform built with Dart Frog and Firebase.
- User authentication (register/login)
- Estate management (CRUD operations)
- Device management (CRUD operations)
- Real-time updates via WebSocket
- Firebase integration
- Dart SDK (>=3.0.0 <4.0.0)
- Flutter SDK (latest stable version)
- Firebase project set up
-
Clone the repository:
git clone https://github.com/wewerlive/vrrealstatedemo.git cd vrrealstatedemo -
Install dependencies:
dart pub get
-
Set up environment variables: Create a
.envfile in the root directory and add your Firebase credentials:FIREBASE_API_KEY=your_api_key FIREBASE_PROJECT_ID=your_project_id
-
Start the Dart Frog server:
dart_frog dev
-
The server will start, typically on
http://localhost:8080.
POST /auth/register: Register a new userPOST /auth/login: Login user
GET /data/devices: Get all devicesPOST /data/devices: Add a new devicePUT /data/devices: Update a device
GET /data/projects: Get all estatesPOST /data/projects: Add a new estatePUT /data/projects: Update an estateDELETE /data/projects: Delete a scene from an estate
GET /admin/users: Get all usersPOST /admin/ownerships/project: Manage project ownershipsPOST /admin/ownerships/device: Manage device ownerships
- Connect to
/server/socketfor real-time updates
vrrealstatedemo/
├── .dart_frog/
├── lib/
│ └── Firebase.dart
├── routes/
│ ├── _middleware.dart
│ ├── index.dart
│ ├── admin/
│ │ ├── _middleware.dart
│ │ ├── users/
│ │ │ └── index.dart
│ │ └── ownerships/
│ │ ├── device.dart
│ │ └── project.dart
│ ├── auth/
│ │ ├── login/
│ │ │ ├── _middleware.dart
│ │ │ └── index.dart
│ │ └── register/
│ │ ├── _middleware.dart
│ │ └── index.dart
│ ├── data/
│ │ ├── _middleware.dart
│ │ ├── index.dart
│ │ ├── devices.dart
│ │ └── projects.dart
│ └── server/
│ ├── _middleware.dart
│ └── socket.dart
├── test/
│ └── routes/
│ └── index_test.dart
├── analysis_options.yaml
├── dart_frog.yaml
├── pubspec.yaml
└── README.md
Run tests using the following command:
dart test-
Firebase Initialization Error:
- Error: "Firebase credentials not found in environment variables"
- Solution: Ensure that your
.envfile is properly set up with the correct Firebase credentials.
-
Dart Frog Server Won't Start:
- Error: "Address already in use"
- Solution: Check if another process is using port 8080. You can change the port in the
.dart_frog/server.dartfile.
-
Firestore Connection Issues:
- Error: "Failed to get document because the client is offline"
- Solution: Check your internet connection and ensure your Firebase project is properly set up and the rules allow read/write operations.
-
CORS Errors:
- Error: "Access to XMLHttpRequest has been blocked by CORS policy"
- Solution: Ensure the CORS middleware is properly set up in your
_middleware.dartfile.
-
Flutter SDK Not Found:
- Error: "Flutter SDK not found. Define location with flutter.sdk in the local.properties file."
- Solution: Ensure Flutter is properly installed and added to your PATH.
-
Dart SDK Version Mismatch:
- Error: "Dart SDK version x.x.x is required to use package:y"
- Solution: Update your Dart SDK to the required version or adjust the SDK constraints in
pubspec.yaml.
If you encounter any other errors, please check the Dart Frog and Firebase documentation or open an issue in the project repository.
Contributions are welcome! Please feel free to submit a Pull Request.